- Difficulty level: easy
- Time need to lean: 10 minutes or less
- Key points:
- Step depends accepts regular Python aguments
- Step depends are usually used to create dependencies but variables
_depends
can be used directly
The depends
statement defines the dependency targets of a SoS step and are usually used to create step dependencies. You can check out the How to create dependencies between SoS steps tutorial for a quick overview of the use of input statements.
Similar to the list of input files in the input:
statement, you can list dependency files in depends
statement.
You can explicitly depend on another step as a way to execute another step before the step:
Another usage is that if you step depends on a variable that is generated from another step, you have to shared
the variable from the step that generates it, and depends on the variable in the step that uses it.
SoS allows many the use of many types of targets, which are generally speaking object that you can check its existence. You can check the existence of libraries (and install them if not available in some cases), and check the available of certain executables, or if your system has the required resources. These targets generally are used in the depends
statement of steps.
For example, the following workflow checks if command file
exists before running the shell script that uses it.