No project description provided
Project description
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
and rabbitmq
or environment variables SCHEDULE_REDIS
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] CONFIGFILE
Options:
--debug Enables debug logging
--rabbitmq TEXT rabbitmq connection url: amqp://127.0.0.1:5672/
--redis TEXT redis connection url: redis://localhost/
--sticky INTEGER How long a process should stay the leader
--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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size dramatiq_apscheduler-0.0.2-py3-none-any.whl (7.0 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size dramatiq-apscheduler-0.0.2.tar.gz (4.8 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for dramatiq_apscheduler-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d919f001500fee291533552527e2ab3a9f4ef9389e175f67ca6eba4de65781 |
|
MD5 | 1c41a5f46b469216ddaae6cb2190196c |
|
BLAKE2-256 | 599112f51e6538afe078aceabafd6b4ffa60c8c16ea092f4972fc7a53d6eccb3 |
Hashes for dramatiq-apscheduler-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 423f45b741d69eb3b00c68d4c6e250ef858ec5471b37fd0ef2c13e812a19bbcd |
|
MD5 | 5c4f762f720b3b8513ef44898f17040d |
|
BLAKE2-256 | 15dd6bec47c00d0a16d8da50fd695aa09ccd2ab90ef6080824033b29887e8600 |