From 794f547d0a0828b65ba8dbb37f952f8528a55f1c Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Tue, 20 Mar 2018 14:55:20 -0700 Subject: [PATCH] Always send actor creation tasks to the global scheduler. (#1757) --- src/local_scheduler/local_scheduler_algorithm.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/local_scheduler/local_scheduler_algorithm.cc b/src/local_scheduler/local_scheduler_algorithm.cc index a8f2f582a..fbad23711 100644 --- a/src/local_scheduler/local_scheduler_algorithm.cc +++ b/src/local_scheduler/local_scheduler_algorithm.cc @@ -1286,9 +1286,14 @@ void handle_task_submitted(LocalSchedulerState *state, // locally, and there is an available worker, then enqueue the task in the // dispatch queue and trigger task dispatch. Otherwise, pass the task along to // the global scheduler if there is one. + // Note that actor creation tasks automatically go to the global scheduler. + // See https://github.com/ray-project/ray/issues/1756 for more discussion. + // This is a hack to improve actor load balancing (and to prevent the scenario + // where all actors are started locally). if (resource_constraints_satisfied(state, spec) && (algorithm_state->available_workers.size() > 0) && - can_run(algorithm_state, execution_spec)) { + can_run(algorithm_state, execution_spec) && + !TaskSpec_is_actor_creation_task(spec)) { queue_dispatch_task(state, algorithm_state, execution_spec, false); } else { /* Give the task to the global scheduler to schedule, if it exists. */