Skip to main content

Simplified, scalable task scheduling with typechecking.

Project description

beatdrop

The goal of beatdrop is to provide easy to use schedulers and schedule entries that are extensible, scalable, and backend agnostic.

It does not run tasks or python functions on a schedule. It will simply interface with task backends to send tasks when they are due.

Installation

Install the base package with pip

$ pip install beatdrop

For particular schedulers and backends you will also need to install their extra dependencies.

$ pip install beatdrop[redis]

Extra dependencies for task backends:

  • celery

Extra dependencies for scheduler storage:

  • redis

  • sql

The all extra dependency will install all extra dependencies for task backends and scheduler storage.

$ pip install beatdrop[all]

Usage

There are 2 main pieces to using beatdrop.

  • Schedule Entry - Hold the task definition along with scheduling info.

  • Schedulers - These perform 2 main roles.

    • They can be run as a scheduler ie monitor and send tasks to the task backend.
    • Act as clients for reading and writing schedule entries.

Simple example:

from beatdrop import CeleryRedisScheduler, IntervalEntry
from celery import Celery

celery_app = Celery()

# Create a scheduler
sched = CeleryRedisScheduler(
    max_interval=60,
    celery_app=celery_app,
    lock_timeout=180,
    redis_py_kwargs={
        "host": "my.redis.host",
        "port": 6379,
        "db": 0,
        "password": "mys3cr3t"
    }
)
# create a schedule entry
inter = IntervalEntry(
    key="my-interval-entry",
    enabled=True,
    task="test_task",
    args=("my_args", 123),
    kwargs={
        "my_kwargs": 12.4
    },
    period=10
)

# save or update an entry 
sched.save(inter)
# list all entries, this will automatically paginate
schedule_entries = sched.list()
# retrieve a specific entry
my_inter_entry = sched.get(inter.key)
# equivalent to the line above
my_inter_entry = sched.get("my-interval-entry")
# Delete an entry from the scheduler
sched.delete(inter)

Development

After cloning the repo, install in development mode with the dev and all extra dependencies from local clone:

$ pip install -e .[dev,all]

Run tests

$ pytest -vvv --cov=beatdrop --cov-report html tests/unit

Changelog

Changelog for beatdrop. All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.1.0a2] - 2023-01-17

Update for pypi formatting.

[0.1.0a1] - 2023-01-17

Initial release

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

beatdrop-0.1.0a3.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

beatdrop-0.1.0a3-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file beatdrop-0.1.0a3.tar.gz.

File metadata

  • Download URL: beatdrop-0.1.0a3.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for beatdrop-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 f88cef8854123d764bd26347629437d00e0298febe47d93179b642a4d0fbd096
MD5 9d33e0d19c339895c8d3ddfe141c7c84
BLAKE2b-256 1f938f4d44da8af5fec70c26a147c7aa122f026b4cfd275f3ab72588e13bf71b

See more details on using hashes here.

File details

Details for the file beatdrop-0.1.0a3-py3-none-any.whl.

File metadata

  • Download URL: beatdrop-0.1.0a3-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for beatdrop-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ced8a1735fcf2c12702d36493df5fe24eea78c16452a8c9384225898eea7ca6
MD5 c9a372e7f9563e2862228ead9af5f3de
BLAKE2b-256 db12c3cd3b4a6ecf8e6b7f4c67e78eeae3540bd5653ed5d5aafec3e663854d0b

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