https://prefect.io logo
t

Tsang Yong

11/07/2019, 5:25 PM
Is there an example on how to catch bad shelltask in prefect? looking at the docs page it’s not clear to me how to catch these other a raise reference prefect.engine.signals.FAIL
j

Jeremiah

11/07/2019, 5:28 PM
Hi @Tsang Yong — the
ShellTask
will enter a failed state if the command returns anything but a
0
exit code
Do you want to make that optional?
t

Tsang Yong

11/07/2019, 5:31 PM
Task state failed that makes sense. Can I grab the bad output in that case?
j

Jeremiah

11/07/2019, 5:32 PM
The
result
of the Failed state does contain the last line of output. So if you made a task downstream of the
ShellTask
and gave it an
any_failed
trigger (so it runs even if the ShellTask fails), you should be able to receive that line as the input data. But maybe we can make this even easier