Last active
December 12, 2022 06:30
-
-
Save KentFujii/b48da293772de2adc52624e354a92c0f to your computer and use it in GitHub Desktop.
Dag for debugging digdag ruby operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_export: | |
rb: | |
require: myruby | |
+step1: | |
rb>: Task::MyWorkflow.step1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Task | |
class MyWorkflow | |
def step1 | |
Digdag.env.add_subtask( | |
{ | |
"+step2_1": { | |
"rb>": "Task::MyWorkflow.step2", | |
}, | |
"+step2_2": { | |
"rb>": "Task::MyWorkflow.step2", | |
}, | |
"_parallel": true | |
} | |
) | |
Digdag.env.add_subtask( | |
{ | |
"+step3_1": { | |
"rb>": "Task::MyWorkflow.step3", | |
}, | |
"+step3_2": { | |
"rb>": "Task::MyWorkflow.step3", | |
}, | |
"_parallel": true | |
} | |
) | |
end | |
def step2 | |
sleep 3 | |
raise if [true, false].sample | |
end | |
def step3 | |
sleep 1 | |
raise if [true, false].sample | |
Digdag.env.add_subtask( | |
{ | |
"+step4": { | |
"rb>": "Task::MyWorkflow.step4", | |
}, | |
} | |
) | |
end | |
def step4 | |
sleep 1 | |
raise if [true, false].sample | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment