-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change in what variables are available to exit-script comapred to Cylc7 #6360
Comments
Looks like we haven't documented this particular consequence, but this is expected. The env-script/pre-script/script/post-script are run in a subshell, this isolates them from the job script itself which protects the cylc-flow/cylc/flow/etc/job.sh Lines 141 to 158 in 293c3cc
The err-script is run after errors have been caught or signals trapped in the original shell (because we can't get back into the subshell): cylc-flow/cylc/flow/etc/job.sh Lines 283 to 285 in 293c3cc
I think this ensures that err-script is called more reliably when signals are involved but mandates a separate shell, hence no environment inheritance. Workaround: If you are trying to diagnose a particular command failure, you can work around this by putting the logic into the script section: script = my-command || ( diagnosis-script && exit 1 ) Question: Is there anything we can reasonably do to facilitate this sort of use case? I guess we could potentially |
Ok. Interesting, although I have not read it all. The use case in this specific one can be done in other ways. The original Cylc7 job was
The variables to do the failover backup include things like It can be done in |
The post-script won't be run if the script fails?
If it's only the derived Rose variables that are required you can do this: pre-script = eval $(rose task-env)
script = my-script
exit-script = """
eval $(rose task-env)
backup_data
"""
pre-script = eval $(rose task-env)
script = """
setup
myscript && backup_data
post
"""
pre-script = eval $(rose task-env)
script = myscript
post-script = backup_data
err-script = recover
[scheduling]
[[graph]]
R1 = """
my_script? => backup_data
my_script:fail? => recovery_task
""" |
Description
In Cylc7, variables defined in various script sections were available to
exit-script
.In Cylc8, variables defined in various script sections are not available to
exit-script
even if they are exported. For example,pre-script
defined variables are not available toexit-script
.I've not seen this change in behaviour documented, but maybe I missed it. If it is unexpected, then this is a bug.
NOTE: I've only tested with exit-script, but my guess is similar behaviour applies to err-script.
Reproducible Example
In Cylc7, confirming that variables in
pre-script
do not need to be exported to be seen in theexit-script
:Gives log output below. You can see, variables exported or not exported are all available to
exit-script
.Compare to Cylc8 version:
And the logs - you can see the first variable, which is defined in the
[[[environment]]]
section, can't even be resolved.Expected Behaviour
Consistent behaviour with Cylc7 - variables defined in any section should be available to exit-script.
The text was updated successfully, but these errors were encountered: