mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 17:41:35 +08:00
Change type naming convention. (#315)
* Rename object_id -> ObjectID. * Rename ray_logger -> RayLogger. * rename task_id -> TaskID, actor_id -> ActorID, function_id -> FunctionID * Rename plasma_store_info -> PlasmaStoreInfo. * Rename plasma_store_state -> PlasmaStoreState. * Rename plasma_object -> PlasmaObject. * Rename object_request -> ObjectRequests. * Rename eviction_state -> EvictionState. * Bug fix. * rename db_handle -> DBHandle * Rename local_scheduler_state -> LocalSchedulerState. * rename db_client_id -> DBClientID * rename task -> Task * make redis.c C++ compatible * Rename scheduling_algorithm_state -> SchedulingAlgorithmState. * Rename plasma_connection -> PlasmaConnection. * Rename client_connection -> ClientConnection. * Fixes from rebase. * Rename local_scheduler_client -> LocalSchedulerClient. * Rename object_buffer -> ObjectBuffer. * Rename client -> Client. * Rename notification_queue -> NotificationQueue. * Rename object_get_requests -> ObjectGetRequests. * Rename get_request -> GetRequest. * Rename object_info -> ObjectInfo. * Rename scheduler_object_info -> SchedulerObjectInfo. * Rename local_scheduler -> LocalScheduler and some fixes. * Rename local_scheduler_info -> LocalSchedulerInfo. * Rename global_scheduler_state -> GlobalSchedulerState. * Rename global_scheduler_policy_state -> GlobalSchedulerPolicyState. * Rename object_size_entry -> ObjectSizeEntry. * Rename aux_address_entry -> AuxAddressEntry. * Rename various ID helper methods. * Rename Task helper methods. * Rename db_client_cache_entry -> DBClientCacheEntry. * Rename local_actor_info -> LocalActorInfo. * Rename actor_info -> ActorInfo. * Rename retry_info -> RetryInfo. * Rename actor_notification_table_subscribe_data -> ActorNotificationTableSubscribeData. * Rename local_scheduler_table_send_info_data -> LocalSchedulerTableSendInfoData. * Rename table_callback_data -> TableCallbackData. * Rename object_info_subscribe_data -> ObjectInfoSubscribeData. * Rename local_scheduler_table_subscribe_data -> LocalSchedulerTableSubscribeData. * Rename more redis call data structures. * Rename photon_conn PhotonConnection. * Rename photon_mock -> PhotonMock. * Fix formatting errors.
This commit is contained in:
committed by
Robert Nishihara
parent
be1618f041
commit
a30eed452e
@@ -35,7 +35,7 @@ void init_pickle_module(void) {
|
||||
|
||||
/* Define the PyObjectID class. */
|
||||
|
||||
int PyStringToUniqueID(PyObject *object, object_id *object_id) {
|
||||
int PyStringToUniqueID(PyObject *object, ObjectID *object_id) {
|
||||
if (PyBytes_Check(object)) {
|
||||
memcpy(&object_id->id[0], PyBytes_AsString(object), UNIQUE_ID_SIZE);
|
||||
return 1;
|
||||
@@ -45,7 +45,7 @@ int PyStringToUniqueID(PyObject *object, object_id *object_id) {
|
||||
}
|
||||
}
|
||||
|
||||
int PyObjectToUniqueID(PyObject *object, object_id *objectid) {
|
||||
int PyObjectToUniqueID(PyObject *object, ObjectID *objectid) {
|
||||
if (PyObject_IsInstance(object, (PyObject *) &PyObjectIDType)) {
|
||||
*objectid = ((PyObjectID *) object)->object_id;
|
||||
return 1;
|
||||
@@ -61,7 +61,7 @@ static int PyObjectID_init(PyObjectID *self, PyObject *args, PyObject *kwds) {
|
||||
if (!PyArg_ParseTuple(args, "s#", &data, &size)) {
|
||||
return -1;
|
||||
}
|
||||
if (size != sizeof(object_id)) {
|
||||
if (size != sizeof(ObjectID)) {
|
||||
PyErr_SetString(CommonError,
|
||||
"ObjectID: object id string needs to have length 20");
|
||||
return -1;
|
||||
@@ -71,7 +71,7 @@ static int PyObjectID_init(PyObjectID *self, PyObject *args, PyObject *kwds) {
|
||||
}
|
||||
|
||||
/* Create a PyObjectID from C. */
|
||||
PyObject *PyObjectID_make(object_id object_id) {
|
||||
PyObject *PyObjectID_make(ObjectID object_id) {
|
||||
PyObjectID *result = PyObject_New(PyObjectID, &PyObjectIDType);
|
||||
result = (PyObjectID *) PyObject_Init((PyObject *) result, &PyObjectIDType);
|
||||
result->object_id = object_id;
|
||||
@@ -136,7 +136,7 @@ static PyObject *PyObjectID_id(PyObject *self) {
|
||||
static PyObject *PyObjectID_hex(PyObject *self) {
|
||||
PyObjectID *s = (PyObjectID *) self;
|
||||
char hex_id[ID_STRING_SIZE];
|
||||
object_id_to_string(s->object_id, hex_id, ID_STRING_SIZE);
|
||||
ObjectID_to_string(s->object_id, hex_id, ID_STRING_SIZE);
|
||||
PyObject *result = PyUnicode_FromString(hex_id);
|
||||
return result;
|
||||
}
|
||||
@@ -157,14 +157,12 @@ static PyObject *PyObjectID_richcompare(PyObjectID *self,
|
||||
result = Py_NotImplemented;
|
||||
break;
|
||||
case Py_EQ:
|
||||
result = object_ids_equal(self->object_id, other_id->object_id)
|
||||
? Py_True
|
||||
: Py_False;
|
||||
result = ObjectID_equal(self->object_id, other_id->object_id) ? Py_True
|
||||
: Py_False;
|
||||
break;
|
||||
case Py_NE:
|
||||
result = !object_ids_equal(self->object_id, other_id->object_id)
|
||||
? Py_True
|
||||
: Py_False;
|
||||
result = !ObjectID_equal(self->object_id, other_id->object_id) ? Py_True
|
||||
: Py_False;
|
||||
break;
|
||||
case Py_GT:
|
||||
result = Py_NotImplemented;
|
||||
@@ -190,7 +188,7 @@ static long PyObjectID_hash(PyObjectID *self) {
|
||||
|
||||
static PyObject *PyObjectID_repr(PyObjectID *self) {
|
||||
char hex_id[ID_STRING_SIZE];
|
||||
object_id_to_string(self->object_id, hex_id, ID_STRING_SIZE);
|
||||
ObjectID_to_string(self->object_id, hex_id, ID_STRING_SIZE);
|
||||
UT_string *repr;
|
||||
utstring_new(repr);
|
||||
utstring_printf(repr, "ObjectID(%s)", hex_id);
|
||||
@@ -264,13 +262,13 @@ PyTypeObject PyObjectIDType = {
|
||||
|
||||
static int PyTask_init(PyTask *self, PyObject *args, PyObject *kwds) {
|
||||
/* ID of the driver that this task originates from. */
|
||||
unique_id driver_id;
|
||||
UniqueID driver_id;
|
||||
/* ID of the actor this task should run on. */
|
||||
unique_id actor_id = NIL_ACTOR_ID;
|
||||
UniqueID actor_id = NIL_ACTOR_ID;
|
||||
/* How many tasks have been launched on the actor so far? */
|
||||
int actor_counter = 0;
|
||||
/* ID of the function this task executes. */
|
||||
function_id function_id;
|
||||
FunctionID function_id;
|
||||
/* Arguments of the task (can be PyObjectIDs or Python values). */
|
||||
PyObject *arguments;
|
||||
/* Array of pointers to string representations of pass-by-value args. */
|
||||
@@ -278,7 +276,7 @@ static int PyTask_init(PyTask *self, PyObject *args, PyObject *kwds) {
|
||||
utarray_new(val_repr_ptrs, &ut_ptr_icd);
|
||||
int num_returns;
|
||||
/* The ID of the task that called this task. */
|
||||
task_id parent_task_id;
|
||||
TaskID parent_task_id;
|
||||
/* The number of tasks that the parent task has called prior to this one. */
|
||||
int parent_counter;
|
||||
/* Resource vector of the required resources to execute this task. */
|
||||
@@ -353,22 +351,22 @@ static void PyTask_dealloc(PyTask *self) {
|
||||
}
|
||||
|
||||
static PyObject *PyTask_function_id(PyObject *self) {
|
||||
function_id function_id = task_function(((PyTask *) self)->spec);
|
||||
FunctionID function_id = task_function(((PyTask *) self)->spec);
|
||||
return PyObjectID_make(function_id);
|
||||
}
|
||||
|
||||
static PyObject *PyTask_actor_id(PyObject *self) {
|
||||
actor_id actor_id = task_spec_actor_id(((PyTask *) self)->spec);
|
||||
ActorID actor_id = task_spec_actor_id(((PyTask *) self)->spec);
|
||||
return PyObjectID_make(actor_id);
|
||||
}
|
||||
|
||||
static PyObject *PyTask_driver_id(PyObject *self) {
|
||||
unique_id driver_id = task_spec_driver_id(((PyTask *) self)->spec);
|
||||
UniqueID driver_id = task_spec_driver_id(((PyTask *) self)->spec);
|
||||
return PyObjectID_make(driver_id);
|
||||
}
|
||||
|
||||
static PyObject *PyTask_task_id(PyObject *self) {
|
||||
task_id task_id = task_spec_id(((PyTask *) self)->spec);
|
||||
TaskID task_id = task_spec_id(((PyTask *) self)->spec);
|
||||
return PyObjectID_make(task_id);
|
||||
}
|
||||
|
||||
@@ -378,7 +376,7 @@ static PyObject *PyTask_arguments(PyObject *self) {
|
||||
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);
|
||||
ObjectID object_id = task_arg_id(task, i);
|
||||
PyList_SetItem(arg_list, i, PyObjectID_make(object_id));
|
||||
} else {
|
||||
CHECK(pickle_module != NULL);
|
||||
@@ -410,7 +408,7 @@ static PyObject *PyTask_returns(PyObject *self) {
|
||||
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);
|
||||
ObjectID object_id = task_return(task, i);
|
||||
PyList_SetItem(return_id_list, i, PyObjectID_make(object_id));
|
||||
}
|
||||
return return_id_list;
|
||||
@@ -569,11 +567,11 @@ PyObject *check_simple_value(PyObject *self, PyObject *args) {
|
||||
|
||||
PyObject *compute_put_id(PyObject *self, PyObject *args) {
|
||||
int put_index;
|
||||
task_id task_id;
|
||||
TaskID 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);
|
||||
ObjectID put_id = task_compute_put_id(task_id, put_index);
|
||||
return PyObjectID_make(put_id);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ extern PyObject *CommonError;
|
||||
// clang-format off
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
object_id object_id;
|
||||
ObjectID object_id;
|
||||
} PyObjectID;
|
||||
|
||||
typedef struct {
|
||||
@@ -33,11 +33,11 @@ extern PyObject *pickle_loads;
|
||||
|
||||
void init_pickle_module(void);
|
||||
|
||||
int PyStringToUniqueID(PyObject *object, object_id *object_id);
|
||||
int PyStringToUniqueID(PyObject *object, ObjectID *object_id);
|
||||
|
||||
int PyObjectToUniqueID(PyObject *object, object_id *objectid);
|
||||
int PyObjectToUniqueID(PyObject *object, ObjectID *objectid);
|
||||
|
||||
PyObject *PyObjectID_make(object_id object_id);
|
||||
PyObject *PyObjectID_make(ObjectID object_id);
|
||||
|
||||
PyObject *check_simple_value(PyObject *self, PyObject *args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user