mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 15:35:47 +08:00
Fix seed bug for generating object ids for put (#120)
* fix seed bug for generating object ids for put * fix clang-format
This commit is contained in:
committed by
Robert Nishihara
parent
24d2b42d86
commit
2152cd9f31
@@ -258,9 +258,9 @@ static PyObject *PyTask_task_id(PyObject *self) {
|
||||
}
|
||||
|
||||
static PyObject *PyTask_arguments(PyObject *self) {
|
||||
int64_t num_args = task_num_args(((PyTask *) self)->spec);
|
||||
PyObject *arg_list = PyList_New((Py_ssize_t) num_args);
|
||||
task_spec *task = ((PyTask *) self)->spec;
|
||||
int64_t num_args = task_num_args(task);
|
||||
PyObject *arg_list = PyList_New((Py_ssize_t) num_args);
|
||||
for (int i = 0; i < num_args; ++i) {
|
||||
if (task_arg_type(task, i) == ARG_BY_REF) {
|
||||
object_id object_id = task_arg_id(task, i);
|
||||
@@ -281,9 +281,9 @@ static PyObject *PyTask_arguments(PyObject *self) {
|
||||
}
|
||||
|
||||
static PyObject *PyTask_returns(PyObject *self) {
|
||||
int64_t num_returns = task_num_returns(((PyTask *) self)->spec);
|
||||
PyObject *return_id_list = PyList_New((Py_ssize_t) num_returns);
|
||||
task_spec *task = ((PyTask *) self)->spec;
|
||||
int64_t num_returns = task_num_returns(task);
|
||||
PyObject *return_id_list = PyList_New((Py_ssize_t) num_returns);
|
||||
for (int i = 0; i < num_returns; ++i) {
|
||||
object_id object_id = task_return(task, i);
|
||||
PyList_SetItem(return_id_list, i, PyObjectID_make(object_id));
|
||||
@@ -431,3 +431,14 @@ PyObject *check_simple_value(PyObject *self, PyObject *args) {
|
||||
}
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
PyObject *compute_put_id(PyObject *self, PyObject *args) {
|
||||
int put_index;
|
||||
task_id task_id;
|
||||
if (!PyArg_ParseTuple(args, "O&i", &PyObjectToUniqueID, &task_id,
|
||||
&put_index)) {
|
||||
return NULL;
|
||||
}
|
||||
object_id put_id = task_compute_put_id(task_id, put_index);
|
||||
return PyObjectID_make(put_id);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ PyObject *PyObjectID_make(object_id object_id);
|
||||
|
||||
PyObject *check_simple_value(PyObject *self, PyObject *args);
|
||||
|
||||
PyObject *compute_put_id(PyObject *self, PyObject *args);
|
||||
|
||||
PyObject *PyTask_make(task_spec *task_spec);
|
||||
|
||||
#endif /* COMMON_EXTENSION_H */
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
static PyMethodDef common_methods[] = {
|
||||
{"check_simple_value", check_simple_value, METH_VARARGS,
|
||||
"Should the object be passed by value?"},
|
||||
{"compute_put_id", compute_put_id, METH_VARARGS,
|
||||
"Return the object ID for a put call within a task."},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user