From 1b3c48b922e1a25274d088f421d1ed4b3dce34bd Mon Sep 17 00:00:00 2001 From: Edward Oakes Date: Mon, 23 Nov 2020 20:30:30 -0600 Subject: [PATCH] Remove unused _post_get_hooks (#12270) --- python/ray/tests/test_advanced_3.py | 10 ---------- python/ray/worker.py | 10 +--------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/python/ray/tests/test_advanced_3.py b/python/ray/tests/test_advanced_3.py index b40d95d8b..420c0c594 100644 --- a/python/ray/tests/test_advanced_3.py +++ b/python/ray/tests/test_advanced_3.py @@ -476,16 +476,6 @@ def test_decorated_function(ray_start_regular): assert ray.get(result_id) == (3, 2, 1, 5) -def test_get_postprocess(ray_start_regular): - def get_postprocessor(object_refs, values): - return [value for value in values if value > 0] - - ray.worker.global_worker._post_get_hooks.append(get_postprocessor) - - assert ray.get( - [ray.put(i) for i in [0, 1, 3, 5, -1, -3, 4]]) == [1, 3, 5, 4] - - def test_export_after_shutdown(ray_start_regular): # This test checks that we can use actor and remote function definitions # across multiple Ray sessions. diff --git a/python/ray/worker.py b/python/ray/worker.py index a2ea1ead2..e05340f0a 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -122,9 +122,6 @@ class Worker: # Index of the current session. This number will # increment every time when `ray.shutdown` is called. self._session_index = 0 - # Functions to run to process the values returned by ray.get. Each - # postprocessor must take two arguments ("object_refs", and "values"). - self._post_get_hooks = [] @property def connected(self): @@ -827,7 +824,6 @@ def shutdown(_exiting_interpreter=False): # TODO(rkn): Instead of manually resetting some of the worker fields, we # should simply set "global_worker" to equal "None" or something like that. global_worker.set_mode(None) - global_worker._post_get_hooks = [] atexit.register(shutdown, True) @@ -1312,7 +1308,7 @@ def show_in_dashboard(message, key="", dtype="text"): worker.core_worker.set_webui_display(key.encode(), message_encoded) -# Global varaible to make sure we only send out the warning once +# Global variable to make sure we only send out the warning once. blocking_get_inside_async_warned = False @@ -1380,10 +1376,6 @@ def get(object_refs, *, timeout=None): else: raise value - # Run post processors. - for post_processor in worker._post_get_hooks: - values = post_processor(object_refs, values) - if is_individual_id: values = values[0] return values