I'd like to use Temporal with their Python SDK and use an R package that makes API calls.
The Temporal course talks about "async safe libraries" below and I was wondering if httr2 is like Python's request, or if it's async safe?
Blocking the async event loop in Python would turn your asynchronous program into a synchronous program that executes serially, defeating the entire purpose of using
asyncio
. This can also lead to potential deadlock, and unpredictable behavior that causes tasks to be unable to execute. Debugging these issues can be difficult and time consuming, as locating the source of the blocking call might not always be immediately obvious.
Due to this, Python developers must be extra careful to not make blocking calls from within an asynchronous Activity, or use an async safe library to perform these actions.
For example, making an HTTP call with the popular
requests
library within an asychronous Activity would lead to blocking your event loop. If you want to make an HTTP call from within an asynchronous Activity, you should use an async-safe HTTP library such asaiohttp
orhttpx
. Otherwise, use a synchronous Activity.