From the documentation:
The job script is separated into two parts. User scripts and environment (env-script, [environment], pre-script, script and post-script) are isolated and executed in a separate subshell process. Any changes to environment, traps, etc., done in any of them are visible in subsequent parts, but will not interfere with the parent shell process.
Now consider the following trivial workflow:
[scheduling]
[[graph]]
R1 = "setup"
[runtime]
[[setup]]
pre-script="a=1"
script="echo $a"
as expected, this works fine.
However if we now create bin/script.sh
containing “a=1
” then
[scheduling]
[[graph]]
R1 = "setup"
[runtime]
[[setup]]
pre-script=script.sh
script="echo $a"
then the job errors, as $a
isn’t defined.
This can, of course, be fixed by changing pre-script=script.sh
to pre-script=". script.sh"
This behavior is, as far as I’m aware, not documented (not even here). It doesn’t feel intuitive, not feel in line with the documentation quoted above.
Is this the expected behavior ?
(Using Cylc 8.2.4 with python3.9 on ubuntu 22)