Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register function race #9346

Merged
merged 6 commits into from
Jul 28, 2020
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
10 changes: 7 additions & 3 deletions python/ray/import_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ def _process_key(self, key):
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)
Expand Down
2 changes: 1 addition & 1 deletion python/ray/remote_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion python/ray/tests/test_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def f():
"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.
]

Expand Down
4 changes: 0 additions & 4 deletions src/ray/core_worker/core_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,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_;
}
Expand Down