python-flavour cabs #107
o-smirnov
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@caracal-pipeline/stimelators, another example of the new "flavour" features. Here's how to embed python in a cab.
The old pattern of
command: (module)function
is replaced byThe inputs and outputs describe the function signature, as before.
Here's a more advanced example, the
python-code
flavour treats the command as an embedded piece of Python code. Things to note here:the
command: |
thingy is a standard YaML syntax for embedding a multi-line stringthe example here shows how to embed an on-the-fly cab definition into a step. Basically, the
cab
field of a step can be a string (in which case it's looked up in globalcabs
), or it can be a mapping, which then should be a cab definition. The former case is useful when you want to reuse a cab in multiple places, the latter case is useful if you're just doing a quick one-off operation.inputs (and named file outputs) of a
python-code
flavour cab are (by default) passed to the code as local variables with the same names (except "-" is replaced by "_"). Outputs of such a cab are picked up from named variables after the code is executed (see thems-info
cab below for an example of such an output).not strictly related to Python, but note how the
save-ms-info
step saves stuff into a yml file, and is conditionally skipped if the file already exists. Thems-info
step then reads this file. This seems to be a recurring pattern in some of your recipes (thinking of solarkat), so I thought I'd illustrate it here.Beta Was this translation helpful? Give feedback.
All reactions