-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[streaming] Current task being changed during async iteration #37147
Comments
@edoakes I think refactoring requires some amount of work. I am working on prototyping to check how difficult it is. Besides, do you think it is too hacky if I just set the same task name for the all tasks created by the generator? It seems like I can get the name of the task using task.get_name() and set it using |
Hmm ^ approach doesn't seem to work with 3.7... |
I don't think setting task name alone is sufficient, user/library code maybe be relying on the full |
…new task name #37713 (#37972) This PR fixes #37147 by dispatching the whole generator task into an event loop (instead of dispatching individual anext). The PR could have a slight performance impact because the task output serialization code is inside the event loop unlike before (the approach to avoid this was tried in this PR #37713, but it is too hacky). Putting the whole generator task into an event loop instead of dispatching individual anext. This means some of core APIs are called inside an event loop. Had to remove the usage of worker_context because it is not working well when it is called inside a different thread (event loop thread). Instead we pass necessary argument
…new task name ray-project#37713 (ray-project#37972) This PR fixes ray-project#37147 by dispatching the whole generator task into an event loop (instead of dispatching individual anext). The PR could have a slight performance impact because the task output serialization code is inside the event loop unlike before (the approach to avoid this was tried in this PR ray-project#37713, but it is too hacky). Putting the whole generator task into an event loop instead of dispatching individual anext. This means some of core APIs are called inside an event loop. Had to remove the usage of worker_context because it is not working well when it is called inside a different thread (event loop thread). Instead we pass necessary argument Signed-off-by: NripeshN <[email protected]>
…new task name ray-project#37713 (ray-project#37972) This PR fixes ray-project#37147 by dispatching the whole generator task into an event loop (instead of dispatching individual anext). The PR could have a slight performance impact because the task output serialization code is inside the event loop unlike before (the approach to avoid this was tried in this PR ray-project#37713, but it is too hacky). Putting the whole generator task into an event loop instead of dispatching individual anext. This means some of core APIs are called inside an event loop. Had to remove the usage of worker_context because it is not working well when it is called inside a different thread (event loop thread). Instead we pass necessary argument Signed-off-by: e428265 <[email protected]>
…new task name ray-project#37713 (ray-project#37972) This PR fixes ray-project#37147 by dispatching the whole generator task into an event loop (instead of dispatching individual anext). The PR could have a slight performance impact because the task output serialization code is inside the event loop unlike before (the approach to avoid this was tried in this PR ray-project#37713, but it is too hacky). Putting the whole generator task into an event loop instead of dispatching individual anext. This means some of core APIs are called inside an event loop. Had to remove the usage of worker_context because it is not working well when it is called inside a different thread (event loop thread). Instead we pass necessary argument Signed-off-by: Victor <[email protected]>
After each
yield
of an async iterator, the task running the user code seems to change. This breaks user code and libraries (it was discovered because it causes an exception when trying to release a lock that uses the current task as an ID).Repro:
Output:
In comparison, vanilla
asyncio
:The text was updated successfully, but these errors were encountered: