JobStateTimeLimitAction

class aws_cdk.aws_batch.JobStateTimeLimitAction(*, max_time, reason, action=None, state=None)

Bases: object

Specifies an action that AWS Batch will take after the job has remained at the head of the queue in the specified state for longer than the specified time.

Parameters:
  • max_time (Duration) – The approximate amount of time, that must pass with the job in the specified state before the action is taken. The minimum value is 10 minutes and the maximum value is 24 hours.

  • reason (JobStateTimeLimitActionsReason) – The reason to log for the action being taken.

  • action (Optional[JobStateTimeLimitActionsAction]) – The action to take when a job is at the head of the job queue in the specified state for the specified period of time. Default: JobStateTimeLimitActionsAction.CANCEL

  • state (Optional[JobStateTimeLimitActionsState]) – The state of the job needed to trigger the action. Default: JobStateTimeLimitActionsState.RUNNABLE

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_batch as batch

job_state_time_limit_action = batch.JobStateTimeLimitAction(
    max_time=cdk.Duration.minutes(30),
    reason=batch.JobStateTimeLimitActionsReason.INSUFFICIENT_INSTANCE_CAPACITY,

    # the properties below are optional
    action=batch.JobStateTimeLimitActionsAction.CANCEL,
    state=batch.JobStateTimeLimitActionsState.RUNNABLE
)

Attributes

action

The action to take when a job is at the head of the job queue in the specified state for the specified period of time.

Default:

JobStateTimeLimitActionsAction.CANCEL

max_time

The approximate amount of time, that must pass with the job in the specified state before the action is taken.

The minimum value is 10 minutes and the maximum value is 24 hours.

reason

The reason to log for the action being taken.

See:

https://docs.aws.amazon.com/batch/latest/userguide/troubleshooting.html#job_stuck_in_runnable

state

The state of the job needed to trigger the action.

Default:

JobStateTimeLimitActionsState.RUNNABLE