Skip to main content

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 sdist
  • twine 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)

Source distribution for firestoreMQ 1.0.4
File Size Uploaded Provenance Actions
firestoreMQ-1.0.4.tar.gz 3.7 kB Without provenance Details for firestoreMQ-1.0.4.tar.gz

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

Security for firestoreMQ 1.0.4

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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