Skip to main content

A thread-based worker queue

Project description

workerqueue

A thread-based worker queue

Installation

pip install workerqueue

Usage

from workerqueue import WorkerQueue
from time import sleep

def myfunc(arg1, arg2):
    print(f"{arg1}*2={arg2}")
    sleep(0.5)

myqueue = WorkerQueue(myfunc, thread_count=2)

for i in range(10):
    myargs = i, i*2
    myqueue.put(myargs)

sleep(1)

print("Calling stop()...")
myqueue.stop()

print("Finished processing")

Project details


Download files

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

Source Distribution

workerqueue-0.0.2.tar.gz (1.7 kB view hashes)

Uploaded source

Built Distribution

workerqueue-0.0.2-py3-none-any.whl (2.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page