{"id":18521599,"url":"https://github.com/transferwise/cicada","last_synced_at":"2025-04-09T09:33:16.884Z","repository":{"id":36976550,"uuid":"167704568","full_name":"transferwise/cicada","owner":"transferwise","description":"Cicada scheduler","archived":false,"fork":false,"pushed_at":"2024-09-23T04:25:26.000Z","size":760,"stargazers_count":5,"open_issues_count":4,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-24T04:43:25.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transferwise.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-26T15:32:49.000Z","updated_at":"2024-07-19T13:20:20.000Z","dependencies_parsed_at":"2024-11-06T17:33:47.989Z","dependency_job_id":"b7fdb649-e05c-40d1-98cb-1b543edb576f","html_url":"https://github.com/transferwise/cicada","commit_stats":{"total_commits":108,"total_committers":8,"mean_commits":13.5,"dds":0.25,"last_synced_commit":"08a4e4ad89eec5293527b4ab036694ca412aed19"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transferwise%2Fcicada","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transferwise%2Fcicada/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transferwise%2Fcicada/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transferwise%2Fcicada/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transferwise","download_url":"https://codeload.github.com/transferwise/cicada/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247856541,"owners_count":21007620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T17:26:42.224Z","updated_at":"2025-04-09T09:33:15.884Z","avatar_url":"https://github.com/transferwise.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cicada scheduler\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n*Centralized Distributed Scheduler*\n\n- [Overview](#overview)\n    - [Advantages over using only CRON](#advantages-over-using-only-cron)\n    - [Execution flow diagram](#execution-flow-diagram)\n- [Setup Central database](#setup-central-database)\n    - [Database ERD](#database-erd)\n- [Setup Node](#setup-node)\n- [Administration](#administration)\n    - [cli help](#cli-help)\n    - [(Re)register a server to Cicada](#(re)register-a-server-to-cicada)\n    - [Add or Update a new schedule](#add-or-update-a-new-schedule)\n    - [Launch a schedule once](#launch-a-schedule-once)\n    - [Launch a schedule once](#launch-a-schedule-once)\n    - [Abort a running schedule](#abort-a-running-schedule)\n## Overview\n\n- Cicada is best understood as a lightweight management layer between linux CRON and the end executables\n- It requires a central database for setting up and monitoring schedules\n- Schedules can be launched on any node that has registered itself to the database\n- Nodes act as agents pulling scheduling information from the database.\n### Advantages over using only CRON\n- A central log is kept of schedule executions and results\n- Offers some schedule dependance management\n- Non-running schedules can easily be moved from one node to another\n- Running schedules can easily be terminated\n### Execution flow diagram\n![Execution flow diagram](https://github.com/transferwise/cicada/blob/main/docs/execution_flow.png)\n\n## Setup Central Database\n\nVerified on **PostgreSQL** versions *9.6* to *12.9*\n\n1. Execute as **postgres** user [setup/db_and_user.sql](setup/db_and_user.sql)\n2. Change **cicada** user password\n3. Execute as **cicada** user [setup/schema.sql](setup/schema.sql)\n\n### Database ERD\n![Database ERD](https://github.com/transferwise/cicada/blob/main/docs/erd.png)\n\n## Setup Node\n\nVerified on *Ubuntu 18.04 and 20.04 LTS*\n\nPrerequisites\n\n- ntpd\n- cron\n- python3.8\n\n```bash\n# Install Cicada Scheduler\nsudo mkdir -p /opt/cicada\nsudo chown -R $USER:$USER /opt/cicada\ncd /opt/cicada\nDIR=$(pwd)\n\ncd $DIR\ngit clone git@github.com:transferwise/cicada.git .\nmake python=python3.8\n\n# Update the db_cicada section of the environmental config file\ncp $DIR/config/example.yml $DIR/config/definitions.yml\nvim $DIR/config/definitions.yml\n\n# Register new Node in Database\n$DIR/bin/cicada register_server\n\n# Add linux CRON job to check central scheduler every minute\necho \"* * * * * $DIR/venv/bin/python3 $DIR/venv/bin/cicada exec_server_schedules\" | crontab\n```\n\n## Administration\n\n### cli help\n```bash\ncicada --help\n```\n\n### (Re)register a server to Cicada\n```bash\ncicada register_server\n```\n\n### Add or Update a new schedule\n```bash\ncicada upsert_schedule --help\n\nschedule_id             | Id of the schedule\nschedule_description    | Schedule description and comments\nserver_id               | Id of the server where the schedule will run\nschedule_order          | run order for the schedule. lowest is first. is_async jobs will be execute in parallel\nis_async                | 0=Disabled 1=Enabled | is_async jobs execute in parallel\nis_enabled              | 0=Disabled 1=Enabled\nadhoc_execute           | 0=Disabled 1=Enabled | Execute at next minute, regardless of other settings\nabort_running           | 0=Disabled 1=Enabled | If the job is running, it will be terminated as soon as possible\ninterval_mask           | When to execute the command | unix crontab (minute hour dom month dow)\nfirst_run_date          | The schedule will not execute before this datetime\nlast_run_date           | The schedule will not execute after this datetime\nexec_command            | Command to execute\nparameters              | Parameters for exec_command\nadhoc_parameters        | If specified, will override parameters for one run\nschedule_group_id       | Optional field to help with schedule grouping\n```\n\n### Launch a schedule once, as soon as possible\n- adhoc_execute is a **one-time** schedule modification.\n- As soon as adhoc_execution has been used, it is reset.\n\n```bash\ncicada upsert_schedule --schedule_id={schedule_id} --adhoc_execute={1}\n```\n\n### Launch the next run of a schedule with different parameters\n- adhoc_parameters is a **one-time** schedule modification.\n- As soon as adhoc_parameters has been used, it is reset.\n```\ncicada upsert_schedule --schedule_id={schedule_id} ==adhoc_parameters={do something diffident}\n```\n\n### Abort a running schedule\n- abort_running is a **one-time** schedule modification.\n- As soon as abort_running has been used, it is reset.\n\n```bash\ncicada upsert_schedule --schedule_id={schedule_id} --abort_running={1}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransferwise%2Fcicada","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransferwise%2Fcicada","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransferwise%2Fcicada/lists"}