Reason
- class aws_cdk.aws_batch.Reason
Bases:
object
Common job exit reasons.
- 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
- CANNOT_PULL_CONTAINER = <aws_cdk.aws_batch.Reason object>
- NON_ZERO_EXIT_CODE = <aws_cdk.aws_batch.Reason object>
- SPOT_INSTANCE_RECLAIMED = <aws_cdk.aws_batch.Reason object>
Static Methods
- classmethod custom(*, on_exit_code=None, on_reason=None, on_status_reason=None)
A custom Reason that can match on multiple conditions.
Note that all specified conditions must be met for this reason to match.
- 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
- Return type: