World - Access values and schedule iterations

class manta_light.world.World(host: str | None = None, port: int | None = None, task_id: str | None = None)

World service for accessing values with other nodes

The World service allows the user to interact with collective values during a Swarm iteration

Parameters should not be fulfill manually. Instead, it is managed during the deployment of the task by the Node.

Parameters:
  • host (Optional[str]) – Manager host

  • port (Optional[int]) – Manager port

  • task_id (Optional[str]) – Task ID

schedule_next_iter(node_ids: list, task_to_schedule_alias: str)

Schedule the next iteration

Parameters:
  • node_ids (list) – The list of node ids to schedule the next iteration for

  • task_to_schedule_alias (str) – The task to schedule for the next iteration

Examples

From Task attribute:

>>> self.world.schedule_next_iter(
...     node_ids=selected_nodes, task_to_schedule_alias="worker"
... )
stop_swarm()

Stop the swarm

Examples

From Task attribute:

>>> self.world.stop_swarm()
async async_schedule_next_iter(node_ids: list, task_to_schedule_alias: str)

Schedule the next iteration

Parameters:
  • node_ids (list) – The list of node ids to schedule the next iteration for

  • task_to_schedule_alias (str) – The task to schedule for the next iteration

Examples

Same as schedule_next_iter but asynchronous:

>>> await self.world.async_schedule_next_iter(
...     node_ids=selected_nodes, task_to_schedule_alias="worker"
... )
async async_stop_swarm()

Stop the swarm

Examples

Same as stop_swarm but asynchronous:

>>> await self.world.async_stop_swarm()