Full example of Python sync worker

I think I have found the answer from Temporal with synchronous python services

Basically, your worker will still start in async mode and the workflows will still be running in async manner. However, you can run the sync activities by providing a threadpool when you create the worker. Ex Temporal with synchronous python services

    async with Worker(
        client,
        task_queue=<queue name>,
        workflows=<list of workflows>,
        activities=<list of activities>,
        activity_executor=ThreadPoolExecutor(5),
    ):

Then you can write all your activities without async keyword (aka running them in synchronously).

2 Likes