An asynchronous task queue with priority support.
Project description
wcpan.worker
An asynchronous task queue with priority support.
from wcpan.worker import AsyncQueue, Task
class HighPriorityTask(Task):
@property
def priority(self) -> int:
return 2
class LowPriorityTask(Task):
@property
def priority(self) -> int:
return 1
# Note this queue is non-preemptive.
queue = AsyncQueue()
queue.start()
# function_2 will come first.
queue.post(LowPriorityTask(function_1))
queue.post(HighPriorityTask(function_2))
# cancel pending tasks
queue.flush()
# wait for executing task (if any) ends, then stop the queue
await queue.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wcpan_worker-6.1.0.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wcpan_worker-6.1.0.tar.gz.
File metadata
- Download URL: wcpan_worker-6.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.9.2 Linux/5.15.90.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e53f2ca698b79c8fe31366ad0b01f73c5f623a2cd282aa7e2fc7095566d515d
|
|
| MD5 |
3265d8212b45559148f7397c99f9ed11
|
|
| BLAKE2b-256 |
38b9eac87bb31ec6b567613637b879ade6790a1326e4b08165ca860cf53e1b2c
|
File details
Details for the file wcpan_worker-6.1.0-py3-none-any.whl.
File metadata
- Download URL: wcpan_worker-6.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.9.2 Linux/5.15.90.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1929681edce1013b6c5002b49aa53072987a8b732baf7b74c6d6ab623dcb8000
|
|
| MD5 |
3759ae5f3c1dbad646229578711b346d
|
|
| BLAKE2b-256 |
aa702594218b8f73c256a5683549bbd0c17fa898b9c385519d5171ef7ac136f2
|