The smos-scheduler tool is configured most easily using a configuration file.
Example configuration:
scheduler:
schedule:
- description: "Weekly tasks"
template: templates/weekly.smos.template
destination: projects/weekly-[ %V | monday ].smos
schedule: "0 12 * * 7" # Cron schedule: "At 12:00 on Sunday."
Example template at templates/weekly.smos.template:
- entry: Weekly actions
forest:
- header: Weekly review
state: READY
timestamps:
SCHEDULED: "[ %F | saturday ]"
Run smos-scheduler check to make sure everything is ready for the template to be scheduled correctly.
Then run smos-scheduler schedule periodically.
Once per hour or once per day should be enough but make sure to automate it.
Templating language
The destination filename as well as the template of the smos file itself use a templating language.
Most of the contents are just literal text, but timestamps can be spliced in as necesary.
Splicing works using the [ template ] or [ template | fuzzy timestamp ] syntax.
In practice, [ template ] is sugar for [ template | time at which the scheduler is run].
Some examples:
- On 2020-07-19,
[ %F ] becomes 2020-07-19.
- On 2020-07-19,
[ %W ] becomes 29. (%W represents the week number)
- On 2020-07-19,
[ %F | monday ] becomes 2020-07-20.
- On 2020-07-19,
[ %W | monday ] becomes 30. (%W represents the week number)
Usage: smos-scheduler COMMAND [--config-file FILEPATH] [--workflow-dir FILEPATH]
[--archive-dir FILEPATH] [--projects-dir FILEPATH]
[--archived-projects-dir FILEPATH] [--state-file FILEPATH]
Smos Scheduler Tool version 0.1.0
Available options:
-h,--help Show this help text
--config-file FILEPATH The config file to use
--workflow-dir FILEPATH The workflow directory to use
--archive-dir FILEPATH The archive directory to use
--projects-dir FILEPATH The projects directory to use
--archived-projects-dir FILEPATH
The archived projects directory to use
--state-file FILEPATH The state file to use
Available commands:
check Check that all schedules are sensible
schedule Run the schedules
Available environment variables:
SMOS_ARCHIVED_PROJECTS_DIR
Archived projects directory
SMOS_ARCHIVE_DIR
Archive directory
SMOS_CONFIG_FILE
Workflow directory
SMOS_PROJECTS_DIR
Projects directory
SMOS_STATE_FILE The path to the file in which to
store the scheduler state
SMOS_WORKFLOW_DIR
Workflow directory
# DirectoryConfiguration
workflow-dir: # optional
# The workflow directory
<string>
archive-dir: # optional
# The archive directory
<string>
projects-dir: # optional
# The projects directory
<string>
archived-projects-dir: # optional
# The archived projects directory
<string>
# Configuration
scheduler: # optional
# The scheduler configuration
# SchedulerConfiguration
state-file: # optional
# The file to store the scheduler state in
<string>
schedule: # optional
- # The scheduler schedule
# ScheduleItem
description: # optional
# A description of this item
<string>
template: # required
# The file to copy from (relative, inside the workflow directory)
<string>
destination: # required
# The file to copy to (relative, inside the workflow directory)
<string>
schedule: # required
# The schedule on which to do the copying
<string>