ray.util.scheduling_strategies.NodeAffinitySchedulingStrategy.__init__#

NodeAffinitySchedulingStrategy.__init__(node_id: str, soft: bool, _spill_on_unavailable: bool = False, _fail_on_unavailable: bool = False)[source]#

Initialize a NodeAffinitySchedulingStrategy.

Parameters:
  • node_id – the hex id of the node where the task or actor should run.

  • soft – whether the scheduler should run the task or actor somewhere else if the target node doesn’t exist (e.g. the node dies) or is infeasible during scheduling. If the node exists and is feasible, the task or actor will only be scheduled there. This means if the node doesn’t have the available resources, the task or actor will wait indefinitely until resources become available. If the node doesn’t exist or is infeasible, the task or actor will fail if soft is False or be scheduled somewhere else if soft is True.

  • _spill_on_unavailable – (Private) When soft is True, allow spilling to another node if the target node is unavailable.

  • _fail_on_unavailable – (Private) When soft is False, fail immediately if the target node is unavailable rather than waiting.