Skip to content

A convenience job scheduler based on APScheduler, FastAPI, Pydantic, and SQLAlchemy.

License

Notifications You must be signed in to change notification settings

pyveci/supertask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supertask

About

Supertask is a convenience job scheduler based on APScheduler, FastAPI, Pydantic, SQLAlchemy, and a few other excellent packages.

You can use Supertask to invoke time-driven actions like the venerable cron daemon is doing it. It can be used both as a standalone program, and as a library.

It aims for DWIM-like usefulness and UX, and provides CLI and HTTP interfaces, and others.

Features

  • Store jobs in databases supported by SQLAlchemy.
  • HTTP API to manipulate the job data model.
  • Optionally, jobs can be pre-seeded from a JSON file config.json, either from the local filesystem, or from a remote URL. When using the filesystem, a watchdog monitors the file for changes, in order to keep the crontabs up-to-date.

Status

Please note that Supertask is a work in progress, and to be considered alpha-quality software. Contributions of all kinds are much welcome, in order to make it more solid, and to add features.

Breaking changes should be expected until a 1.0 release, so version pinning is strongly recommended, especially when you use it as a library.

Setup

pip install --upgrade --prefer-binary -r requirements.txt -r requirements-dev.txt
pip install --upgrade --prefer-binary --editable=.

Configuration

Supertask obtains configuration settings from both command-line arguments, environment variables, and .env files.

It is required to define the job store address. For that, use either the --store-address command line option, or the ST_STORE_ADDRESS environment variable. The value is an SQLAlchemy-compatible connection URL.

export ST_STORE_ADDRESS=memory://
export ST_STORE_ADDRESS=postgresql://postgres@localhost
export ST_STORE_ADDRESS=crate://crate@localhost

The default full qualified table name is "ext"."jobs". It can be defined by using the --store-schema-name and --store-table-name command-line options, or by adjusting the ST_STORE_SCHEMA_NAME and ST_STORE_TABLE_NAME environment variables.

Usage

Run scheduler daemon, with pre-seeded example jobs.

supertask --pre-delete-jobs --pre-seed-jobs=cronjobs.json

Run scheduler daemon, and start HTTP API service.

supertask --http-listen-address=localhost:4243

Consume HTTP API.

http http://localhost:4243/cronjobs/

All together now.

supertask \
  --http-listen-address=localhost:4243 \
  --pre-delete-jobs \
  --pre-seed-jobs=https://github.com/pyveci/supertask/raw/main/cronjobs.json

Development

For installing a development sandbox, please refer to the development sandbox documentation.

About

A convenience job scheduler based on APScheduler, FastAPI, Pydantic, and SQLAlchemy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published