Skip to main content

An async job scheduler for django using redis/valkey brokers

Project description

Django Tasks Scheduler

Django CI badge badge

Documentation can be found in https://django-tasks-scheduler.readthedocs.io/

Introduction Video

Django Tasks Scheduler Introduction

Watch this introduction video to learn about django-tasks-scheduler and its features.

Usage

  1. Update settings.py to include scheduler configuration:
import os
from typing import Dict
from scheduler.types import SchedulerConfiguration, Broker, QueueConfiguration

INSTALLED_APPS = [
    # ...
    'scheduler',
    # ...
]
SCHEDULER_CONFIG = SchedulerConfiguration(
    EXECUTIONS_IN_PAGE=20,
    SCHEDULER_INTERVAL=10,
    BROKER=Broker.REDIS,
    CALLBACK_TIMEOUT=60,  # Callback timeout in seconds (success/failure/stopped)
    # Default values, can be overridden per task/job
    DEFAULT_SUCCESS_TTL=10 * 60,  # Time To Live (TTL) in seconds to keep successful job results
    DEFAULT_FAILURE_TTL=365 * 24 * 60 * 60,  # Time To Live (TTL) in seconds to keep job failure information
    DEFAULT_JOB_TTL=10 * 60,  # Time To Live (TTL) in seconds to keep job information
    DEFAULT_JOB_TIMEOUT=5 * 60,  # timeout (seconds) for a job
    # General configuration values
    DEFAULT_WORKER_TTL=10 * 60,  # Time To Live (TTL) in seconds to keep worker information after last heartbeat
    DEFAULT_MAINTENANCE_TASK_INTERVAL=10 * 60,  # The interval to run maintenance tasks in seconds. 10 minutes.
    DEFAULT_JOB_MONITORING_INTERVAL=30,  # The interval to monitor jobs in seconds.
    SCHEDULER_FALLBACK_PERIOD_SECS=120,  # Period (secs) to wait before requiring to reacquire locks
)
SCHEDULER_QUEUES: Dict[str, QueueConfiguration] = {
    'default': QueueConfiguration(URL='redis://localhost:6379/0'),
}
  1. Update urls.py to include scheduler urls:
from django.urls import path, include

urlpatterns = [
    # ...
    path('scheduler/', include('scheduler.urls')),
]
  1. Run migrations:
python manage.py migrate
  1. Check out the admin views:

Local development environment

You can install pre-commit hook in the repo to add it as a git hook by running: pre-commit install. It is configured to check all change files based on configuration in .pre-commit-config.yaml.

Sponsor

django-tasks-scheduler is developed for free.

You can support this project by becoming a sponsor using this link.

Contributing

Interested in contributing, providing suggestions, or submitting bugs? See guidelines at this link.

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

django_tasks_scheduler-4.1.0.tar.gz (86.1 kB view details)

Uploaded Source

Built Distribution

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

django_tasks_scheduler-4.1.0-py3-none-any.whl (142.0 kB view details)

Uploaded Python 3

File details

Details for the file django_tasks_scheduler-4.1.0.tar.gz.

File metadata

  • Download URL: django_tasks_scheduler-4.1.0.tar.gz
  • Upload date:
  • Size: 86.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_tasks_scheduler-4.1.0.tar.gz
Algorithm Hash digest
SHA256 6928776ac7817863e81865ce927f81480f8e143d82500902b51661d0bffc78cb
MD5 6e6bf8e122d6aaaebe402eadc75c79b3
BLAKE2b-256 292bfc992b54726eebae0c3031387f6d125dce4fa7e3390f41b03c01017ad602

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_tasks_scheduler-4.1.0.tar.gz:

Publisher: publish.yml on django-commons/django-tasks-scheduler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_tasks_scheduler-4.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_tasks_scheduler-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61160181bd6aa0154097ebbe696641df02efb256ebd92e853f41fa73222fd7c8
MD5 76f71396b50b0c3c7f3807f91a0facf2
BLAKE2b-256 139a36616be751824d5b8a7a4debaec576805e20c18b4f66ad2587803912ff9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_tasks_scheduler-4.1.0-py3-none-any.whl:

Publisher: publish.yml on django-commons/django-tasks-scheduler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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