The program.yaml Format
A program saved by the web interface or written by debasher_build
lives in its home directory as a topology file, program.yaml,
and one file per process with its code (see the DeBasher Web Interface Section
for the home directory and the Describing a Program in Python Section for the
SDK). The topology file holds what the program is and how it runs:
its processes, their options, their connections and their
specifications. It holds nothing of the machine it is on, such as the
output directory, which the web interface keeps in
.debasher/local.json. The module of the program, <name>.sh, is
built from the topology file and the files it names, by a save of the
editor or by debasher_build <home directory>, and is never edited
by hand.
The file is YAML. Every key of the program but schema_version and
name is optional; an absent key is empty, false or none unless a
default is given below. Inside it, an option needs type, a group
all four of its keys and a position both x and y. A key that
the format does not have is an error, so that a misspelt key is reported
rather than ignored. Every plain value is read as a string, since most
values are Bash words; the keys that take a number or a boolean convert
it. The order of the processes and of the options of a process is kept.
The JSON Schema of the format is published with this documentation,
at _static/schema/program-1.json, and debasher_build --schema
prints it. The first line of every file that DeBasher writes names
it, for the editors that check a YAML file against a schema:
# yaml-language-server: $schema=https://debasher.readthedocs.io/en/latest/_static/schema/program-1.json
An example
The topology file of the program webui_skip_py, installed under
<prefix>/share/debasher/webui_programs, has two processes, whose
code is in value_writer.sh and value_reader.sh, and a skip
method written as a Python function in value_reader_skip.py:
# yaml-language-server: $schema=https://debasher.readthedocs.io/en/latest/_static/schema/program-1.json
schema_version: 1
name: webui_skip_py
description: >-
Example built with the web UI: a process sums two numbers into a value descriptor,
and another writes the sum plus one, skipped by a rule in Python when the sum
is odd.
program_options:
-num-a: '1'
-num-b: '3'
processes:
value_writer:
description: Takes two numbers and produces their sum as output.
code: value_writer.sh
specs: {cpus: 1, mem: 32, time: '00:01:00'}
position: {x: 100, y: 100}
options:
-num-a:
type: int
description: First number to be summed
cmdline: true
-num-b:
type: int
description: Second number to be summed
cmdline: true
-outv:
type: int
description: output value descriptor
channel: value_desc
value_reader:
description: >-
Reads the sum, increases it by one and writes it into a file; skipped when
the sum is odd.
code: value_reader.sh
methods:
skip: value_reader_skip.py
specs: {cpus: 1, mem: 32, time: '00:01:00'}
position: {x: 100, y: 260}
options:
-val-desc:
type: int
description: value descriptor
from: value_writer.-outv
-outf:
type: file
description: output file
value: ${process_outdir}/value_reader.out
The program
schema_versionThe version of the format, an integer, 1 for the one described here. A reader reads every version up to its own and refuses a newer one. The version is raised when the meaning of a key changes or a key goes; a key added with a default does not raise it.
nameThe name of the program, which also names its module,
<name>.sh: letters, digits and underscores, starting with a letter or an underscore.typeresidentfor a resident program (see the Resident DeBasher Programs Section); absent for a general program.descriptionThe description of the program.
preambleBash run before the functions of the module, such as the
load_debasher_modulelines of the modules the program uses.envThe environment variables of the program, name to value. Only
DEBASHER_MOD_DIRis read: the directories, separated by colons, where the modules that thepreambleloads are looked for. The web interface sets it for its runs; a run from the command line takes it from the environment.shared_dirsThe shared directories of the program, a list of names.
executionThe execution options, as “Set execution options” of the editor holds them:
scheduler(BUILTIN, the default, orSLURM),builtin_sched_cpus,builtin_sched_mem,dflt_nodes,dflt_throttle,rerun_outdated_procs,conda_support,docker_supportand, for a resident program,snapshot_every_secs. The web interface turns them into options ofdebasher_execwhen it runs the program (see the Executing DeBasher Programs Section), exceptsnapshot_every_secs, which startsdebasher_snapshot_resident --every; a resident program always runs with the builtin scheduler and takes onlybuiltin_sched_cpusandbuiltin_sched_mem. The module does not hold them, so a run from the command line gives its own options.program_optionsThe options of the command line that a run from the web interface is given, label to value, as “Set program options” of the editor holds them. As with
execution, a run from the command line gives its own.processesThe processes, name to process (see “A process” below).
seq_processesThe sequential processes, name to sequential process (see “A sequential process” below).
A process
Where the code of a process is, one of the following, or none, when a
module that the preamble loads provides the code of a process of
that name:
codeThe path of the process file, relative to the topology file, which the editor shows and writes as the code of the process. A Bash file holds the function named as the process with its helper functions, a file of another language the whole script, and the file of a node of a resident program the whole class file.
scriptThe path of a script that the module runs as it is, with the interpreter of its extension (the external alias of the Writing a Module in Bash Section). The editor shows it and never writes it.
aliasThe name of another process, whose code this one runs under its own name and options.
The extension of a file says its language: .sh Bash, .py
Python, .pl Perl, .r or .R R, .groovy Groovy. The other
keys of a process are:
alias_opt_mapWith
scriptoralias: the name of each option of this process to the one that the code expects.languageThe language of the process (
bash,python,perl,rorgroovy), given only when the extension of its file does not say it.descriptionThe description of the process.
modeThe mode of the options handler:
array,generatorormanual; absent for a process with one task.tasksThe path of the tasks file, the code of the options handler: the Bash that builds the array of an
arrayprocess or prints the number of tasks of ageneratorprocess, or a Python file (.py) that definestasks(run)(see the The Tasks in Python Section); for amanualprocess, the whole Bash function that defines its options.methodsThe additional methods, the name of each (
skip,post,reset_outfiles,outdir_basename,conda_envs,docker_imgs) to the path of the file with its Bash body. The file ofskipmay instead be a Python file that definesskip(task).conda_envsThe Conda environments of the process given as data, the name of each to its YAML file. A process gives them this way or as a
conda_envsmethod file, not both.docker_imgsThe Docker images of the process given as data, a list. A process gives them this way or as a
docker_imgsmethod file, not both.specsThe specifications of the process in the program, by the names of the engine:
cpus,mem(megabytes),time(hh:mm:ss),processdepsandforce, asadd_debasher_processtakes them (see the Program Definition Section), and, for a node of a resident program, its limits (input_log_max_mb,out_backlog_max_mb,out_backlog_fail_mb,gil_switch_interval_ms,startup_timeout_s,max_concurrent_runs,batch_sched,heartbeat_timeout_s). A process takes the default of each ofcpus,memandtimethat it leaves out: 1 CPU, 256 megabytes,01:00:00, the values that the editor gives a new process.kindOnly in a resident program:
FBPProcess,ProgramLauncherorDirectoryWatcherfor a node, after the class of the runtime library that it derives from, orSupervisor. TheSupervisortakes nocode,scriptoralias: script generation writes its whole class.initiatorOnly in a resident program: whether a round starts at the node.
groupFor a process that “Add program” of the editor brought in from another program, where it came from (
program,id,size,dir).positionWhere the canvas draws the process,
{x: ..., y: ...}. No tool but the editor reads it, and a process without one is placed as an imported one is.optionsThe options, label to option (see “An option” below).
An option
The direction of an option is not written: it comes from its label,
an output being a label that starts with -out or --out. The
keys of an option are:
typeThe data type:
int,float,string,file,dir, orflagfor an option that takes no value. It is the only key that every option gives.descriptionThe description of the option.
valueThe value of the option, a Bash word that the engine expands when the option is defined, such as
${process_outdir}/out.txt; for a FIFO, the name of the FIFO; for a shared directory, its name; for an option taken from the specifications, the name of the specification.channelHow the option is delivered:
none(the default),fifo,value_desc,shared_dirorprocess_outdir.subpathWith
channel: shared_dirorchannel: process_outdir: a shared subdirectory or a task subdirectory below the directory.mirrorWith
channel: fifo: whether a copy of what is written is kept fordebasher_get_fifo_mirror.fifo_tagexternalfor an external input of a resident program, written from outside the program.cmdlineWhether the value comes from the command line of the run.
mandatoryWhether a command line option has to be given. A command line option that is not a flag is mandatory unless it says
mandatory: false.shapingWhether a command line option is a task shaping option, read by the options handler only.
from_specWhether the value is a specification of the process (
valuenames it, such ascpus).count_sourceFor a family of options, a label ending in
-ith: the label of the option of the same process that counts it. Without it, the family is counted by the tasks of the process at the other end.fromFor a connected input: what it reads,
<process>.<label>, or a list of them for a fan-in. The connections of a program are thefromof its inputs; the file has no other list of them.displaylabelfor an input whose connections the canvas draws as label edges,line(the default) for lines. No tool but the editor reads it.
A sequential process
A sequential process (see the Sequential processes Section)
takes description, code, script, alias,
alias_opt_map, language and group as a process does, and
specs with cpus, mem, time and sched, the
scheduler of its steps (BUILTIN, the default, or SLURM). Its
cpus, mem and time are optional and have no default.