-
Notifications
You must be signed in to change notification settings - Fork 94
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
job exit script #2868
job exit script #2868
Conversation
Note "cylc kill" for bg jobs use SIGKILL, so the exit-script doesn't run in that case.
(I suppose it would be sensible to have this run only for successful exit, along side the err script for job fail). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment. Looks OK otherwise. Note an old config test needs adding a bunch of new exit_script =
to pass.
Old config test fixed. |
One area this is useful (for me at least) is in the handling of the |
Changing this to execute |
Now run on job success only; documented; ready for review. Note I've left my use of |
Assigned to next-release as this is a pretty simple change (and needed at the aforementioned site). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks OK. Feel free to agree/ignore my eval
comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, docs too. Works as expected on my environment (and Today-I-Learned --set=VAR=VALUE
🌟 ).
# after: cylc run --no-detach --debug --verbose --set=EXIT=true exit-script
kinow@ranma:~/cylc-run/exit-script$ cat log/job/1/foo/01/job.out
Suite : exit-script
Task Job : 1/foo/01 (try 1)
User@Host: kinow@ranma
HELLO
2018-11-21T22:57:31+13:00 INFO - started
kinow@ranma:~/cylc-run/exit-script$ cat log/job/1/foo/01/job.err
Sending DEBUG MODE xtrace to job.xtrace
2018-11-21T22:57:32+13:00 DEBUG - Loading site/user global config files
2018-11-21T22:57:32+13:00 DEBUG - Reading file /home/kinow/Development/python/workspace/cylc/etc/global.rc
2018-11-21T22:57:32+13:00 DEBUG - deprecated items were automatically upgraded in 'site config':
2018-11-21T22:57:32+13:00 DEBUG - * (6.11.0) [state dump rolling archive length] - DELETED (OBSOLETE)
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [communication][base port] -> [suite servers][run ports] - Format as range list
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [communication][maximum number of ports] - DELETED (OBSOLETE)
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [suite host scanning] -> [suite servers] - value unchanged
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [suite servers][hosts] -> [suite servers][scan hosts] - value unchanged
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [suite logging][roll over at start-up] - DELETED (OBSOLETE)
2018-11-21T22:57:32+13:00 DEBUG - Reading file /home/kinow/.cylc/global.rc
2018-11-21T22:57:32+13:00 CRITICAL - failed/EXIT
2018-11-21T22:57:32+13:00 DEBUG - Loading site/user global config files
2018-11-21T22:57:32+13:00 DEBUG - Reading file /home/kinow/Development/python/workspace/cylc/etc/global.rc
2018-11-21T22:57:32+13:00 DEBUG - deprecated items were automatically upgraded in 'site config':
2018-11-21T22:57:32+13:00 DEBUG - * (6.11.0) [state dump rolling archive length] - DELETED (OBSOLETE)
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [communication][base port] -> [suite servers][run ports] - Format as range list
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [communication][maximum number of ports] - DELETED (OBSOLETE)
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [suite host scanning] -> [suite servers] - value unchanged
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [suite servers][hosts] -> [suite servers][scan hosts] - value unchanged
2018-11-21T22:57:32+13:00 DEBUG - * (7.8.0) [suite logging][roll over at start-up] - DELETED (OBSOLETE)
2018-11-21T22:57:32+13:00 DEBUG - Reading file /home/kinow/.cylc/global.rc
EXIT Oops!
Two approvals, and set to |
(Coded on a long-haul flight, when I couldn't sleep).
Add support for a new
exit-script
runtime setting, for scripting that is executed at the very last before a job exits, whether normal exit, or fail, or kill (except SIGKILL, obviously)[successfully].Similar to the existing
err-script
, which executes on job failure.Use case example: automatic deletion heavily used job temp directories, e.g. for jobs that don't use the work directories provided by cylc. (This is evidently a thing for direct ports from SMS at one of our main sites).
Tests added (
expect a few test failures based on a new config item being added without adjusting the config tests - TODO)I won't bother adding documentation until or if agreed that this change is good (or at least, not unreasonable).[documented]One thing I'm not sure of: perhaps the exit script should only run on successful exit? Or do we need both behaviours as an option?[success only]