async-task-queue
In-memory FIFO queue for concurrent task execution. Used to execute tasks concurrently with optional control (via semaphore) over the max number of tasks running at the same time.
Features:
- Queue processing summary logging
- Introspection of failed, retried, and succeeded tasks
- Task retries (optional)
- Task execution timeout (optional)
- Queue processing with semaphore (optional)
- Batch size control (optional)
TOC:
Installation
async-task-queue requires Python 3.6 or above.
pip install async-task-queue
Guide
import logging
from async_task_queue import AsyncTask, AsyncTaskQueue
# Initialize a logger
logger = logging.getLogger("foo")
# Initialize an AsyncTaskQueue where:
# - At most 5 tasks are running concurrently
# - Number of tasks executing concurrently should be limited by a semaphore
# - Failed tasks should be retried (default behavior)
# - Executing the tasks queued should timeout and be cancelled after 5 minutes
task_queue = AsyncTaskQueue(
logger,
use_semaphore=True,
batch_size=5,
execution_timeout=300
)
# Add async tasks to the queue
task_queue.enqueue(
[
AsyncTask(some_coroutine, *args, **kwargs) for args, kwargs in some_args_kwargs
]
)
# Start processing the queue
await task_queue.execute()
Development
To develop async-task-queue, install dependencies and enable the pre-commit hook:
pip install pre-commit tox
pre-commit install
To run tests:
tox
Metadata
Release files for async-task-queue 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| async-task-queue-0.1.2.tar.gz | 8.8 kB | Without provenance | Details for async-task-queue-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| async_task_queue-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for async_task_queue-0.1.2-py3-none-any.whl |
Total release size: 16.7 kB
Release files / async-task-queue-0.1.2.tar.gz
| Download URL | async-task-queue-0.1.2.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c820e4e50028efab651c2b714e03e34920593f5cae662a120d9e8def029e200
|
|
BLAKE2b-256 checksum How to use checksums |
f783b419adb62ed208a6cf48f9c4a200e331549746b6fc4cc0831a1059aac145
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.23.0
|
Release files / async_task_queue-0.1.2-py3-none-any.whl
| Download URL | async_task_queue-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6245a869bef4ae7fbc2db8b46cb8d854eea4feb69fe0f6405e90fcfc64a96282
|
|
BLAKE2b-256 checksum How to use checksums |
9364f86b640d834083378907ab5cb3f98da6ea9c555f4fc7d6ceff594fe5d321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.23.0
|
Security for async-task-queue 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.