mirror of
https://github.com/wassname/ray.git
synced 2026-08-14 12:40:23 +08:00
Implement local scheduler task queues using C++ data structures (#392)
* Switch to using C++ lists for task queues * Init and free methods for TaskQueueEntry * Switch from utarray to c++ vector for TaskQueueEntry * Get rid of some pointers * Back to O(1) deletion from waiting_task_queue * Fix comments * Cut code * Non const iterators * Fix Alexey's comments
This commit is contained in:
committed by
Robert Nishihara
parent
8245758ccb
commit
036b873bf2
@@ -275,6 +275,19 @@ double TaskSpec_get_required_resource(const TaskSpec *spec,
|
||||
return message->required_resources()->Get(resource_index);
|
||||
}
|
||||
|
||||
bool TaskSpec_is_dependent_on(TaskSpec *spec, ObjectID object_id) {
|
||||
int64_t num_args = TaskSpec_num_args(spec);
|
||||
for (int i = 0; i < num_args; ++i) {
|
||||
if (TaskSpec_arg_by_ref(spec, i)) {
|
||||
ObjectID arg_id = TaskSpec_arg_id(spec, i);
|
||||
if (ObjectID_equal(arg_id, object_id)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TaskSpec_free(TaskSpec *spec) {
|
||||
free(spec);
|
||||
}
|
||||
|
||||
@@ -263,6 +263,16 @@ ObjectID TaskSpec_return(TaskSpec *data, int64_t return_index);
|
||||
double TaskSpec_get_required_resource(const TaskSpec *spec,
|
||||
int64_t resource_index);
|
||||
|
||||
/**
|
||||
* Compute whether the task is dependent on an object ID.
|
||||
*
|
||||
* @param spec Task specification.
|
||||
* @param object_id The object ID that the task may be dependent on.
|
||||
* @return bool This returns true if the task is dependent on the given object
|
||||
* ID and false otherwise.
|
||||
*/
|
||||
bool TaskSpec_is_dependent_on(TaskSpec *spec, ObjectID object_id);
|
||||
|
||||
/**
|
||||
* Compute the object id associated to a put call.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user