-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(stepfunctions-tasks): add timeout
parameter for EmrCreateCluster
#28532
Changes from 5 commits
ed0bb6e
0e25bf3
e06ab39
f3840cc
45b4a1b
ad29524
c1b020b
b42f6c8
6a8c4ae
5b49248
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -732,9 +732,24 @@ export namespace EmrCreateCluster { | |
/** | ||
* The spot provisioning timeout period in minutes. | ||
* | ||
* The value must be between 5 and 1440. | ||
* The value must be between 5 and 1440 minutes. | ||
* | ||
* @default - No timeoutDurationMinutes | ||
* | ||
* @deprecated - Use `timeout`. | ||
*/ | ||
readonly timeoutDurationMinutes?: number; | ||
|
||
/** | ||
* The spot provisioning timeout period in minutes. | ||
* | ||
* The value must be between 5 and 1440 minutes. | ||
* | ||
* You must specify one of `timeout` and `timeoutDurationMinutes`. | ||
* | ||
* @default - No timeout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default should be that we use the value in |
||
*/ | ||
readonly timeoutDurationMinutes: number; | ||
readonly timeout?: cdk.Duration; | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,14 +150,27 @@ function SpotProvisioningSpecificationPropertyToJson(property?: EmrCreateCluster | |
if (!property) { | ||
return undefined; | ||
} | ||
if (!cdk.Token.isUnresolved(property.timeoutDurationMinutes) && (property.timeoutDurationMinutes < 5 || property.timeoutDurationMinutes > 1440)) { | ||
throw new Error(`timeoutDurationMinutes must be between 5 and 1440, got ${property.timeoutDurationMinutes}`); | ||
|
||
if (!property.timeout && !property.timeoutDurationMinutes) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like treating if ((property.timeout && property.timeoutDurationMinutes) || (!property.timeout && !property.timeoutDurationMinutes)) { throw new Error() }
const timeout = property.timeout.toMinutes() ?? property.timeoutDurationMinutes;
if (!cdk.Token.isUnresolved(timeout) && timeout < 5 || timeout > 1440) { ... } |
||
throw new Error('timeout must be specified'); | ||
} | ||
if (property.timeout && (property.timeout.toMinutes() < 5 || property.timeout.toMinutes() > 1440)) { | ||
throw new Error(`timeout must be between 5 and 1440 minutes, got ${property.timeout.toMinutes()}`); | ||
} | ||
if ( | ||
!property.timeout // ignore validation because `timeoutDurationMinutes` is not used if a `timeout` is specified | ||
&& property.timeoutDurationMinutes | ||
&& !cdk.Token.isUnresolved(property.timeoutDurationMinutes) | ||
&& (property.timeoutDurationMinutes < 5 || property.timeoutDurationMinutes > 1440) | ||
) { | ||
throw new Error(`timeoutDurationMinutes must be between 5 and 1440 minutes, got ${property.timeoutDurationMinutes}`); | ||
} | ||
|
||
return { | ||
AllocationStrategy: cdk.stringToCloudFormation(property.allocationStrategy), | ||
BlockDurationMinutes: cdk.numberToCloudFormation(property.blockDurationMinutes), | ||
TimeoutAction: cdk.stringToCloudFormation(property.timeoutAction?.valueOf()), | ||
TimeoutDurationMinutes: cdk.numberToCloudFormation(property.timeoutDurationMinutes), | ||
TimeoutDurationMinutes: cdk.numberToCloudFormation(property.timeout?.toMinutes() || property.timeoutDurationMinutes), | ||
}; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default should be to use the value in
timeout
.