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-4.1.2.tar.gz
(3.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-4.1.2.tar.gz.
File metadata
- Download URL: wcpan.worker-4.1.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4f7a5d05302713335497084166ac4554d3c5a51234cebc170c04f6a8717254
|
|
| MD5 |
639a5296ef3b4279700eb55f4c5666db
|
|
| BLAKE2b-256 |
b4bf97b53c2cdcf8df034c11809f59c17383e572d6f0fa5a5924e70f6ab54a52
|
File details
Details for the file wcpan.worker-4.1.2-py3-none-any.whl.
File metadata
- Download URL: wcpan.worker-4.1.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5180ade515c64f4499c90a93b6dc470374b49ec0cab5fd60009187e04839a1ef
|
|
| MD5 |
59adfeda2a1a8098034bbd6fc42ac324
|
|
| BLAKE2b-256 |
866fc7a06a0a6ea13126bf8abb19ed22473589f97d4bf99b7a83565c061186a1
|