mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
Generate return object IDs in the task constructor. (#36)
This commit is contained in:
parent
7be1a93d64
commit
7f515113fa
1 changed files with 9 additions and 0 deletions
|
@ -131,6 +131,7 @@ static int PyTask_init(PyTask *self, PyObject *args, PyObject *kwds) {
|
|||
int val_repr_index = 0;
|
||||
self->spec =
|
||||
alloc_task_spec(function_id, size, num_returns, value_data_bytes);
|
||||
/* Add the task arguments. */
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
PyObject *arg = PyList_GetItem(arguments, i);
|
||||
if (PyObject_IsInstance(arg, (PyObject *) &PyObjectIDType)) {
|
||||
|
@ -145,6 +146,14 @@ static int PyTask_init(PyTask *self, PyObject *args, PyObject *kwds) {
|
|||
}
|
||||
}
|
||||
utarray_free(val_repr_ptrs);
|
||||
/* Generate and add the object IDs for the return values. */
|
||||
for (size_t i = 0; i < num_returns; ++i) {
|
||||
/* TODO(rkn): Later, this should be computed as a deterministic hash of (1)
|
||||
* the contents of the task, (2) the index i, and (3) a counter of the
|
||||
* number of tasks launched so far by the parent task. For now, we generate
|
||||
* it randomly. */
|
||||
*task_return(self->spec, i) = globally_unique_id();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue