mirror of
https://github.com/wassname/ray.git
synced 2026-07-10 22:00:09 +08:00
[api] Second round of 1.0 API changes: exceptions, num_return_vals (#10377)
This commit is contained in:
+13
-13
@@ -101,11 +101,11 @@ import ray.ray_constants as ray_constants
|
||||
from ray import profiling
|
||||
from ray.exceptions import (
|
||||
RayError,
|
||||
RayletError,
|
||||
RaySystemError,
|
||||
RayTaskError,
|
||||
ObjectStoreFullError,
|
||||
RayTimeoutError,
|
||||
RayCancellationError
|
||||
GetTimeoutError,
|
||||
TaskCancelledError
|
||||
)
|
||||
from ray.utils import decode
|
||||
import gc
|
||||
@@ -143,11 +143,11 @@ cdef int check_status(const CRayStatus& status) nogil except -1:
|
||||
elif status.IsInterrupted():
|
||||
raise KeyboardInterrupt()
|
||||
elif status.IsTimedOut():
|
||||
raise RayTimeoutError(message)
|
||||
raise GetTimeoutError(message)
|
||||
elif status.IsNotFound():
|
||||
raise ValueError(message)
|
||||
else:
|
||||
raise RayletError(message)
|
||||
raise RaySystemError(message)
|
||||
|
||||
cdef RayObjectsToDataMetadataPairs(
|
||||
const c_vector[shared_ptr[CRayObject]] objects):
|
||||
@@ -481,7 +481,7 @@ cdef execute_task(
|
||||
outputs = function_executor(*args, **kwargs)
|
||||
task_exception = False
|
||||
except KeyboardInterrupt as e:
|
||||
raise RayCancellationError(
|
||||
raise TaskCancelledError(
|
||||
core_worker.get_current_task_id())
|
||||
if c_return_ids.size() == 1:
|
||||
outputs = (outputs,)
|
||||
@@ -489,7 +489,7 @@ cdef execute_task(
|
||||
# was exiting and was raised after the except block.
|
||||
if not check_signals().ok():
|
||||
task_exception = True
|
||||
raise RayCancellationError(
|
||||
raise TaskCancelledError(
|
||||
core_worker.get_current_task_id())
|
||||
# Store the outputs in the object store.
|
||||
with core_worker.profile_event(b"task:store_outputs"):
|
||||
@@ -976,7 +976,7 @@ cdef class CoreWorker:
|
||||
Language language,
|
||||
FunctionDescriptor function_descriptor,
|
||||
args,
|
||||
int num_return_vals,
|
||||
int num_returns,
|
||||
resources,
|
||||
int max_retries,
|
||||
PlacementGroupID placement_group_id,
|
||||
@@ -993,7 +993,7 @@ cdef class CoreWorker:
|
||||
with self.profile_event(b"submit_task"):
|
||||
prepare_resources(resources, &c_resources)
|
||||
task_options = CTaskOptions(
|
||||
num_return_vals, c_resources)
|
||||
num_returns, c_resources)
|
||||
ray_function = CRayFunction(
|
||||
language.lang, function_descriptor.descriptor)
|
||||
prepare_args(self, language, args, &args_vector)
|
||||
@@ -1103,7 +1103,7 @@ cdef class CoreWorker:
|
||||
ActorID actor_id,
|
||||
FunctionDescriptor function_descriptor,
|
||||
args,
|
||||
int num_return_vals,
|
||||
int num_returns,
|
||||
double num_method_cpus):
|
||||
|
||||
cdef:
|
||||
@@ -1117,7 +1117,7 @@ cdef class CoreWorker:
|
||||
with self.profile_event(b"submit_task"):
|
||||
if num_method_cpus > 0:
|
||||
c_resources[b"CPU"] = num_method_cpus
|
||||
task_options = CTaskOptions(num_return_vals, c_resources)
|
||||
task_options = CTaskOptions(num_returns, c_resources)
|
||||
ray_function = CRayFunction(
|
||||
language.lang, function_descriptor.descriptor)
|
||||
prepare_args(self, language, args, &args_vector)
|
||||
@@ -1209,7 +1209,7 @@ cdef class CoreWorker:
|
||||
return ray.actor.ActorHandle(language, actor_id,
|
||||
method_meta.decorators,
|
||||
method_meta.signatures,
|
||||
method_meta.num_return_vals,
|
||||
method_meta.num_returns,
|
||||
actor_method_cpu,
|
||||
actor_creation_function_descriptor,
|
||||
worker.current_session_and_job)
|
||||
@@ -1217,7 +1217,7 @@ cdef class CoreWorker:
|
||||
return ray.actor.ActorHandle(language, actor_id,
|
||||
{}, # method decorators
|
||||
{}, # method signatures
|
||||
{}, # method num_return_vals
|
||||
{}, # method num_returns
|
||||
0, # actor method cpu
|
||||
actor_creation_function_descriptor,
|
||||
worker.current_session_and_job)
|
||||
|
||||
Reference in New Issue
Block a user