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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a05bbea7eee0da29552654f9adc5df839172f3163a88ad64ecf33d44c9d2a45d
|
|
| MD5 |
d6bb997321bca6e1f9ca16c536e8ed27
|
|
| BLAKE2b-256 |
2840fa8314125aff337d1ac06f06b67fc0a5c03ae954dfe2e9debe757abcb60e
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90b5dba1eeaa9d26eaa79d924475150733a083c5b865788be38efc823499abe8
|
|
| MD5 |
cc57547f59ddcd3088e80508f718c296
|
|
| BLAKE2b-256 |
0d1ec5050fa486277743e0d2ffe37e74ae866b922a670ce1611baf06b86e4d29
|