Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/ray/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import division
from __future__ import print_function

import cloudpickle as pickle
import hashlib
import inspect
import json
Expand All @@ -10,7 +11,6 @@
import traceback

import ray.local_scheduler
import ray.pickling as pickling
import ray.signature as signature
import ray.worker
from ray.utils import random_string, binary_to_hex, hex_to_binary
Expand Down Expand Up @@ -72,7 +72,7 @@ def temporary_actor_method(*xs):
temporary_actor_method)

try:
unpickled_class = pickling.loads(pickled_class)
unpickled_class = pickle.loads(pickled_class)
except Exception:
# If an exception was thrown when the actor was imported, we record the
# traceback and notify the scheduler of the failure.
Expand Down Expand Up @@ -207,7 +207,7 @@ def export_actor_class(class_id, Class, actor_method_names, worker):
d = {"driver_id": worker.task_driver_id.id(),
"class_name": Class.__name__,
"module": Class.__module__,
"class": pickling.dumps(Class),
"class": pickle.dumps(Class),
"actor_method_names": json.dumps(list(actor_method_names))}
worker.redis_client.hmset(key, d)
worker.redis_client.rpush("Exports", key)
Expand Down
87 changes: 0 additions & 87 deletions python/ray/pickling.py

This file was deleted.

7 changes: 4 additions & 3 deletions python/ray/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from __future__ import division
from __future__ import print_function

import cloudpickle as pickle

import ray.numbuf
import ray.pickling as pickling


class RaySerializationException(Exception):
Expand Down Expand Up @@ -123,7 +124,7 @@ def serialize(obj):
class_id = type_to_class_id[type(obj)]

if class_id in classes_to_pickle:
serialized_obj = {"data": pickling.dumps(obj),
serialized_obj = {"data": pickle.dumps(obj),
"pickle": True}
elif class_id in custom_serializers:
serialized_obj = {"data": custom_serializers[class_id](obj)}
Expand Down Expand Up @@ -160,7 +161,7 @@ def deserialize(serialized_obj):

if "pickle" in serialized_obj:
# The object was pickled, so unpickle it.
obj = pickling.loads(serialized_obj["data"])
obj = pickle.loads(serialized_obj["data"])
else:
assert class_id not in classes_to_pickle
if class_id not in whitelisted_classes:
Expand Down
10 changes: 5 additions & 5 deletions python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import print_function

import atexit
import cloudpickle as pickle
import collections
import colorama
import copy
Expand All @@ -20,7 +21,6 @@

# Ray modules
import ray.experimental.state as state
import ray.pickling as pickling
import ray.serialization as serialization
import ray.services as services
import ray.signature as signature
Expand Down Expand Up @@ -497,7 +497,7 @@ def run_function_on_all_workers(self, function):
# Attempt to pickle the function before we need it. This could fail, and
# it is more convenient if the failure happens before we actually run the
# function locally.
pickled_function = pickling.dumps(function)
pickled_function = pickle.dumps(function)

function_to_run_id = random_string()
key = "FunctionsToRun:{}".format(function_to_run_id)
Expand Down Expand Up @@ -1087,7 +1087,7 @@ def f():
num_gpus)

try:
function = pickling.loads(serialized_function)
function = pickle.loads(serialized_function)
except:
# If an exception was thrown when the remote function was imported, we
# record the traceback and notify the scheduler of the failure.
Expand Down Expand Up @@ -1117,7 +1117,7 @@ def fetch_and_execute_function_to_run(key, worker=global_worker):
counter = worker.redis_client.hincrby(worker.node_ip_address, key, 1) - 1
try:
# Deserialize the function.
function = pickling.loads(serialized_function)
function = pickle.loads(serialized_function)
# Run the function.
function({"counter": counter})
except:
Expand Down Expand Up @@ -1843,7 +1843,7 @@ def export_remote_function(function_id, func_name, func, func_invoker,
# Allow the function to reference itself as a global variable
func.__globals__[func.__name__] = func_invoker
try:
pickled_func = pickling.dumps(func)
pickled_func = pickle.dumps(func)
finally:
# Undo our changes
if func_name_global_valid:
Expand Down