SOLVED Post-command acting on succeed/fail

How please do I code something like this in a task definition:

post-script = “”"
if task succeeded then
[hang out the flags]
else
[cry]
fi
“”"

I may be misunderstanding what you’re trying to do, but this sounds like an excellent use of the err-script and exit-script entries (https://cylc.github.io/doc/built-sphinx-single/index.html#runtime-name-err-script and https://cylc.github.io/doc/built-sphinx-single/index.html#runtime-name-exit-script).

In your case, the err-script would include the contents of [cry] in the example above and exit-script would hang out the flags.

I second @Tim_Whitcomb’s suggestion.

It also occurred to me that you might be asking how to trigger different tasks off of the success or failure of an upstream task. If so, look for “Automated failure recovery via suicide triggers” in the User Guide: https://cylc.github.io/doc/built-sphinx/suite-config.html#suicide-triggers (the documentation section heading is not very informative here, sorry, if you don’t already know what “suicide triggers” are - they are for dynamically removing tasks from a workflow branch that you don’t want to run, which is needed if you have different success and failure branches).

Thank you both.
err-script and exit-script are exactly what I need.

1 Like