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.0.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.0.tar.gz.
File metadata
- Download URL: wcpan.worker-3.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0022f2f27ec7098376ba5f2a432bdc08993f4445facf670c4acad1dfcb450eff
|
|
| MD5 |
c7ce01f59b627af06d87d1968af7f415
|
|
| BLAKE2b-256 |
6c3fcca3aa17fedd97b60ea9ea2b51ed77a88730657d67f05777be0f7d910be2
|
File details
Details for the file wcpan.worker-3.0.0-py3-none-any.whl.
File metadata
- Download URL: wcpan.worker-3.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
755e421f0e8d808e48f9509261236fbe6196b9ac9803ffb2a8fd489d62abe8a0
|
|
| MD5 |
854fc7ccb2772df9b6be7d8aef6e43e3
|
|
| BLAKE2b-256 |
9efbcbe70ec0aecf0d29c1bf6d1e93b8f932fe950a3537452b91af10e2a6c867
|