Pipeline Files
A minigate pipeline file is a small forward-only DSL for launching shell
commands through stagegate.
This page explains the structure of the file itself. For template syntax such
as {...} or [list], see the templates page.
File Structure
A pipeline file contains:
top-level statements
zero or one
[list]sectionszero or one
[alias]sectionsone or more
[stage.N]sections
The minimal useful file is:
format args
[stage.1]
run "echo {arg}"
Top-Level Statements
Valid top-level statements are:
pipelines INTtasks INTformat csv|tsv|varlists|argsheader true|falsecodepage "ENCODING_NAME"delimiter comma|whitespacelimit IDENTIFIER, INT
Meaning of each statement:
pipelines INTsets how many pipelines may be active at once
this is the pipeline-level parallelism seen by
minigate
tasks INTsets the scheduler task parallelism
this is the global limit on concurrently admitted tasks
format ...selects how positional CLI inputs are interpreted
this controls whether inputs are loaded as
args,csv,tsv, orvarlists
header true|falsecontrols whether the first row of
csv/tsvinput is treated as column names
codepage "ENCODING_NAME"selects text decoding for file-based input formats
delimiter comma|whitespaceselects how
varlistsrows are split into fields
limit IDENTIFIER, INTdeclares one abstract resource capacity such as
cpulater
use ...statements consume from these capacities
Notes:
formatis required=is never usedstatements are whitespace-separated
limitmay appear multiple timesall other top-level statements may appear at most once
Defaults:
pipelinesdefaults to
1
tasksdefaults to
1
headerdefaults to
false
codepagedefaults to
"utf-8-sig"
limitomitted means no abstract resource labels are configured
Example:
pipelines 4
tasks 2
format csv
header true
codepage "utf-8-sig"
limit cpu, 4
limit mem, 32
Format-Specific Top-Level Rules
Some top-level statements are valid only for specific input formats.
format args
headeris invalidcodepageis invaliddelimiteris invalid
format csv and format tsv
delimiteris invalid
format varlists
delimiteris requiredheader falsemay be written explicitlyheader trueis invalid
[list]
[list] defines a reusable list of columns from the current input row.
Example:
[list]
target_images {#2}, ...
Rules:
the left-hand side is an identifier such as
target_images=is not usedthe right-hand side contains one or more column references
each element is either
{col}or{#N}alias references are not allowed here
...may appear at most once in one definition
Supported ... shapes are:
A, ..., Bcolumns from
AthroughB
..., Bcolumns
1throughB
A, ...columns from
Ato the last column in the row
...the whole row
Additional rules:
you must not mix named references and
{#N}references around the same...if the input has duplicate headers, named endpoints resolve to the rightmost matching column
[alias]
[alias] defines a reusable name for either:
a scalar string
a list of strings
The right-hand side must be one of:
a template string
a single
COLUMN("...")
Example:
[alias]
sample "{arg:stem}"
tmp "{sample}.tmp"
dat_files "[target_images:stem].dat"
special COLUMN("sample id")
Key rules:
aliases may reference earlier aliases
forward references are invalid
scalar aliases are referenced as
{alias_name}list aliases are referenced as
[alias_name]or{[alias_name]}COLUMN("...")is only valid in alias definitions
COLUMN("...") is mainly for header names that are not valid DSL identifiers.
It is invalid when:
header falseformat varlists
[stage.N]
Each [stage.N] section defines one stage of the pipeline.
Example:
[stage.1]
use cpu, 1
run "preprocess {arg} > {tmp}"
[stage.2]
use cpu, 1
run "summarize {tmp} > {sample}.summary.txt"
Rules:
Nmust be a positive integerstages execute in ascending
Norderduplicate stage numbers are invalid
a stage must contain exactly one of
runorrun_listaccept_retvalsmay appear at most onceusemay appear multiple timesduplicate
uselabels in one stage are invalid
Meaning:
a stage is one barriered wave of task submission
minigatesubmits the commands from that stagewaits for the whole stage to finish
then advances to the next stage number
run
run launches one or more fixed shell-command templates.
Example:
run "cmd1", "cmd2", "cmd3"
Rules:
each item is one template string
templates are comma-separated
trailing commas are invalid
[]list-parallel expansion is not allowed insiderun
Use run when the number of commands is fixed at the stage-definition level.
If a run statement contains multiple templates, they are launched as one
parallel wave inside that stage and then waited on together.
run_list
run_list launches a variable number of commands from one template.
Example:
run_list "preprocess {#1} --in [target_images] --out [dat_files]"
Rules:
exactly one template string is allowed
comma-separated multiple templates are invalid
one or more
[]expansions may appearif multiple
[]expansions appear, they must all resolve to the same lengthbroadcasting is not performed
Use run_list when one input row should fan out into a task wave.
This is the main statement for per-file or per-item batch work derived from one
row.
use
use adds abstract resource requirements to every task launched from that
stage.
Example:
use cpu, 4
use mem, 16
These resource labels are scheduler admission labels, not OS-enforced quotas.
If a stage contains two run commands and also use cpu, 2, then each task in
that wave requests cpu=2.
accept_retvals
By default, minigate accepts only shell exit code 0.
You can override that for one stage:
accept_retvals 0, 10-15, 255
Rules:
a single value must be a non-negative integer
a range must be
left-rightleftandrightmust be positive integersleft < rightis required
If a command in the stage returns a disallowed code, minigate treats that as
failure and enters fail-fast shutdown.
This is useful when an external tool uses non-zero codes for domain-specific
states that you still want to accept.
Comments and Continuations
The DSL supports line comments:
#begins a comment only outside strings and outside brace references. That is why{#2}still means a column-index reference.Indented continuation lines are joined to the previous logical line. This is mainly useful for long statements, though most pipeline files are easier to read when kept one statement per line.