Working directory¶
Every step is executed in a working directory, which you can specify when creating a step.
If the arguments inp, out and vol contain relative paths,
they are assumed to be relative to the working directory.
Warning
StepUp assumes that the current working directory is not changed
between importing any stepup module and calling functions from stepup.core.api
Example¶
Example source files: docs/getting_started/workdir/
Create a top-level plan.py as follows:
#!/usr/bin/env python3
from stepup.core.api import static, step
static("out/")
step("echo 'a friendly file' > ${out}", workdir="out/", out="hello.txt")
Make the scripts executable and run everything as follows:
You should get the following terminal output:
DIRECTOR │ Listening on /tmp/stepup-########/director (StepUp 2.0.4)
STARTUP │ (Re)initialized boot script
DIRECTOR │ Launched worker 0
PHASE │ run
START │ ./plan.py
SUCCESS │ ./plan.py
START │ echo 'a friendly file' > hello.txt # wd=out/
SUCCESS │ echo 'a friendly file' > hello.txt # wd=out/
DIRECTOR │ Trying to delete 0 outdated output(s).
DIRECTOR │ Stopping workers.
DIRECTOR │ See you!
This will create an output file out/hello.txt
Further reading¶
-
The
step()function and related functions that usestep()internally all return aStepInfoobject, which may be used for defining follow-up steps. TheStepInfoobjects follow the same convention: theirinp,outandvolattributes are lists of paths. If these are relative paths, they are relative to thestep_info.workdirattribute. Consult the section StepInfo Objects for more details. -
In advanced workflows, the HERE and ROOT variables can be convenient to construct relative paths based on the current working directory.