Jack P
04/26/2024, 8:44 PMMarvin
04/26/2024, 8:45 PMConcurrentTaskRunner
instead of synchronous functions offers several benefits:
1. Concurrency: ConcurrentTaskRunner
can run tasks concurrently, allowing tasks to switch when blocking on I/O, which is common in asynchronous functions. Concurrency enables a system to do more than one thing simultaneously, but not necessarily at the same time, meaning execution of one task does not block the execution of other tasks in a flow.
2. Efficiency: Asynchronous functions are generally more efficient in I/O-bound and high-level structured network code.
3. Non-blocking Execution: In computing, concurrency refers to non-blocking execution within the restrictions of resources available and data dependencies between tasks.
Choosing between synchronous and asynchronous functions depends on the type of tasks you are running within your flow. If your tasks are primarily I/O-bound and you wish to make efficient use of system resources by overlapping I/O with computation, asynchronous functions with ConcurrentTaskRunner
would be a good choice.
For more in-depth information, you can refer to these sources:
- ConcurrentTaskRunner and concurrency vs parallelism
- Second-generation workflow engine featuring "code as workflows"
Using these concepts can vastly improve the developer experience and the performance of your workflows.Kevin Grismore
04/26/2024, 8:51 PMawait
a coroutine, it's gonna have to be async def
Jack P
04/26/2024, 9:55 PMKevin Grismore
04/26/2024, 9:56 PMJack P
04/26/2024, 9:57 PM