diff --git a/python/ray/import_thread.py b/python/ray/import_thread.py index f1da987eb..6a48da62e 100644 --- a/python/ray/import_thread.py +++ b/python/ray/import_thread.py @@ -136,9 +136,13 @@ class ImportThread: ray_constants.DUPLICATE_REMOTE_FUNCTION_THRESHOLD) if key.startswith(b"RemoteFunction"): - with profiling.profile("register_remote_function"): - (self.worker.function_actor_manager. - fetch_and_register_remote_function(key)) + # TODO (Alex): There's a race condition here if the worker is + # shutdown before the function finished registering (because core + # worker's global worker is unset before shutdown and is needed + # for profiling). + # with profiling.profile("register_remote_function"): + (self.worker.function_actor_manager. + fetch_and_register_remote_function(key)) elif key.startswith(b"FunctionsToRun"): with profiling.profile("fetch_and_run_function"): self.fetch_and_execute_function_to_run(key) diff --git a/python/ray/remote_function.py b/python/ray/remote_function.py index 381184c00..6ec9b7e51 100644 --- a/python/ray/remote_function.py +++ b/python/ray/remote_function.py @@ -41,7 +41,7 @@ class RemoteFunction: _num_return_vals: The default number of return values for invocations of this remote function. _max_calls: The number of times a worker can execute this function - before executing. + before exiting. _decorator: An optional decorator that should be applied to the remote function invocation (as opposed to the function execution) before invoking the function. The decorator must return a function that diff --git a/python/ray/tests/test_advanced.py b/python/ray/tests/test_advanced.py index 990e10700..9d4c32899 100644 --- a/python/ray/tests/test_advanced.py +++ b/python/ray/tests/test_advanced.py @@ -202,7 +202,8 @@ def test_profiling_api(ray_start_2_cpus): "ray.wait", "submit_task", "fetch_and_run_function", - "register_remote_function", + # TODO (Alex) :https://github.com/ray-project/ray/pull/9346 + # "register_remote_function", "custom_event", # This is the custom one from ray.profile. ] diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index c61c7236f..d2e0a1d56 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -149,10 +149,6 @@ void CoreWorkerProcess::EnsureInitialized() { CoreWorker &CoreWorkerProcess::GetCoreWorker() { EnsureInitialized(); if (instance_->options_.num_workers == 1) { - // TODO(mehrdadn): Remove this when the bug is resolved. - // Somewhat consistently reproducible via - // python/ray/tests/test_basic.py::test_background_tasks_with_max_calls - // with -c opt on Windows. RAY_CHECK(instance_->global_worker_) << "global_worker_ must not be NULL"; return *instance_->global_worker_; }