Skip to main content

Simplified, scalable task scheduling with typechecking.

Project description

beatdrop

See the full Documentation.

The goal of beatdrop is to provide schedulers and schedule entries that are easy to use, 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 from PyPi.

$ 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 - holds the task definitions and scheduling info.

  • Schedulers - have 2 main roles

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

To run the scheduler simply make a python file, create the scheduler and call the run method:

from beatdrop import CeleryRedisScheduler

from my_app import celery_app


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"
    }
)
sched.run()

To use the scheduler as a client, you create the scheduler the same as you would to run it:

from beatdrop import CeleryRedisScheduler, IntervalEntry

from my_app import celery_app


# 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)

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.0a5] - 2023-02-06

Fixed

  • packaging files
  • README Links

[0.1.0a4] - 2023-02-05

Fixed

Docstrings updated and documentation added.

[0.1.0a3] - 2023-01-18

Update for pypi formatting.

[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.0a6.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

beatdrop-0.1.0a6-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for beatdrop-0.1.0a6.tar.gz
Algorithm Hash digest
SHA256 d5c928451be739afc4a2114205c7c3d23164335a5721e9f8a8ddd59c87a8f588
MD5 9449d92eb48b0067fa9751b70cdbf9fa
BLAKE2b-256 0d4dbf1bf3f4189c360f552414cda370e784814839494fb1c233aa05c1d44d8f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for beatdrop-0.1.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 3d1a109b8fc0baeb15553ebe48bbe5f7337abfbcd8ad0b257c98a006aa08ee46
MD5 3e9d599ef63a9d80214ca4e508be00c5
BLAKE2b-256 abdddd28be0a766023746a4eaf89de6d5da1f2a90f2f828d08d89d1fb48eb793

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