beforeScript
The beforeScript directive executes a custom (Bash) snippet before the main process script is run. This may be useful to initialize the underlying cluster environment or for other custom initialization.
For example:
process hello {
beforeScript 'source /cluster/bin/setup'
script:
"""
echo 'hello'
"""
}
When the process is containerized (using the container directive), the beforeScript is executed in the container only if the executor is container-native (e.g. cloud batch executors, Kubernetes). Otherwise, the beforeScript is executed outside the container.