Skip to main content

Ranch

Standardized tooling, monitoring, and retry logic for use with Celery. fork of https://github.com/managedbyq/mbq.ranch

Installation

Ranch is a Django application. To use Ranch with Celery, add the following to your settings file:

INSTALLED_APPS = [
    ...
    'csf.ranch'
]

RANCH = {
    'env': ENV_NAME,  # e.g. production, development
    'service': MY_SERVICE_NAME,  # e.g. backend
}

Features

Metrics

Any application with Ranch installed will have Celery metrics available in the Celery/Ranch Datadog Dashboard.

Monitors

You may set up monitors for your application using the metrics provided by Ranch.

Dead Letter Queue

Celery jobs that fail will be stored in the application's database for inspection and reprocessing. Ranch provides an Admin interface for this.

See backends's Ranch Admin for an example.

Correlation IDs

Ranch can flow correlation IDs through your Celery jobs. Ranch will not change any of your logging configuration, so you'll still need to do that as part of your correlation ID implementation.

To use the correlation ID functionality, add the following settings:

RANCH = {
    ...,
    'correlation': {
        'getter': getter_fn,  # callable with no args that returns the current correlation ID
        'setter': setter_fn,  # callable with one arg which should be set as the current correlation ID
    },
}

Supplemental Error Tagging

Ranch provides a hook to add additional tagging information to error item metrics.

To use this feature, add the following settings:

RANCH = {
    ...,
    # tags_fn takes a single arg (the Ranch Task object that failed)
    # and should return a list of strings in the format "tag_name:tag_value"
    'extra_error_queue_tags_fn': tags_fn,
}

Metadata

Release files for csf.ranch 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csf.ranch 1.2.2
File Size Uploaded
csf_ranch-1.2.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csf.ranch 1.2.2
File Interpreter ABI Platform
csf_ranch-1.2.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 24.9 kB

Release files / csf_ranch-1.2.2.tar.gz

Download URL csf_ranch-1.2.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bb71b33eb05d11ef8ed6a85b350decb49cd492411758baf5c2a02692205bb8e2
BLAKE2b-256 checksum
How to use checksums
4028ff9ea6bdc419a85ec42e6e6fd3e9f81e02f3d56f271d6899833a73daa0e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / csf_ranch-1.2.2-py2.py3-none-any.whl

Download URL csf_ranch-1.2.2-py2.py3-none-any.whl
Size 13.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cf8f7de7fbf7239836b2619351090b08476bb5ff092564c46fdd54d4d3427bae
BLAKE2b-256 checksum
How to use checksums
20978ab3a162a2e0d4a397e5dc5611e76fe42d8ea059ae3d25d00a668d343fc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.1.1

2 release files

1.1

2 release files

1.0

2 release files

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