EDU-4430 python sync vs async#3578
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.
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.
| return translation | ||
| ``` | ||
|
|
||
| ### Running synchronous code from an asynchronous function |
There was a problem hiding this comment.
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.
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.