An asynchronous task queue with priority support.
Project description
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-3.0.1.tar.gz
(3.0 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-3.0.1.tar.gz.
File metadata
- Download URL: wcpan.worker-3.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ba5a395d5ade816ed535c499d9c71b9944f4098c710db9f70109a4ab9f1dcd0
|
|
| MD5 |
235ab7b3819d04400a00edf8d8a48727
|
|
| BLAKE2b-256 |
e9e77974f9f48d880b979690f35a350e841bf578ace1f3de5d6b11a12f521de0
|
File details
Details for the file wcpan.worker-3.0.1-py3-none-any.whl.
File metadata
- Download URL: wcpan.worker-3.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86a373df35ffda7c2a41e71d9ecc3976530cf7bdd84757146725c366c7e87433
|
|
| MD5 |
926abf8ef687400c5171496839b939be
|
|
| BLAKE2b-256 |
c79f4a3b048e3b3265f5a064492de90d8b47301ca34554aef70b0c6bff1f9209
|