ray/src/global_scheduler/global_scheduler_algorithm.c
Robert Nishihara d77b685a90 Global scheduler skeleton (#45)
* Initial scheduler commit

* global scheduler

* add global scheduler

* Implement global scheduler skeleton.

* Formatting.

* Allow local scheduler to be started without a connection to redis so that we can test it without a global scheduler.

* Fail if there are no local schedulers when the global scheduler receives a task.

* Initialize uninitialized value and formatting fix.

* Generalize local scheduler table to db client table.

* Remove code duplication in local scheduler and add flag for whether a task came from the global scheduler or not.

* Queue task specs in the local scheduler instead of tasks.

* Simple global scheduler tests, including valgrind.

* Factor out functions for starting processes.

* Fixes.
2016-11-18 19:57:51 -08:00

29 lines
939 B
C

#include "task.h"
#include "task_table.h"
#include "global_scheduler_algorithm.h"
void handle_task_waiting(global_scheduler_state *state, task *task) {
if (utarray_len(state->local_schedulers) > 0) {
local_scheduler *scheduler =
(local_scheduler *) utarray_eltptr(state->local_schedulers, 0);
assign_task_to_local_scheduler(state, task, scheduler->id);
} else {
CHECKM(0, "We currently don't handle this case.");
}
}
void handle_object_available(global_scheduler_state *state,
object_id object_id) {
/* Do nothing for now. */
}
void handle_local_scheduler_heartbeat(global_scheduler_state *state) {
/* Do nothing for now. */
}
void handle_new_local_scheduler(global_scheduler_state *state,
db_client_id db_client_id) {
local_scheduler local_scheduler = {.id = db_client_id};
utarray_push_back(state->local_schedulers, &local_scheduler);
}