Skip to main content

Python client for the EntroQ task queue.

Project description

EntroQ (Python client)

Python client for EntroQ, a fault-tolerant, competing-consumer task queue with exactly-once semantics and an atomic Modify operation over tasks and a companion key/value doc store.

This package provides an async client and a small worker framework. It speaks to EntroQ two ways:

  • EntroQJSON — talks to a Go EntroQ server over its HTTP/Connect API. Use this when a server is already running (eqpg/eqmem/eqredis serve).

  • EntroQ (in entroq.experimental.pg) — talks directly to PostgreSQL, no Go server in the path. It uses the same stored procedures the Go eqpg backend does, and bundles the canonical schema so a pip-only environment can initialize a database without a Go toolchain. Requires the pg extra.

    Experimental. Anything under entroq.experimental has no stability guarantee and may change or be removed in any release, including patches. The stable, supported path is EntroQJSON against a Go server. Pin an exact version if you depend on the direct client.

Install

pip install entroq            # client + worker (JSON/HTTP)
pip install "entroq[pg]"      # adds the direct-PostgreSQL backend (psycopg 3)

Quick start

A worker claims tasks from one or more queues and dispatches them to a handler:

import asyncio
from entroq import EntroQWorker, Modification
from entroq.json import EntroQJSON

eq = EntroQJSON("http://localhost:8080")

@EntroQWorker.handler
async def process(task, docs):
    # ... do the work ...
    return Modification(Modification.deleting(task))   # ack by deleting

asyncio.run(EntroQWorker(eq, "my-queue").run(process))

Talking straight to PostgreSQL instead of a server (experimental, see above):

from entroq.experimental.pg import EntroQ

eq = EntroQ("host=localhost dbname=entroq user=entroq password=secret")

A worker backed by the direct-PostgreSQL client also carries EntroQ's built-in, always-on garbage collection for /gc=-marked queues on the backend's behalf; a worker talking to a Go server does not, since the server collects for itself.

Documentation

See the main repository for the concepts (tasks, claims, the atomic Modify, the doc store, and the /gc= naming convention) and the server/backends the Go side provides.

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

entroq-0.12.2.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

entroq-0.12.2-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file entroq-0.12.2.tar.gz.

File metadata

  • Download URL: entroq-0.12.2.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for entroq-0.12.2.tar.gz
Algorithm Hash digest
SHA256 1b016ca64210903b05c799138984054742e70b99c10b3cc771f901d9b977bcb6
MD5 fc9a8c254c4a67a0513306c448137b21
BLAKE2b-256 c6cdd35dc5a3a3bba1e967231a90f2c331e41f16f8c726d35e501c9e8e2ed5f1

See more details on using hashes here.

File details

Details for the file entroq-0.12.2-py3-none-any.whl.

File metadata

  • Download URL: entroq-0.12.2-py3-none-any.whl
  • Upload date:
  • Size: 37.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for entroq-0.12.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31c9206968388619aa3a9210197d36ffbe26b69eecca4f9aa7ecb214392f65a8
MD5 42e9c7bfa3438e23d006edab1621a21a
BLAKE2b-256 2f1955b710b1ddd5f336f910481f36d8116b503149595bc6240f86fad8e7f109

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page