mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 07:41:09 +08:00
Remove dependencies from TaskExecutionSpecification (#5166)
This commit is contained in:
committed by
Philipp Moritz
parent
fd71ffde2f
commit
e5be5fd46d
@@ -232,14 +232,11 @@ cdef class RayletClient:
|
||||
def disconnect(self):
|
||||
check_status(self.client.get().Disconnect())
|
||||
|
||||
def submit_task(self, TaskSpec task_spec, execution_dependencies):
|
||||
def submit_task(self, TaskSpec task_spec):
|
||||
cdef:
|
||||
CObjectID c_id
|
||||
c_vector[CObjectID] c_dependencies
|
||||
for dep in execution_dependencies:
|
||||
c_dependencies.push_back((<ObjectID>dep).native())
|
||||
check_status(self.client.get().SubmitTask(
|
||||
c_dependencies, task_spec.task_spec.get()[0]))
|
||||
task_spec.task_spec.get()[0]))
|
||||
|
||||
def get_task(self):
|
||||
cdef:
|
||||
|
||||
+1
-1
@@ -547,7 +547,7 @@ class ActorHandle(object):
|
||||
actor_counter=self._ray_actor_counter,
|
||||
actor_creation_dummy_object_id=(
|
||||
self._ray_actor_creation_dummy_object_id),
|
||||
execution_dependencies=[self._ray_actor_cursor],
|
||||
previous_actor_task_dummy_object_id=self._ray_actor_cursor,
|
||||
new_actor_handles=self._ray_new_actor_handles,
|
||||
# We add one for the dummy return ID.
|
||||
num_return_vals=num_return_vals + 1,
|
||||
|
||||
@@ -50,9 +50,7 @@ cdef extern from "ray/raylet/raylet_client.h" nogil:
|
||||
c_bool is_worker, const CJobID &job_id,
|
||||
const CLanguage &language)
|
||||
CRayStatus Disconnect()
|
||||
CRayStatus SubmitTask(
|
||||
const c_vector[CObjectID] &execution_dependencies,
|
||||
const CTaskSpec &task_spec)
|
||||
CRayStatus SubmitTask(const CTaskSpec &task_spec)
|
||||
CRayStatus GetTask(unique_ptr[CTaskSpec] *task_spec)
|
||||
CRayStatus TaskDone()
|
||||
CRayStatus FetchOrReconstruct(c_vector[CObjectID] &object_ids,
|
||||
|
||||
@@ -66,6 +66,7 @@ cdef extern from "ray/common/task/task_spec.h" namespace "ray" nogil:
|
||||
c_bool IsActorTask() const
|
||||
CActorID ActorCreationId() const
|
||||
CObjectID ActorCreationDummyObjectId() const
|
||||
CObjectID PreviousActorTaskDummyObjectId() const
|
||||
uint64_t MaxActorReconstructions() const
|
||||
CActorID ActorId() const
|
||||
CActorHandleID ActorHandleId() const
|
||||
@@ -92,8 +93,10 @@ cdef extern from "ray/common/task/task_util.h" namespace "ray" nogil:
|
||||
|
||||
TaskSpecBuilder &SetActorTaskSpec(
|
||||
const CActorID &actor_id, const CActorHandleID &actor_handle_id,
|
||||
const CObjectID &actor_creation_dummy_object_id, uint64_t actor_counter,
|
||||
const c_vector[CActorHandleID] &new_handle_ids)
|
||||
const CObjectID &actor_creation_dummy_object_id,
|
||||
const CObjectID &previous_actor_task_dummy_object_id,
|
||||
uint64_t actor_counter,
|
||||
const c_vector[CActorHandleID] &new_handle_ids);
|
||||
|
||||
RpcTaskSpec GetMessage()
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ cdef class TaskSpec:
|
||||
int num_returns, TaskID parent_task_id, int parent_counter,
|
||||
ActorID actor_creation_id,
|
||||
ObjectID actor_creation_dummy_object_id,
|
||||
ObjectID previous_actor_task_dummy_object_id,
|
||||
int32_t max_actor_reconstructions, ActorID actor_id,
|
||||
ActorHandleID actor_handle_id, int actor_counter,
|
||||
new_actor_handles, resource_map, placement_resource_map):
|
||||
@@ -85,6 +86,7 @@ cdef class TaskSpec:
|
||||
actor_id.native(),
|
||||
actor_handle_id.native(),
|
||||
actor_creation_dummy_object_id.native(),
|
||||
previous_actor_task_dummy_object_id.native(),
|
||||
actor_counter,
|
||||
c_new_actor_handles,
|
||||
)
|
||||
@@ -229,6 +231,13 @@ cdef class TaskSpec:
|
||||
return ObjectID(
|
||||
self.task_spec.get().ActorCreationDummyObjectId().Binary())
|
||||
|
||||
def previous_actor_task_dummy_object_id(self):
|
||||
"""Return the object ID of the previously executed actor task."""
|
||||
if not self.is_actor_task():
|
||||
return ObjectID.nil()
|
||||
return ObjectID(
|
||||
self.task_spec.get().PreviousActorTaskDummyObjectId().Binary())
|
||||
|
||||
def actor_id(self):
|
||||
"""Return the actor ID for this task."""
|
||||
if not self.is_actor_task():
|
||||
@@ -247,13 +256,10 @@ cdef class TaskExecutionSpec:
|
||||
cdef:
|
||||
unique_ptr[CTaskExecutionSpec] c_spec
|
||||
|
||||
def __init__(self, execution_dependencies):
|
||||
def __init__(self):
|
||||
cdef:
|
||||
RpcTaskExecutionSpec message;
|
||||
|
||||
for dependency in execution_dependencies:
|
||||
message.add_dependencies(
|
||||
(<ObjectID?>dependency).binary())
|
||||
self.c_spec.reset(new CTaskExecutionSpec(message))
|
||||
|
||||
@staticmethod
|
||||
@@ -264,16 +270,6 @@ cdef class TaskExecutionSpec:
|
||||
self.c_spec.reset(new CTaskExecutionSpec(string))
|
||||
return self
|
||||
|
||||
def dependencies(self):
|
||||
cdef:
|
||||
CObjectID c_id
|
||||
c_vector[CObjectID] dependencies = (
|
||||
self.c_spec.get().ExecutionDependencies())
|
||||
ret = []
|
||||
for c_id in dependencies:
|
||||
ret.append(ObjectID(c_id.Binary()))
|
||||
return ret
|
||||
|
||||
def num_forwards(self):
|
||||
return self.c_spec.get().NumForwards()
|
||||
|
||||
|
||||
+2
-1
@@ -341,6 +341,8 @@ class GlobalState(object):
|
||||
"ActorCreationID": task.actor_creation_id().hex(),
|
||||
"ActorCreationDummyObjectID": (
|
||||
task.actor_creation_dummy_object_id().hex()),
|
||||
"PreviousActorTaskDummyObjectID": (
|
||||
task.previous_actor_task_dummy_object_id().hex()),
|
||||
"ActorCounter": task.actor_counter(),
|
||||
"Args": task.arguments(),
|
||||
"ReturnObjectIDs": task.returns(),
|
||||
@@ -356,7 +358,6 @@ class GlobalState(object):
|
||||
task_table_data.task.task_execution_spec.SerializeToString())
|
||||
return {
|
||||
"ExecutionSpec": {
|
||||
"Dependencies": execution_spec.dependencies(),
|
||||
"NumForwards": execution_spec.num_forwards(),
|
||||
},
|
||||
"TaskSpec": task_spec_info
|
||||
|
||||
@@ -586,8 +586,8 @@ class Worker(object):
|
||||
actor_counter=0,
|
||||
actor_creation_id=None,
|
||||
actor_creation_dummy_object_id=None,
|
||||
previous_actor_task_dummy_object_id=None,
|
||||
max_actor_reconstructions=0,
|
||||
execution_dependencies=None,
|
||||
new_actor_handles=None,
|
||||
num_return_vals=None,
|
||||
resources=None,
|
||||
@@ -611,7 +611,9 @@ class Worker(object):
|
||||
actor_creation_dummy_object_id: If this task is an actor method,
|
||||
then this argument is the dummy object ID associated with the
|
||||
actor creation task for the corresponding actor.
|
||||
execution_dependencies: The execution dependencies for this task.
|
||||
previous_actor_task_dummy_object_id: If this task is an actor,
|
||||
then this argument is the dummy object ID associated with the
|
||||
task previously submitted to the corresponding actor.
|
||||
num_return_vals: The number of return values this function should
|
||||
have.
|
||||
resources: The resource requirements for this task.
|
||||
@@ -652,10 +654,6 @@ class Worker(object):
|
||||
else:
|
||||
args_for_raylet.append(put(arg))
|
||||
|
||||
# By default, there are no execution dependencies.
|
||||
if execution_dependencies is None:
|
||||
execution_dependencies = []
|
||||
|
||||
if new_actor_handles is None:
|
||||
new_actor_handles = []
|
||||
|
||||
@@ -705,6 +703,7 @@ class Worker(object):
|
||||
self.task_context.task_index,
|
||||
actor_creation_id,
|
||||
actor_creation_dummy_object_id,
|
||||
previous_actor_task_dummy_object_id,
|
||||
max_actor_reconstructions,
|
||||
actor_id,
|
||||
actor_handle_id,
|
||||
@@ -713,7 +712,7 @@ class Worker(object):
|
||||
resources,
|
||||
placement_resources,
|
||||
)
|
||||
self.raylet_client.submit_task(task, execution_dependencies)
|
||||
self.raylet_client.submit_task(task)
|
||||
|
||||
return task.returns()
|
||||
|
||||
@@ -1887,6 +1886,7 @@ def connect(node,
|
||||
0, # parent_counter.
|
||||
ActorID.nil(), # actor_creation_id.
|
||||
ObjectID.nil(), # actor_creation_dummy_object_id.
|
||||
ObjectID.nil(), # previous_actor_task_dummy_object_id.
|
||||
0, # max_actor_reconstructions.
|
||||
ActorID.nil(), # actor_id.
|
||||
ActorHandleID.nil(), # actor_handle_id.
|
||||
|
||||
Reference in New Issue
Block a user