Firestore MQ Python Libary
Install
python3 setup.py install
OR
pip3 install firestoreMQ
Note that watching the queue requires an index, please run examples/worker.py to create the index
Examples
See examples/ for example scripts
Add a new task
import firestoreMQ
from firebase_admin import firestore
db = firestore.client() # TODO requires project initalisation
queue = "process_images"
data = {
"image_path": "/path/to/images.png"
}
ttl = 3600 # seconds (optional)
priority = 0 # Higher priroty is higher number (optional)
task = firestoreMQ.Task(queue, data, ttl=ttl, priority=priority)
task.create(db)
Process tasks
import firestoreMQ
import time
from firebase_admin import firestore
db = firestore.client() # TODO requires project initalisation
worker_id = "worker_1" # Unique worker ID (NOTE one per worker instance)
queue = "process_images"
while True:
task = firestoreMQ.next_task(db, queue, worker_id) # Blocking call for next task
if 'image_path' in task.data:
print(task.data['image_path'])
time.sleep(1)
task.complete(db)
else:
print('[Task %s] Invalid task data - No "image_path"' % task.id)
task.error(db)
Release
- Bump version number
python3 setup.py sdisttwine upload dist/firestoreMQ-<VERSION>.tar.gz
Metadata
Release files for firestoreMQ 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firestoreMQ-1.0.4.tar.gz | 3.7 kB | Details |
Release files / firestoreMQ-1.0.4.tar.gz
| Download URL | firestoreMQ-1.0.4.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
727cfa944188a546545177ecc735885b37ab2df3715b663996330dfcfe5dcffa
|
|
BLAKE2b-256 checksum How to use checksums |
bbb32725d724b5994e21331a2f7d5c3a5be411922405692e586af1ba25cd0815
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4
|