Allow retry action to be exit

This commit is contained in:
qiagu
2022-08-18 12:42:39 -07:00
parent 419b6835d5
commit 728d089c18
2 changed files with 8 additions and 2 deletions
@@ -1157,6 +1157,7 @@
<param id="retry_on_exit_statusReason">...</param>
<param id="retry_on_exit_reason">...</param>
<param id="retry_on_exit_exitCode">...</param>
<param id="retry_on_exit_action">exit</param>
-->
</destination>
<destination id="aws_batch_gpu" runner="aws_batch">
+7 -2
View File
@@ -179,6 +179,10 @@ class AWSBatchJobRunner(AsynchronousJobRunner):
"default": "",
"map": str,
},
"retry_on_exit_action": {
"default": "RETRY",
"map": str,
},
}
FARGATE_VCPUS = [0.25, 0.5, 1, 2, 4]
@@ -293,18 +297,19 @@ class AWSBatchJobRunner(AsynchronousJobRunner):
def _get_retry_strategy(self, destination_params):
""" Make a simple one-condition retry strategy
"""
# TODO make multiple-condition retry strategies
# TODO make multi-condition retry strategies
attemps = destination_params.get("retry_attempts")
status_reason = destination_params.get("retry_on_exit_statusReason")
reason = destination_params.get("retry_on_exit_reason")
exit_code = destination_params.get("retry_on_exit_exitCode")
action = destination_params.get("retry_on_exit_action")
if attemps <= 1:
return
strategy = {
"attempts": attemps,
"evaluateOnExit": [{"action": "RETRY"}],
"evaluateOnExit": [{"action": action}],
}
if status_reason:
strategy["evaluateOnExit"][0]["onStatusReason"] = status_reason