Skip to main content

Dramatiq ApScheduler

Allows simple command line usage of ApScheduler to add tasks directly to Dramatiq. It is designed to support multiple concurrent scheduler process such as in the case of Elastic Beanstalk.

You can run multiple process and each one will check if it's the leader before executing any tasks.

Requirements

The application uses rabbitmq and redis.

By default both rabbitmq and redis will just use localhost but on most systems you are running these services on another server. You can configure both redis and rabbitmq by providing the connection urls as options redis_url and rabbitmq or environment variables SCHEDULE_REDIS_URL and SCHEDULE_RABBITMQ.

Config

Below is a minimal example of the config. To add more tasks just simply edit the jobs config option.

jobs:
  trigger_feed_run_every_10_minutes:
    func: run_feeds
    crontab: "*/10 * * * *"
  trigger_test_task:
    func: test_task
    crontab: "*/1 * * * *"
    queue_name: test

Triggers

Currently only one trigger is supported crontab. We recommend you use https://crontab.guru/ to validate your expressions.

Usage

Just run the task to start the process. You can also add the --debug flag to get extra logging.

Usage: dramatiq_apscheduler [OPTIONS] TASK_FILE

Options:
  --debug           Enables debug logging
  --rabbitmq TEXT   rabbitmq connection url: amqp://127.0.0.1:5672/
  --redis_url TEXT  redis connection url: redis://localhost/
  --expire INTEGER  How long the lock should last for
  --help            Show this message and exit.

You can run with the demo config:

dramatiq_apscheduler config.yaml

Development

The easiest way to develop this application is in a venv. You can see more details in the click documentation but if your venv is setup just run the below command.

 pip install --editable .

Dockerfile

A docker image is also provided which allows you to easily run the application anywhere.

docker pull scollins/dramatiq-apscheduler
docker run scollins/dramatiq-apscheduler

Release files for dramatiq-apscheduler 0.2.1

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

Source distribution (sdist)

Source distribution for dramatiq-apscheduler 0.2.1
File Size Uploaded
dramatiq-apscheduler-0.2.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dramatiq-apscheduler 0.2.1
File Interpreter ABI Platform
dramatiq_apscheduler-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / dramatiq-apscheduler-0.2.1.tar.gz

Download URL dramatiq-apscheduler-0.2.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c1bd34263fe2fd6ee3ad9d080a0747c81ce25cb103074278b6d2d526df0fab4c
BLAKE2b-256 checksum
How to use checksums
4371700839cccfee120184d6985fe7b1174cc724c8dd5034df444ad4f7d5ac74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release files / dramatiq_apscheduler-0.2.1-py3-none-any.whl

Download URL dramatiq_apscheduler-0.2.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1559220ebb723c7908343f8ba490b5801fd2dfe68d7bc9112fa1a57b01e8ea6
BLAKE2b-256 checksum
How to use checksums
55f0d64ce6caf22f2002d9a039fad877bfb6510ea0a58530da93218e6c447979
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

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