CustomReason
- class aws_cdk.aws_batch.CustomReason(*, on_exit_code=None, on_reason=None, on_status_reason=None)
Bases:
object
The corresponding Action will only be taken if all of the conditions specified here are met.
- Parameters:
on_exit_code (
Optional
[str
]) – A glob string that will match on the job exit code. For example,'40*'
will match 400, 404, 40123456789012 Default: - will not match on the exit codeon_reason (
Optional
[str
]) – A glob string that will match on the reason returned by the exiting job For example,'CannotPullContainerError*'
indicates that container needed to start the job could not be pulled. Default: - will not match on the reasonon_status_reason (
Optional
[str
]) – A glob string that will match on the statusReason returned by the exiting job. For example,'Host EC2*'
indicates that the spot instance has been reclaimed. Default: - will not match on the status reason
- ExampleMetadata:
infused
Example:
job_defn = batch.EcsJobDefinition(self, "JobDefn", container=batch.EcsEc2ContainerDefinition(self, "containerDefn", image=ecs.ContainerImage.from_registry("public.ecr.aws/amazonlinux/amazonlinux:latest"), memory=cdk.Size.mebibytes(2048), cpu=256 ), retry_attempts=5, retry_strategies=[ batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.CANNOT_PULL_CONTAINER) ] ) job_defn.add_retry_strategy( batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.SPOT_INSTANCE_RECLAIMED)) job_defn.add_retry_strategy( batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.CANNOT_PULL_CONTAINER)) job_defn.add_retry_strategy( batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.custom( on_exit_code="40*", on_reason="some reason" )))
Attributes
- on_exit_code
A glob string that will match on the job exit code.
For example,
'40*'
will match 400, 404, 40123456789012- Default:
will not match on the exit code
- on_reason
A glob string that will match on the reason returned by the exiting job For example,
'CannotPullContainerError*'
indicates that container needed to start the job could not be pulled.- Default:
will not match on the reason
- on_status_reason
A glob string that will match on the statusReason returned by the exiting job.
For example,
'Host EC2*'
indicates that the spot instance has been reclaimed.- Default:
will not match on the status reason