File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -382,15 +382,17 @@ def _create_workflow_yaml(
382
382
"template" : "user-defined-exit-handler" ,
383
383
}
384
384
385
- if udf_handler .attributes .get (
386
- "on_success " , True
387
- ) and udf_handler . attributes . get ( " on_failure" , True ) :
388
- # always run
385
+ on_success = udf_handler .attributes .get ("on_success" , True )
386
+ on_failure = udf_handler . attributes . get ( "on_failure " , True )
387
+ if on_success and on_failure :
388
+ # always run, no condition
389
389
pass
390
- elif udf_handler . attributes . get ( " on_success" , True ) :
390
+ elif on_success :
391
391
udf_task ["when" ] = "{{workflow.status}} == 'Succeeded'"
392
- else :
392
+ elif on_failure :
393
393
udf_task ["when" ] = "{{workflow.status}} != 'Succeeded'"
394
+ else :
395
+ raise AIPException ("on_success and on_failure cannot both be False" )
394
396
395
397
exit_handler_template ["dag" ]["tasks" ].append (udf_task )
396
398
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ class ExitHandlerDecorator(FlowDecorator):
96
96
>>> @exit_handler_resources(memory="2G")
97
97
>>> def my_exit_handler(
98
98
>>> status: str,
99
- >>> flow_parameters: Dict[str, str] ,
99
+ >>> flow_parameters: dict ,
100
100
>>> argo_workflow_run_name: str,
101
101
>>> metaflow_run_id: str,
102
102
>>> argo_ui_url: str,
You can’t perform that action at this time.
0 commit comments