mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 15:35:47 +08:00
Refactor code about ray.ObjectID. (#3674)
* Refactor code about ray.ObjectID. * remove from_random and use nil_id instead of constructor * remove id() in hash * Lint and fix * Change driver id to ObjectID * Replace binary_to_hex(ObjectID.id()) to ObjectID.hex()
This commit is contained in:
committed by
Philipp Moritz
parent
c4b058739b
commit
d2cf8561f2
+9
-8
@@ -67,10 +67,10 @@ def push_error_to_driver(worker,
|
||||
will be serialized with json and stored in Redis.
|
||||
"""
|
||||
if driver_id is None:
|
||||
driver_id = ray_constants.NIL_JOB_ID.id()
|
||||
driver_id = ray.ObjectID.nil_id()
|
||||
data = {} if data is None else data
|
||||
worker.raylet_client.push_error(
|
||||
ray.ObjectID(driver_id), error_type, message, time.time())
|
||||
worker.raylet_client.push_error(driver_id, error_type, message,
|
||||
time.time())
|
||||
|
||||
|
||||
def push_error_to_driver_through_redis(redis_client,
|
||||
@@ -96,15 +96,16 @@ def push_error_to_driver_through_redis(redis_client,
|
||||
will be serialized with json and stored in Redis.
|
||||
"""
|
||||
if driver_id is None:
|
||||
driver_id = ray_constants.NIL_JOB_ID.id()
|
||||
driver_id = ray.ObjectID.nil_id()
|
||||
data = {} if data is None else data
|
||||
# Do everything in Python and through the Python Redis client instead
|
||||
# of through the raylet.
|
||||
error_data = ray.gcs_utils.construct_error_message(driver_id, error_type,
|
||||
message, time.time())
|
||||
redis_client.execute_command(
|
||||
"RAY.TABLE_APPEND", ray.gcs_utils.TablePrefix.ERROR_INFO,
|
||||
ray.gcs_utils.TablePubsub.ERROR_INFO, driver_id, error_data)
|
||||
redis_client.execute_command("RAY.TABLE_APPEND",
|
||||
ray.gcs_utils.TablePrefix.ERROR_INFO,
|
||||
ray.gcs_utils.TablePubsub.ERROR_INFO,
|
||||
driver_id.id(), error_data)
|
||||
|
||||
|
||||
def is_cython(obj):
|
||||
@@ -400,7 +401,7 @@ def check_oversized_pickle(pickled, name, obj_type, worker):
|
||||
worker,
|
||||
ray_constants.PICKLING_LARGE_OBJECT_PUSH_ERROR,
|
||||
warning_message,
|
||||
driver_id=worker.task_driver_id.id())
|
||||
driver_id=worker.task_driver_id)
|
||||
|
||||
|
||||
class _ThreadSafeProxy(object):
|
||||
|
||||
Reference in New Issue
Block a user