def __init__(self, experiment: 'Experiment',
               create_task: Callable[[Awaitable[Any]], futures.Future],
               args: Optional[Mapping[str,
                                      Any]], role: ExperimentUnitRole) -> None:
    """Initializes an `ExperimentUnit` instance.

    Args:
      experiment: An experiment this unit belongs to.
      create_task: A callback to register a new asynchronous task.
      args: Arguments to this experiment unit. Most commonly used to represent
        the hyperparameter sweep trial corresponding to a work unit.
      role: The role of this unit in the experiment structure.
    """
    self.experiment = experiment
    self._create_task = create_task
    self._args = args
    self._role = role

    self._launch_tasks: List[futures.Future] = []