Skip to main content

pydisque

Client for Disque, an in-memory, distributed job queue.

Build Status

Documentation

Read The Docs

Usage

Create a new Disque client by passing a list of nodes:

from pydisque.client import Client
client = Client(["127.0.0.1:7711", "127.0.0.1:7712", "127.0.0.1:7713"])
client.connect()

If it can't connect to first node, it will try to connect to second, etc.., if it can't connect to any node, it will raise a redis.exceptions.ConnectionError as you can imagine.

Now you can add jobs:

client.add_job("test_queue", json.dumps(["print", "hello", "world", time.time()]), timeout=100)

It will push the job "print" to the queue "test_queue" with a timeout of 100 ms, and return the id of the job if it was received and replicated in time. If it can't reach the node - maybe it was shutdown etc. - it will retry to connect to another node in given node list, and then send the job. If there is no avail nodes in your node list, it will obviously raise a ConnectionError

Then, your workers will do something like this:

while True:
    jobs = client.get_job(['test_queue'])
    for queue_name, job_id, job in jobs:
        job = json.loads(job)
        print ">>> received job:", job
        client.ack_job(job_id)

also check examples directory.

While waiting jobs your connected node may go down, pydisque will try to connect to next node, so you can restart your nodes without taking down your clients.

Documentation

For now please check docstrings in disque/client.py, implemented commands are

  • info
  • add_job
  • get_job
  • ack_job
  • nack_job
  • fast_ack
  • working
  • qlen
  • qstat
  • qpeek
  • qscan
  • jscan
  • enqueue
  • dequeue
  • del_job
  • show
  • pause
  • hello

Installation

You can install it using pip.

$ pip install pydisque

License

This project is licensed under the terms of the MIT license

Credits

Metadata

Release files for pydisque 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydisque 0.1.5
File Size Uploaded Provenance
pydisque-0.1.5.tar.gz 7.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydisque 0.1.5
File Interpreter ABI Platform
pydisque-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / pydisque-0.1.5.tar.gz

Download URL pydisque-0.1.5.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
35517b43afe5d675586956de0f919ad3b82b1be6047319009906bcaafd4b60f9
BLAKE2b-256 checksum
How to use checksums
d0bee9334062fef8ee4d41c0730aab811139bfb94ea83d2774879fa4b9d40774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pydisque-0.1.5-py3-none-any.whl

Download URL pydisque-0.1.5-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d7a9ea8c4d335fb8d217d002683b46b6450b6b4a0c421c39a699090b4f7dbc8
BLAKE2b-256 checksum
How to use checksums
48d6a520a561d7e340a2746e5f20bc7311fecedce941579aea066955f6c14faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for pydisque 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page