from typing import Sequence
from typing import List
import json


def create_cluster_specs(workers: Sequence[str]) -> List[str]:
  """Takes a list of domain names and constructs a CLUSTER_SPEC for each."""
  cluster = {}
  for i, domain in enumerate(workers):
    cluster[f'workerpool{i}'] = [domain]
  specs = []
  for i in range(len(workers)):
    spec = {
        'cluster': cluster,
        'task': {
            'type': f'workerpool{i}',
            'index': i
        },
    }
    specs.append(json.dumps(spec))
  return specs