Skip to main content

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):

    def priority(self) -> int:
        return 2

class LowPriorityTask(Task):

    def priority(self) -> int:
        return 1

# Note this queue is non-preemptive.
queue = AsyncQueue()

# function_2 will come first.

# cancel pending tasks

# wait for executing task (if any) ends, then stop the queue
await queue.stop()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wcpan.worker, version 4.0.0
Filename, size File type Python version Upload date Hashes
Filename, size wcpan.worker-4.0.0-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size wcpan.worker-4.0.0.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page