トップレベルと親タスクと子タスクの3箇所に書く
↓
子タスクが失敗する
↓
子タスクの_error → 親タスクの_error → トップレベルの_error の順に実行される
$ cat errortest.dig
_error:
echo>: _error at top level
+parent_task:
_error:
echo>: _error at parent_task
+child_task:
_error:
echo>: _error at child_task
sh>: xxx # invalid command
$ digdag run errortest.dig
2016-10-25 16:48:35 +0900: Digdag v0.8.17
2016-10-25 16:48:38 +0900 [WARN] (main): Using a new session time 2016-10-25T00:00:00+00:00.
2016-10-25 16:48:38 +0900 [INFO] (main): Using session /tmp/.digdag/status/20161025T000000+0000.
2016-10-25 16:48:38 +0900 [INFO] (main): Starting a new session project id=1 workflow name=errortest session_time=2016-10-25T00:00:00+00:00
2016-10-25 16:48:41 +0900 [INFO] (0016@+errortest+parent_task+child_task): sh>: xxx
/bin/sh: line 1: xxx: command not found
2016-10-25 16:48:41 +0900 [ERROR] (0016@+errortest+parent_task+child_task): Task failed with unexpected error: Command failed with code 127
java.lang.RuntimeException: Command failed with code 127
at io.digdag.standards.operator.ShOperatorFactory$ShOperator.runTask(ShOperatorFactory.java:193)
at io.digdag.util.BaseOperator.run(BaseOperator.java:51)
at io.digdag.core.agent.OperatorManager.callExecutor(OperatorManager.java:300)
at io.digdag.cli.Run$OperatorManagerWithSkip.callExecutor(Run.java:678)
at io.digdag.core.agent.OperatorManager.runWithWorkspace(OperatorManager.java:244)
at io.digdag.core.agent.OperatorManager.lambda$runWithHeartbeat$2(OperatorManager.java:138)
at io.digdag.core.agent.LocalWorkspaceManager.withExtractedArchive(LocalWorkspaceManager.java:25)
at io.digdag.core.agent.OperatorManager.runWithHeartbeat(OperatorManager.java:136)
at io.digdag.core.agent.OperatorManager.run(OperatorManager.java:120)
at io.digdag.cli.Run$OperatorManagerWithSkip.run(Run.java:660)
at io.digdag.core.agent.MultiThreadAgent.lambda$run$0(MultiThreadAgent.java:95)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2016-10-25 16:48:42 +0900 [INFO] (0016@+errortest+parent_task+child_task^error): echo>: _error at child_task
_error at child_task
2016-10-25 16:48:43 +0900 [INFO] (0016@+errortest+parent_task^error): echo>: _error at parent_task
_error at parent_task
2016-10-25 16:48:44 +0900 [INFO] (0016@+errortest^failure-alert): type: notify
2016-10-25 16:48:44 +0900 [INFO] (0019@+errortest^error): echo>: _error at top level
_error at top level
error:
* +errortest+parent_task+child_task:
Command failed with code 127
Task state is saved at /tmp/.digdag/status/20161025T000000+0000 directory.
* Use --session <daily | hourly | "yyyy-MM-dd[ HH:mm:ss]"> to not reuse the last session time.
* Use --rerun, --start +NAME, or --goal +NAME argument to rerun skipped tasks.