Package: cicada
Cicada schedulerCentralized Distributed SchedulerOverviewAdvantages over using only CRONExecution flow diagramSetup Central databaseDatabase ERDSetup NodeAdministrationcli help(Re)register a server to CicadaAdd or Update a new scheduleLaunch a schedule onceLaunch a schedule onceAbort a running scheduleOverviewCicada is best understood as a lightweight management layer between linux CRON and the end executablesIt requires a central database for setting up and monitoring schedulesSchedules can be launched on any node that has registered itself to the databaseNodes act as agents pulling scheduling information from the database.Advantages over using only CRONA central log is kept of schedule executions and resultsOffers some schedule dependance managementNon-running schedules can easily be moved from one node to anotherRunning schedules can easily be terminatedExecution flow diagramSetup Central DatabaseVerified onPostgreSQLversions9.6to12.9Execute aspostgresusersetup/db_and_user.sqlChangecicadauser passwordExecute ascicadausersetup/schema.sqlDatabase ERDSetup NodeVerified onUbuntu 18.04 and 20.04 LTSPrerequisitesntpdcronpython3.8# Install Cicada Schedulersudomkdir-p/opt/cicada
sudochown-R$USER:$USER/opt/cicadacd/opt/cicadaDIR=$(pwd)cd$DIRgitclonegit@github.com:transferwise/cicada.git.
makepython=python3.8# Update the db_cicada section of the environmental config filecp$DIR/config/example.yml$DIR/config/definitions.yml
vim$DIR/config/definitions.yml# Register new Node in Database$DIR/bin/cicadaregister_server# Add linux CRON job to check central scheduler every minuteecho"* * * * *$DIR/venv/bin/python3$DIR/venv/bin/cicada exec_server_schedules"|crontabAdministrationcli helpcicada--help(Re)register a server to Cicadacicadaregister_serverAdd or Update a new schedulecicadaupsert_schedule--help

schedule_id|Idoftheschedule
schedule_description|Scheduledescriptionandcomments
server_id|Idoftheserverwheretheschedulewillrun
schedule_order|runorderfortheschedule.lowestisfirst.is_asyncjobswillbeexecuteinparallel
is_async|0=Disabled1=Enabled|is_asyncjobsexecuteinparallel
is_enabled|0=Disabled1=Enabled
adhoc_execute|0=Disabled1=Enabled|Executeatnextminute,regardlessofothersettings
abort_running|0=Disabled1=Enabled|Ifthejobisrunning,itwillbeterminatedassoonaspossible
interval_mask|Whentoexecutethecommand|unixcrontab(minutehourdommonthdow)first_run_date|Theschedulewillnotexecutebeforethisdatetime
last_run_date|Theschedulewillnotexecuteafterthisdatetime
exec_command|Commandtoexecute
parameters|Parametersforexec_command
adhoc_parameters|Ifspecified,willoverrideparametersforonerun
schedule_group_id|OptionalfieldtohelpwithschedulegroupingLaunch a schedule once, as soon as possibleadhoc_execute is aone-timeschedule modification.As soon as adhoc_execution has been used, it is reset.cicadaupsert_schedule--schedule_id={schedule_id}--adhoc_execute={1}Launch the next run of a schedule with different parametersadhoc_parameters is aone-timeschedule 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 scheduleabort_running is aone-timeschedule modification.As soon as abort_running has been used, it is reset.cicadaupsert_schedule--schedule_id={schedule_id}--abort_running={1}