Skip to main content

Celery integration for Vercel Queue and Runtime Cache

Project description

vercel-celery

Celery integration for Vercel Queue Service and Vercel Runtime Cache.

This package provides a Celery broker transport backed by Vercel Queue Service and a Celery result backend backed by Vercel Runtime Cache.

from vercel.integrations.celery import install_vercel_celery_integration

install_vercel_celery_integration()

By default, named Celery apps publish to app-prefixed Vercel Queue topics. For example, Celery("my_app") maps Celery queue emails to the Vercel Queue topic celery-my__app-emails after Vercel Queue name sanitization. Apps with no name use unprefixed topics. To override this, set broker_transport_options = {"queue_name_prefix": "jobs-"}. Set queue_name_prefix to "" to use Celery queue names as Vercel Queue topics.

The broker's Vercel Queue consumer group defaults to celery. Workers sharing the same Vercel Queue topic and consumer group compete for tasks. Workers using the same topic with different consumer groups receive fan-out copies. To override it, set broker_transport_options = {"consumer_group": "workers"}.

The installer sets Celery's default broker_url to vercel:// when Celery has no broker default configured. Pass set_default_broker=False to opt out. It also sets Celery's default result_backend to vercel-runtime-cache:// when Celery has no result backend configured. Pass set_default_result_backend=False to opt out.

vercel:// uses push delivery when VERCEL is truthy in the environment and poll delivery otherwise. Set broker_url = "vercel-push://" to force push delivery, or broker_url = "vercel-poll://" for forced polling workers, local workers, and background workers.

Pass register_queues=False to skip automatic Vercel Queue trigger registration. When using that mode, manually register each Celery app whose queues should receive Vercel Queue push deliveries:

from vercel.integrations.celery import register_celery_app_queues

register_celery_app_queues(app)

To customize Celery task result storage in Vercel Runtime Cache, configure Celery's result backend transport options:

result_backend_transport_options = {
    "namespace": "celery-results",
    "ttl": 3600,
}

By default, named Celery apps use an app-scoped Runtime Cache namespace. For example, Celery("my_app") stores results under celery-results-my_app. Apps with no name use celery-results. If producers and workers use different Celery app names, configure a shared explicit namespace.

The Runtime Cache backend uses vercel.cache, including its normal key hashing, namespacing, and local in-memory fallback when Runtime Cache is unavailable. Celery result backends are not required to retain results indefinitely; results may expire according to Celery's result expiration settings or the backend's own retention behavior. This backend is therefore an expiring, cache-backed result backend rather than durable result storage. Celery treats missing result entries as pending results. By default, stored results use Celery's result_expires value as their Runtime Cache TTL; set result_backend_transport_options["ttl"] to override that retention period.

JSON result serialization works normally. Binary serializers, including pickle, are stored through an internal base64 wrapper so Runtime Cache only receives JSON-compatible values.

Runtime Cache is a single-key cache API, so this backend does not provide native bulk result fetches or increment-backed chord counters. Result availability is limited by Runtime Cache retention and eviction behavior.

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

vercel_celery-0.7.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

vercel_celery-0.7.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file vercel_celery-0.7.0.tar.gz.

File metadata

  • Download URL: vercel_celery-0.7.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vercel_celery-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6d62196c757e38581e25857d9626b616dfd13902b58e9909e3f972b5c3fd2ff6
MD5 4babdd089b75f622183d39f986b8ea8b
BLAKE2b-256 ba1528c3e6f67ef00918d791715ec0808e2e3048049158e07866f7811eb9f6b4

See more details on using hashes here.

File details

Details for the file vercel_celery-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: vercel_celery-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vercel_celery-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47aae6acc71d1580726a79c14865bd25edf69928a6fd54f2c94f869b3b615375
MD5 e2a30cb7e51d5319f2da7afa31ab7231
BLAKE2b-256 18cac3b02230a696251b58db1667223b5ca4a1b44c425972b3f5d8d40ec00b3f

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