Shortcuts

framework.parallel

parallel

Parallel

class ding.framework.parallel.Parallel(*args, **kwargs)[source]
classmethod runner(n_parallel_workers: int, mq_type: str = 'nng', attach_to: List[str] | None = None, protocol: str = 'ipc', address: str | None = None, ports: List[int] | int | None = None, topology: str = 'mesh', labels: Set[str] | None = None, node_ids: List[int] | int | None = None, auto_recover: bool = False, max_retries: int = inf, redis_host: str | None = None, redis_port: int | None = None, startup_interval: int = 1) Callable[source]
Overview:

This method allows you to configure parallel parameters, and now you are still in the parent process.

Arguments:
  • n_parallel_workers (int): Workers to spawn.

  • mq_type (str): Embedded message queue type, i.e. nng, redis.

  • attach_to (Optional[List[str]]): The node’s addresses you want to attach to.

  • protocol (str): Network protocol.

  • address (Optional[str]): Bind address, ip or file path.

  • ports (Optional[List[int]]): Candidate ports.

  • topology (str): Network topology, includes:

    mesh (default): fully connected between each other; star: only connect to the first node; alone: do not connect to any node, except the node attached to;

  • labels (Optional[Set[str]]): Labels.

  • node_ids (Optional[List[int]]): Candidate node ids.

  • auto_recover (bool): Auto recover from uncaught exceptions from main.

  • max_retries (int): Max retries for auto recover.

  • redis_host (str): Redis server host.

  • redis_port (int): Redis server port.

  • startup_interval (int): Start up interval between each task.

Returns:
  • _runner (Callable): The wrapper function for main.