Skip to main content

FastAPI Queue

Project description

FastAPI queue

How to use

  1. Instance the class Queue with redis instance and options
# queue_config.py

from fastapi_queue_task import Queue
from redis.asyncio.utils import from_url

redis = from_url(
    f"redis://#REDIS_HOST:#REDIS_PORT/#REDIS_DATABASE_NAME",
    encoding="utf-8",
    decode_responses=True,
)
queue = Queue(redis, options={'concurrency': 10, 'max_attempt': 3})
queue.run()
  1. Add task to queue:
# mail_service.py
await queue.add_to_queue(name="TASK_NAME", data: Any = {})

How to test in testpypi

  1. Increase the version in pyproject.toml
  2. Run command
$ . ./build_and_test.sh

How to publish new version

  1. Increase the version in pyproject.toml
  2. Run command
$ . ./build_and_publish.sh

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

fastapi_queue_task-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

fastapi_queue_task-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_queue_task-1.0.0.tar.gz.

File metadata

  • Download URL: fastapi_queue_task-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for fastapi_queue_task-1.0.0.tar.gz
Algorithm Hash digest
SHA256 41745d001012f23dc8dbc1a256261f2111b4a275d7875f52badfe2aa1f4b09f8
MD5 ca39a3c87816f3b3e15c4feef103d247
BLAKE2b-256 126c3a4a8a7662663ba421608af3d70062039d692106405041e574ff9e873710

See more details on using hashes here.

File details

Details for the file fastapi_queue_task-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_queue_task-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ecad808bed53cf78a130414801052b8d1c96521b37f956c12c68023bdc0775f
MD5 c137a55ac184eaf17624fdfd1704414d
BLAKE2b-256 c4154b81365240a0f7d5b2ac60dc3ae4773196386cce31184f097f24f33bbb2b

See more details on using hashes here.

Supported by

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