Skip to main content

Python SDK for Queueflow distributed task queue

Project description

QueueFlow SDK

Python SDK for the QueueFlow distributed task queue.

Installation

pip install queueflow-sdk

Quick Start

from queueflow_sdk import QueueFlowClient

# Create a tenant and get an API key
tenant = QueueFlowClient.create_tenant("https://your-server.com", "Company Name")
key = QueueFlowClient.create_api_key("https://your-server.com", tenant.id)

# Initialize the client
qf = QueueFlowClient("https://your-server.com", key.key)

# Submit a task
task = qf.submit("send_email", payload = {
    "to": "user@example.com",
    "subject": "Hello from QueueFlow",
})

# Wait for completion
result = qf.wait_for(task.id)
print(result.status) # "completed"
print(result.max_results) # {"sent_to": "user@example.com", ...}

# Always close when done
qf.close()

Context Manager

with QueueFlowClient("https://your-server.com", "your-api-key") as qf:
    task = qf.submit("process_image", payload = {
        "image_url": "https://example.com/photo.jpg",
        "width": 400,
        "height": 300,
    })
    result = qf.wait_for(task.id)

Error Handling

from queueflow_sdk import QueueFlowClient, ConflictError, NotFoundError

qf = QueueFlowClient("https://your-server.com", "your-api-key")

try:
    qf.cancel("nonexistent-task-id")
except NotFoundError:
    print("Task not found")
except ConflictError:
    print("Task already completed")

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

queueflow_sdk-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

queueflow_sdk-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file queueflow_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: queueflow_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for queueflow_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a05bbea7eee0da29552654f9adc5df839172f3163a88ad64ecf33d44c9d2a45d
MD5 d6bb997321bca6e1f9ca16c536e8ed27
BLAKE2b-256 2840fa8314125aff337d1ac06f06b67fc0a5c03ae954dfe2e9debe757abcb60e

See more details on using hashes here.

File details

Details for the file queueflow_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: queueflow_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for queueflow_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90b5dba1eeaa9d26eaa79d924475150733a083c5b865788be38efc823499abe8
MD5 cc57547f59ddcd3088e80508f718c296
BLAKE2b-256 0d1ec5050fa486277743e0d2ffe37e74ae866b922a670ce1611baf06b86e4d29

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