-
Notifications
You must be signed in to change notification settings - Fork 253
EDU-4430 python sync vs async #3578
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
Conversation
from temporalio import activity | ||
- Your event loop, which runs tasks from async activities **plus the rest of Temporal, such as communicating with the server**. | ||
- An executor for executing activity tasks from synchronous activities. A thread pool executor is recommended. | ||
- A thread pool executor for executing workflow tasks (see forum post [here](https://community.temporal.io/t/whats-the-workflow-task-executor-in-the-python-worker-configuration/16965)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just port this content into the docs directly? It's best to avoid external links when able, and this content seems relevant to this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. Done 👍
return translation | ||
``` | ||
|
||
### Running synchronous code from an asynchronous function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove this entire section, according to the Python SDK readme, both of those options (run_in_executor
and to_thread
) are disabled in our event loop. https://github.com/temporalio/sdk-python?tab=readme-ov-file#asyncio-and-determinism
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment! Our event loop and that section of the readme apply to the custom event loop in workflows, not activities, so IIUC the custom event loop doesn’t apply here 👍
I see that the section heading could be confusing though so I changed it from “Running synchronous code from an asynchronous function” to “Running synchronous code from an asynchronous activity”
What does this PR do?
Merges this doc into this docs page
Note
When we merge this, we should also merge this.