Ray, Tune, and RLlib support for memory, object_store_memory options (#5226)

This commit is contained in:
Eric Liang
2019-08-22 14:01:10 +08:00
committed by Robert Nishihara
parent c852213b83
commit e2e30ca507
40 changed files with 1006 additions and 296 deletions
+9 -5
View File
@@ -12,6 +12,7 @@ from ray.includes.task cimport (
TaskSpecBuilder,
TaskTableData,
)
from ray.utils import decode
cdef class TaskSpec:
@@ -19,7 +20,8 @@ cdef class TaskSpec:
cdef:
unique_ptr[CTaskSpec] task_spec
def __init__(self, TaskID task_id, JobID job_id, function_descriptor, arguments,
def __init__(self, TaskID task_id, JobID job_id, function_descriptor,
arguments,
int num_returns, TaskID parent_task_id, int parent_counter,
ActorID actor_creation_id,
ObjectID actor_creation_dummy_object_id,
@@ -209,7 +211,7 @@ cdef class TaskSpec:
while iterator != resource_map.end():
resource_name = dereference(iterator).first
# bytes for Py2, unicode for Py3
py_resource_name = str(resource_name)
py_resource_name = decode(resource_name)
resource_value = dereference(iterator).second
required_resources[py_resource_name] = resource_value
postincrement(iterator)
@@ -259,7 +261,7 @@ cdef class TaskExecutionSpec:
def __init__(self):
cdef:
RpcTaskExecutionSpec message;
RpcTaskExecutionSpec message
self.c_spec.reset(new CTaskExecutionSpec(message))
@@ -267,7 +269,8 @@ cdef class TaskExecutionSpec:
def from_string(const c_string& string):
"""Convert a string to a Ray `TaskExecutionSpec` Python object.
"""
cdef TaskExecutionSpec self = TaskExecutionSpec.__new__(TaskExecutionSpec)
cdef TaskExecutionSpec self = TaskExecutionSpec.__new__(
TaskExecutionSpec)
self.c_spec.reset(new CTaskExecutionSpec(string))
return self
@@ -280,7 +283,8 @@ cdef class Task:
cdef:
unique_ptr[CTask] c_task
def __init__(self, TaskSpec task_spec, TaskExecutionSpec task_execution_spec):
def __init__(
self, TaskSpec task_spec, TaskExecutionSpec task_execution_spec):
self.c_task.reset(new CTask(task_spec.task_spec.get()[0],
task_execution_spec.c_spec.get()[0]))