Skip to main content

Cicada scheduler

License Code style: black

Centralized Distributed Scheduler

Overview

  • Cicada is best understood as a lightweight management layer between linux CRON and the end executables
  • It requires a central database for setting up and monitoring schedules
  • Schedules can be launched on any node that has registered itself to the database
  • Nodes act as agents pulling scheduling information from the database.

Advantages over using only CRON

  • A central log is kept of schedule executions and results
  • Offers some schedule dependance management
  • Non-running schedules can easily be moved from one node to another
  • Running schedules can easily be terminated

Execution flow diagram

Execution flow diagram

Setup Central Database

Verified on PostgreSQL versions 12.9 to 15.14

  1. Execute as postgres user setup/db_and_user.sql
  2. Change cicada user password
  3. Execute as cicada user setup/schema.sql

Database ERD

Database ERD

Editable Excalidraw source

Setup Node

Verified on Ubuntu 18.04, 20.04 LTS and 22.04 LTS

Prerequisites

  • ntpd
  • cron
  • python3.8
# Install Cicada Scheduler
sudo mkdir -p /opt/cicada
sudo chown -R $USER:$USER /opt/cicada
cd /opt/cicada
DIR=$(pwd)

cd $DIR
git clone git@github.com:transferwise/cicada.git .
make python=python3.8

# Update the db_cicada section of the environmental config file
cp $DIR/config/example.yml $DIR/config/definitions.yml
vim $DIR/config/definitions.yml

# Register new Node in Database
$DIR/bin/cicada register_server

# Add linux CRON job to check central scheduler every minute
echo "* * * * * $DIR/venv/bin/python3 $DIR/venv/bin/cicada exec_server_schedules" | crontab

Administration

cli help

cicada --help

(Re)register a server to Cicada

cicada register_server

Add or Update a new schedule

cicada upsert_schedule --help

schedule_id             | Id of the schedule
schedule_description    | Schedule description and comments
server_id               | Id of the server where the schedule will run
schedule_order          | run order for the schedule. lowest is first. is_async jobs will be execute in parallel
is_async                | 0=Disabled 1=Enabled | is_async jobs execute in parallel
is_enabled              | 0=Disabled 1=Enabled
adhoc_execute           | 0=Disabled 1=Enabled | Execute at next minute, regardless of other settings
abort_running           | 0=Disabled 1=Enabled | If the job is running, it will be terminated as soon as possible
interval_mask           | When to execute the command | unix crontab (minute hour dom month dow)
first_run_date          | The schedule will not execute before this datetime
last_run_date           | The schedule will not execute after this datetime
exec_command            | Command to execute
parameters              | Parameters for exec_command
adhoc_parameters        | If specified, will override parameters for one run
schedule_group_id       | Optional field to help with schedule grouping

Launch a schedule once, as soon as possible

  • adhoc_execute is a one-time schedule modification.
  • As soon as adhoc_execution has been used, it is reset.
cicada upsert_schedule --schedule_id={schedule_id} --adhoc_execute={1}

Launch the next run of a schedule with different parameters

  • adhoc_parameters is a one-time schedule modification.
  • As soon as adhoc_parameters has been used, it is reset.
cicada upsert_schedule --schedule_id={schedule_id} ==adhoc_parameters={do something diffident}

Abort a running schedule

  • abort_running is a one-time schedule modification.
  • As soon as abort_running has been used, it is reset.
  • Cicada keeps the schedule marked as running until the launched process exits.
  • Additional abort requests are consumed while Cicada waits for the process to exit.
cicada upsert_schedule --schedule_id={schedule_id} --abort_running={1}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cicada-0.10.4.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cicada-0.10.4-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file cicada-0.10.4.tar.gz.

File metadata

  • Download URL: cicada-0.10.4.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cicada-0.10.4.tar.gz
Algorithm Hash digest
SHA256 c5563728f298b8daacdef999f9a64866bb0422190c8661b2e40eafcb73c7a68f
MD5 012f449ca8074dafb7edb77713c816fa
BLAKE2b-256 d77bf57ac91ab7d2ea045bc2157cf015318aaee8139fe862eb45c3441a275345

See more details on using hashes here.

Provenance

The following attestation bundles were made for cicada-0.10.4.tar.gz:

Publisher: pypipublish.yml on transferwise/cicada

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cicada-0.10.4-py3-none-any.whl.

File metadata

  • Download URL: cicada-0.10.4-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cicada-0.10.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e126818ecd43e5fbd4630a939ea98bb10d30571bb2889b54ed309a94ab7b1b05
MD5 9e40600769d595e054dfa6875865e4c0
BLAKE2b-256 e90c96dfc5f1a02ad102c1bd007bc79b8a6285216810d465ea6d85558fbe2f51

See more details on using hashes here.

Provenance

The following attestation bundles were made for cicada-0.10.4-py3-none-any.whl:

Publisher: pypipublish.yml on transferwise/cicada

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.10.6

2 files

0.10.5

2 files

This release

0.10.4 This release

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.3

2 files

0.8.2

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

1 file

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