-
Notifications
You must be signed in to change notification settings - Fork 56
Add Asynchronous External Task Client and Worker #107
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
Add Asynchronous External Task Client and Worker #107
Conversation
Great contribution @kobiche Thank you. |
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.
@kobiche
Can you please update the version number in the setup.cfg file?
version = 4.4.0 |
I can then release next version in pypi with new version number.
@kobiche |
seems like building with python 3.7 is not possible. Should I remove it? I mean, even python 3.8 is already outdated: https://devguide.python.org/versions/ |
@kobiche |
@kobiche
|
… the exception. - Replaced `assertTrue` with `assertIn` for more precise error message validation.
Seems like there were some differences between Python versions (I tested with 3.11) in how the exception messages were parsed in the assertion. I fixed them. |
Description
Summary
This Pull Request introduces a fully asynchronous variant of the external task client and worker. It provides the same core functionality as the existing synchronous modules, but leverages
asyncio
andhttpx.AsyncClient
to enable non-blocking I/O and concurrent task handling.What’s New
Async External Task Client (
async_external_task_client.py
):fetch_and_lock
,complete
,failure
, etc.).Async External Task Executor (
async_external_task_executor.py
):external_task_executor.py
, but usesawait
and returns coroutines.Async External Task Worker (
async_external_task_worker.py
):stop()
that cancels running jobs and fetch loops.Tests:
test_async_external_task_executor.py
andtest_async_external_task_worker.py
) usingunittest.IsolatedAsyncioTestCase
.Why This Is Needed
How It Works
AsyncExternalTaskClient
orAsyncExternalTaskWorker
.async def handle_task(task)
) which can do I/O without blocking the rest of the system.asyncio.Semaphore
).Backwards Compatibility