dagu
dagu copied to clipboard
feat: Generic task and DAG callbacks
Defining what to do when task or DAG finishes is disjointed.
This is proposal to add generic callbacks:, you can have multiple of them depending on and per the status success / failure / skipped
mailOn, #758, #688 can be reclassified as callbacks
Additional callbacks can include generic webhooks and execution of user defined callbacks from command:
I think we can use onSuccess, onFailure, onCancelled hooks to plugin the callbacks/scripts like messaging users via social apps, mail log files and what not.
That's the idea, with the user defined callback you can execute from scripts, whatever you like, depending on the status
- onSuccess
- onFailure
- onCancelled
- onSkipped
something like
- name: step1
callback:
onFailure:
- type: script
command: python upload_logs.py
- type: mail
message:
recipients:
...
onSuccess:
- type: webhook
url:
- type: slack (slack webhook)
....
To be considered is what variables are accessible to the callbacks
- all from the DAG and TASKS
- DAG ID / Name, Task name, everything from Run Status
One possible list of tasks could be we may have access to something like failed steps list, their stdout/stderr logs, return codes, etc easily accessible via variables and tasks defined to tar/zip and share. In sharing step, overall dag run status (start/end time) with success or failure details (failed step details) on every dag run or may be dag run reports on daily or monthly basis.