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

[core][adag] Fix for asyncio outputs #46845

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

stephanie-wang
Copy link
Contributor

@stephanie-wang stephanie-wang commented Jul 29, 2024

Why are these changes needed?

When asyncio interface is used, we do not need to call get on the underlying objects because this is already done by a background thread. Therefore, when a CompiledDAGFuture goes out of scope, we should just let the underlying future go out of scope instead of trying to call get like we do for CompiledDAGRefs.

When testing locally, I found that without these changes, the program would produce errors when a CompiledDAGFuture went out of scope because it tried to call CompiledDAGRef.del. I'm not sure why these don't appear when running the existing tests though.

Closes #46766.

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
Copy link
Contributor

@ruisearch42 ruisearch42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This fixes #46766 .

@rkooo567
Copy link
Contributor

what was the error message? I am curious if it is the same error I've seen while I developed

Copy link
Contributor

@rkooo567 rkooo567 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM> QQ: what was the reason why we inherited CompiledDAGRef originally?

@@ -1431,7 +1431,9 @@ async def execute_async(
fut = asyncio.Future()
await self._fut_queue.put(fut)

return CompiledDAGFuture(self, self._execution_index, fut)
fut = CompiledDAGFuture(self, self._execution_index, fut)
self._execution_index += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it related to this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a fix for UX - the execution index here is only used for the __str__ representation of the future, but it always said execution_index=0 before :)

@stephanie-wang
Copy link
Contributor Author

what was the error message? I am curious if it is the same error I've seen while I developed

Ah yeah the error message was this:

Exception ignored in: <function CompiledDAGRef.__del__ at 0x7fbcfb452790>
Traceback (most recent call last):
  File "/home/swang/ray/python/ray/experimental/compiled_dag_ref.py", line 77, in __del__
    if not self._ray_get_called:
AttributeError: 'CompiledDAGFuture' object has no attribute '_ray_get_called'

@stephanie-wang stephanie-wang enabled auto-merge (squash) July 30, 2024 17:00
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jul 30, 2024
@stephanie-wang stephanie-wang merged commit 5dba14a into ray-project:master Jul 30, 2024
6 checks passed
@stephanie-wang stephanie-wang deleted the adag-asyncio-fix branch July 30, 2024 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ADAG] CompiledDAGFuture does not go out of scope cleanly
3 participants