Stimela primer
INAF-IRA Bologna July 2025
Presenter: B.V. Hugo
bhugo@sarao.ac.za
Stimela
Etymology
From Zulu isitimela, from English steamer.
Noun
train
A containerized modular workflow management system
Core elements of Stimela
* Software IO layers need native S3 support - MSv2 CDTS does not. New IO interop layer under active development - https://github.com/ratt-ru/xarray-ms)
Today’s prac
On Linux or Windows Subsystem for Linux:
pip install cult-cargo==0.2.1rc2 stimela==2.1.4rc2
pip install tart_cargo
Hello World!
cabs:
greeter:
flavour:
kind: python-code
interpreter_binary: python3
command: |
print(f'Hello {who}!')
info: Simple cab to greet someone in Python
inputs:
who:
dtype: str
info: Who to greet
myrecipe:
info: A simple hello-world recipe
steps:
greet:
cab: greeter
params:
who: INAF
Run:
stimela doc example1.yml
stimela doc example1.yml greeter
stimela run example1.yml myrecipe
Try out: stimela -b native run example1.yml myrecipe
Stimela attempts to prevalidate inputs according to cab (software) parameter definitions
Stimela handles backend, here apptainer/singularity, automatically depending on backend - could be SLURM / AWS K8s
Adding arguments
cabs:
...
myrecipe:
info: A simple hello-world recipe
inputs: # CMD arguments
who:
dtype: str
info: Who to greet
default: INAF
steps:
greet:
cab: greeter
params:
who: =recipe.who
Run:
stimela doc example2.yml
stimela run example2.yml myrecipe who=Italy
_include
_include:
- example_cabs.yml
myrecipe:
info: A simple hello-world recipe
inputs: # CMD arguments
who:
dtype: str
info: Who to greet
default: INAF
steps:
greet:
cab: greeter
params:
who: =recipe.who
Run:
stimela doc example_cabs.yml greeter
stimela run example3.yml myrecipe
Chaining multiple steps
filegreeter:
flavour:
kind: python-code
interpreter_binary: python3
command: |
with open(outfile, filemode) as fo:
fo.write(f'Hello {who}!')
info: Simple cab to greet someone in a file
inputs:
who:
dtype: str
info: Who to greet
filemode:
dtype: str
info: Write mode
choices:
- 'w+'
- a
default: 'w+'
outputs:
outfile:
dtype: File
info: Create a file with greeter output
default: output.txt
required: true
Chaining multiple steps
printer:
command: /usr/bin/cat
info: Wraps standard BASH cat utility
inputs:
filenames:
dtype: Union[File, List[File]]
must_exist: true
policies:
positional: true
repeat: list
info: Files to concatenate with standard BASH utility cat
Chaining multiple steps
_include:
- example_cabs.yml
myrecipe:
info: A simple hello-world recipe
inputs: # CMD arguments
who:
dtype: str
info: Who to greet
default: INAF
steps:
greet:
cab: filegreeter
params:
who: =recipe.who
shownames:
cab: printer
params:
filenames:
- =recipe.steps.greet.outfile
Run:
stimela doc example_cabs.yml filegreeter printer
stimela run example4.yml myrecipe
Loops
Run:
stimela run example5.yml myrecipe who=\[INAF,SARAO\]
_include:
- example_cabs.yml
myrecipe:
info: A simple hello-world recipe
inputs: # CMD arguments
who:
dtype: Union[str,List[str]]
info: Who to greet
default: INAF
for_loop:
var: whoi
over: who
steps:
greet:
cab: filegreeter
params:
who: =recipe.whoi
shownames:
cab: printer
params:
filenames:
- =recipe.steps.greet.outfile
Branching
_include:
- example_cabs.yml
myrecipe:
info: A simple hello-world recipe
inputs: # CMD arguments
who:
dtype: str
info: Who to greet
default: INAF
steps:
greet:
cab: greeter
params:
who: =recipe.who
skip: =recipe.who=='INAF'
greetVIP:
cab: greeter
params:
who: ='VIP '+recipe.who
skip: =recipe.who!='INAF'
Run:
stimela run example6.yml myrecipe who=INAF
stimela run example6.yml myrecipe who='Some Oak'
Bookkeeping configuration
opts:
log:
dir: logs/log-{config.run.datetime}
name: log-{info.fqname}
nest: 2
symlink: log
Cult-cargo
_include:
- (cultcargo):
- wsclean.yml
- casa/calibration.yml
Demos
Full example recipe for CASA-based reduction of Lunar data here:
https://gist.github.com/bennahugo/b6b8c4c830301a97c1ffd41fa5b7ee7e
TART telescope example here (requires installing tart_cargo using pip):
https://drive.google.com/file/d/14kheaS5O-KGAFKRHclOMoGu03MzX3TzM/view?usp=drive_link
Further information
Reasonably detailed documentation is available here:
https://stimela.readthedocs.io/en/latest/fundamentals/fundamentals.html