bosh exec¶
Two subcommands: simulate (don't run) and launch (run).
simulate¶
Resolve a descriptor + invocation into a shell-safe command-line string, without running the tool.
Internally, the template is tokenised once via shlex.split. Each
input's value-key is then replaced with a list of rendered tokens —
possibly zero (optional input omitted), one (a scalar), or many (a flag
+ value pair, a list with space separator). The output is rendered
through shlex.join, so values containing spaces are correctly quoted.
Before any tokenisation happens the invocation is validated against
the descriptor: structural shape via Pydantic (types, choices,
numeric ranges, list bounds), cross-input rules (requires-inputs,
disables-inputs, value-requires, value-disables), and group
constraints (mutually-exclusive, one-is-required, all-or-none).
Any failure prevents the simulate/launch and reports the violating
location.
launch¶
Resolve and actually run the tool.
bosh exec launch <descriptor> <invocation>
[-r local|docker|singularity]
[--cwd DIR]
[--runtime-args "..."]
| Flag | Default | Description |
|---|---|---|
-r, --runtime |
local |
Runtime backend. |
--cwd |
. |
Working directory for the run, also the container mount point. |
--runtime-args |
— | Extra arguments passed through to the container runtime, shlex-split. |
Behaviour¶
local— runs the resolved argv as a subprocess.docker— wraps indocker run --rm -v <cwd>:<cwd> -w <cwd> <image> <argv>. Auto-mounts the parent directory of every File-typed input in the invocation (deduped). Environment variables declared in the descriptor'senvironment-variablesare passed via-e. The descriptor'scontainer-image.container-optsare appended after our flags.singularity— wraps insingularity exec --bind <cwd> --pwd <cwd> <image>. Docker images pull via thedocker://URI scheme. Prefersapptainerif available.
Output streams to your terminal live; the final line is a [bosh]
summary plus the declared outputs and whether they appeared on disk:
$ bosh exec launch fsl_bet.json invocation.json -r docker
bet 1.0.0 (...)
Mask: out.nii.gz
...
[bosh] runtime=docker exit=0 duration=2.13s
[bosh] declared outputs:
[OK] mask_file: /work/out.nii.gz
Runtime arguments pass-through¶
Need a GPU? A specific network? Use --runtime-args — the string is
shlex-split and inserted into the container runtime invocation before
the image reference:
Exit codes¶
The CLI exits with the tool's exit code on success/failure. A non-zero
exit from the underlying tool surfaces as-is; runtime errors (image
missing, descriptor without container-image for -r docker) exit
with code 2.