Skip to content

Commit

Permalink
refactor: set default value enum
Browse files Browse the repository at this point in the history
  • Loading branch information
mazyu36 committed May 12, 2024
1 parent 402d5b9 commit 6d610e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ new batch.JobQueue(stack, 'joBBQ', {
state: batch.JobStateTimeLimitActionsState.RUNNABLE,
},
{
action: batch.JobStateTimeLimitActionsAction.CANCEL,
maxTimeSeconds: Duration.minutes(10),
reason: batch.JobStateTimeLimitActionsReason.JOB_RESOURCE_REQUIREMENT,
state: batch.JobStateTimeLimitActionsState.RUNNABLE,
},
],
});
Expand Down
12 changes: 8 additions & 4 deletions packages/aws-cdk-lib/aws-batch/lib/job-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ export interface JobStateTimeLimitAction {
/**
* 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
*/
readonly action: JobStateTimeLimitActionsAction;
readonly action?: JobStateTimeLimitActionsAction;

/**
* The approximate amount of time, in seconds, that must pass with the job in the specified
Expand All @@ -170,8 +172,10 @@ export interface JobStateTimeLimitAction {

/**
* The state of the job needed to trigger the action.
*
* @default JobStateTimeLimitActionsState.RUNNABLE
*/
readonly state: JobStateTimeLimitActionsState;
readonly state?: JobStateTimeLimitActionsState;
}

/**
Expand Down Expand Up @@ -304,10 +308,10 @@ export class JobQueue extends Resource implements IJobQueue {
}

return {
action: jobStateTimeLimitAction.action,
action: jobStateTimeLimitAction.action ?? JobStateTimeLimitActionsAction.CANCEL,
maxTimeSeconds,
reason: jobStateTimeLimitAction.reason,
state: jobStateTimeLimitAction.state,
state: jobStateTimeLimitAction.state ?? JobStateTimeLimitActionsState.RUNNABLE,
};
}
}
Expand Down
2 changes: 0 additions & 2 deletions packages/aws-cdk-lib/aws-batch/test/job-queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,8 @@ test('JobQueue with JobStateTimeLimitActions', () => {
state: JobStateTimeLimitActionsState.RUNNABLE,
},
{
action: JobStateTimeLimitActionsAction.CANCEL,
maxTimeSeconds: Duration.minutes(10),
reason: JobStateTimeLimitActionsReason.JOB_RESOURCE_REQUIREMENT,
state: JobStateTimeLimitActionsState.RUNNABLE,
},
],
});
Expand Down

0 comments on commit 6d610e6

Please sign in to comment.