You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Severity of the issue: (select one)
[x] Medium: Significantly affects my productivity but can find a workaround.
2. Environment:
Ray version: 2.42.0
Python version: 3.9.21
OS: Ubuntu 22.04
Cloud/Infrastructure: N/A
Other libs/tools (if relevant): N/A
3. What happened vs. what you expected:
Expected: All remote functions in the official Ray tasks tutorial should execute successfully when submitted as a Ray job
Actual: Only functions with explicit ray.get() calls complete successfully; tasks without ray.get() fail in the dashboard
Problem Description
I'm following the official Ray tutorial for remote functions (https://docs.ray.io/en/releases-2.42.0/ray-core/tasks.html), but the example doesn't work as expected when submitted as a Ray job. The dashboard shows that my_function runs successfully, but all four slow_function tasks fail. (Error Type: WORKER_DIED
Job finishes (1d000000) as driver exits. Marking all non-terminal tasks as failed.)
Here's the tutorial code I'm running:
importrayimporttime# A regular Python function.defnormal_function():
return1# By adding the `@ray.remote` decorator, a regular Python function# becomes a Ray remote function.@ray.remotedefmy_function():
return1# To invoke this remote function, use the `remote` method.# This will immediately return an object ref (a future) and then create# a task that will be executed on a worker process.obj_ref=my_function.remote()
# The result can be retrieved with ``ray.get``.assertray.get(obj_ref) ==1@ray.remotedefslow_function():
time.sleep(10)
return1# Ray tasks are executed in parallel.# All computation is performed in the background, driven by Ray's internal event loop.for_inrange(4):
# This doesn't block.slow_function.remote()
Important observation: Only when I modify the code to use ray.get() to collect the results from the slow functions does the dashboard show all tasks running successfully:
# Modified version that worksrefs= [slow_function.remote() for_inrange(4)]
ray.get(refs) # Wait for all tasks to complete
I believe this is confusing for new users following the tutorial. The example code suggests these remote tasks will run in the background, but they're failing silently when the program exits before they complete.
Questions
Is this the expected behavior?
Is there a way to ensure background tasks complete without explicitly calling ray.get()?
Thank you for your help!
Link
No response
The text was updated successfully, but these errors were encountered:
jankinf
added
docs
An issue or change related to documentation
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Mar 10, 2025
Description
Issue with Ray Remote Functions Tutorial Example
1. Severity of the issue: (select one)
[x] Medium: Significantly affects my productivity but can find a workaround.
2. Environment:
3. What happened vs. what you expected:
ray.get()
calls complete successfully; tasks withoutray.get()
fail in the dashboardProblem Description
I'm following the official Ray tutorial for remote functions (https://docs.ray.io/en/releases-2.42.0/ray-core/tasks.html), but the example doesn't work as expected when submitted as a Ray job. The dashboard shows that
my_function
runs successfully, but all fourslow_function
tasks fail. (Error Type: WORKER_DIEDJob finishes (1d000000) as driver exits. Marking all non-terminal tasks as failed.)
Here's the tutorial code I'm running:
I'm running it with:
Important observation: Only when I modify the code to use
ray.get()
to collect the results from the slow functions does the dashboard show all tasks running successfully:I believe this is confusing for new users following the tutorial. The example code suggests these remote tasks will run in the background, but they're failing silently when the program exits before they complete.
Questions
ray.get()
?Thank you for your help!
Link
No response
The text was updated successfully, but these errors were encountered: