basic — tasks, dependencies and source substitution
Sources: examples/workflow_simple — settings in workflows/basic/. This one is not listed in the shipped workflow_settings.yml — add it to the workflows: list to run it:
workflows:
- basic/*
The smallest workflow. main depends on generate_config, so the two run in order, and both report progress along the way:
tasks:
- name: main
dependencies:
- "generate_config"
commands:
- echo 'Generating string...'
- sleep 1
- "echo 'Progress: 60' > progress.txt"
- ...
- "echo 'Progress: 100' > progress.txt"
- name: "generate_config"
commands:
- echo 'Generating config.txt...'
- "echo 'Progress: 20' > progress.txt"
- ...
- touch config.txt
The dependency task takes progress from 20% to 40%, main from 60% to 100% — which is how the monitor shows a single coherent bar for a job made of several steps.
It is also the only workflow that substitutes into a source file, exactly like an RTL architecture:
use_parameters: Yes
param_target_file: "main.py"
start_delimiter: 'AWESOME_STRING = "'
stop_delimiter: '"'
AWESOME_STRING = "default string"
print(AWESOME_STRING)
with open("output.txt", "w") as f:
f.write("text: " + AWESOME_STRING + "\n")
f.write("letters: " + str(len(AWESOME_STRING)) + "\n")
Two configurations are provided, default.txt and hehe.txt, each holding the string to write between the quotes. And the metrics are read back with regexes over the output file:
metrics:
word:
type: regex
settings:
file: output.txt
pattern: "text: (.*)"
group_id: 1
letters:
type: regex
settings:
file: output.txt
pattern: "letters: ([0-9]+)"
group_id: 1
format: "%.0f"
word has no format, so it stays a string; letters is formatted as an integer. A metric that is not numeric is perfectly valid — it becomes a label rather than an axis.