Skip to content

Commit f4e74b7

Browse files
author
awstools
committed
feat(client-emr): adds fine grained control over Unhealthy Node Replacement to Amazon ElasticMapReduce
1 parent b7891d1 commit f4e74b7

12 files changed

+282
-2
lines changed

clients/client-emr/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,14 @@ SetTerminationProtection
596596

597597
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/emr/command/SetTerminationProtectionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/SetTerminationProtectionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/SetTerminationProtectionCommandOutput/)
598598

599+
</details>
600+
<details>
601+
<summary>
602+
SetUnhealthyNodeReplacement
603+
</summary>
604+
605+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/emr/command/SetUnhealthyNodeReplacementCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/SetUnhealthyNodeReplacementCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/SetUnhealthyNodeReplacementCommandOutput/)
606+
599607
</details>
600608
<details>
601609
<summary>

clients/client-emr/src/EMR.ts

+23
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ import {
223223
SetTerminationProtectionCommandInput,
224224
SetTerminationProtectionCommandOutput,
225225
} from "./commands/SetTerminationProtectionCommand";
226+
import {
227+
SetUnhealthyNodeReplacementCommand,
228+
SetUnhealthyNodeReplacementCommandInput,
229+
SetUnhealthyNodeReplacementCommandOutput,
230+
} from "./commands/SetUnhealthyNodeReplacementCommand";
226231
import {
227232
SetVisibleToAllUsersCommand,
228233
SetVisibleToAllUsersCommandInput,
@@ -305,6 +310,7 @@ const commands = {
305310
RunJobFlowCommand,
306311
SetKeepJobFlowAliveWhenNoStepsCommand,
307312
SetTerminationProtectionCommand,
313+
SetUnhealthyNodeReplacementCommand,
308314
SetVisibleToAllUsersCommand,
309315
StartNotebookExecutionCommand,
310316
StopNotebookExecutionCommand,
@@ -1066,6 +1072,23 @@ export interface EMR {
10661072
cb: (err: any, data?: SetTerminationProtectionCommandOutput) => void
10671073
): void;
10681074

1075+
/**
1076+
* @see {@link SetUnhealthyNodeReplacementCommand}
1077+
*/
1078+
setUnhealthyNodeReplacement(
1079+
args: SetUnhealthyNodeReplacementCommandInput,
1080+
options?: __HttpHandlerOptions
1081+
): Promise<SetUnhealthyNodeReplacementCommandOutput>;
1082+
setUnhealthyNodeReplacement(
1083+
args: SetUnhealthyNodeReplacementCommandInput,
1084+
cb: (err: any, data?: SetUnhealthyNodeReplacementCommandOutput) => void
1085+
): void;
1086+
setUnhealthyNodeReplacement(
1087+
args: SetUnhealthyNodeReplacementCommandInput,
1088+
options: __HttpHandlerOptions,
1089+
cb: (err: any, data?: SetUnhealthyNodeReplacementCommandOutput) => void
1090+
): void;
1091+
10691092
/**
10701093
* @see {@link SetVisibleToAllUsersCommand}
10711094
*/

clients/client-emr/src/EMRClient.ts

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ import {
186186
SetTerminationProtectionCommandInput,
187187
SetTerminationProtectionCommandOutput,
188188
} from "./commands/SetTerminationProtectionCommand";
189+
import {
190+
SetUnhealthyNodeReplacementCommandInput,
191+
SetUnhealthyNodeReplacementCommandOutput,
192+
} from "./commands/SetUnhealthyNodeReplacementCommand";
189193
import {
190194
SetVisibleToAllUsersCommandInput,
191195
SetVisibleToAllUsersCommandOutput,
@@ -268,6 +272,7 @@ export type ServiceInputTypes =
268272
| RunJobFlowCommandInput
269273
| SetKeepJobFlowAliveWhenNoStepsCommandInput
270274
| SetTerminationProtectionCommandInput
275+
| SetUnhealthyNodeReplacementCommandInput
271276
| SetVisibleToAllUsersCommandInput
272277
| StartNotebookExecutionCommandInput
273278
| StopNotebookExecutionCommandInput
@@ -328,6 +333,7 @@ export type ServiceOutputTypes =
328333
| RunJobFlowCommandOutput
329334
| SetKeepJobFlowAliveWhenNoStepsCommandOutput
330335
| SetTerminationProtectionCommandOutput
336+
| SetUnhealthyNodeReplacementCommandOutput
331337
| SetVisibleToAllUsersCommandOutput
332338
| StartNotebookExecutionCommandOutput
333339
| StopNotebookExecutionCommandOutput

clients/client-emr/src/commands/DescribeClusterCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export interface DescribeClusterCommandOutput extends DescribeClusterOutput, __M
9797
* // ReleaseLabel: "STRING_VALUE",
9898
* // AutoTerminate: true || false,
9999
* // TerminationProtected: true || false,
100+
* // UnhealthyNodeReplacement: true || false,
100101
* // VisibleToAllUsers: true || false,
101102
* // Applications: [ // ApplicationList
102103
* // { // Application

clients/client-emr/src/commands/DescribeJobFlowsCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export interface DescribeJobFlowsCommandOutput extends DescribeJobFlowsOutput, _
121121
* // },
122122
* // KeepJobFlowAliveWhenNoSteps: true || false,
123123
* // TerminationProtected: true || false,
124+
* // UnhealthyNodeReplacement: true || false,
124125
* // HadoopVersion: "STRING_VALUE",
125126
* // },
126127
* // Steps: [ // StepDetailList

clients/client-emr/src/commands/RunJobFlowCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ export interface RunJobFlowCommandOutput extends RunJobFlowOutput, __MetadataBea
212212
* },
213213
* KeepJobFlowAliveWhenNoSteps: true || false,
214214
* TerminationProtected: true || false,
215+
* UnhealthyNodeReplacement: true || false,
215216
* HadoopVersion: "STRING_VALUE",
216217
* Ec2SubnetId: "STRING_VALUE",
217218
* Ec2SubnetIds: [

clients/client-emr/src/commands/SetTerminationProtectionCommand.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface SetTerminationProtectionCommandOutput extends __MetadataBearer
4343
* <code>SetTerminationProtection</code> to <code>true</code>, you must first unlock the
4444
* job flow by a subsequent call to <code>SetTerminationProtection</code> in which you set the
4545
* value to <code>false</code>. </p>
46-
* <p> For more information, see<a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html">Managing Cluster
46+
* <p> For more information, see <a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html">Managing Cluster
4747
* Termination</a> in the <i>Amazon EMR Management Guide</i>. </p>
4848
* @example
4949
* Use a bare-bones client and the command you need to make an API call.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { EMRClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EMRClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { SetUnhealthyNodeReplacementInput } from "../models/models_0";
10+
import { de_SetUnhealthyNodeReplacementCommand, se_SetUnhealthyNodeReplacementCommand } from "../protocols/Aws_json1_1";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link SetUnhealthyNodeReplacementCommand}.
20+
*/
21+
export interface SetUnhealthyNodeReplacementCommandInput extends SetUnhealthyNodeReplacementInput {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link SetUnhealthyNodeReplacementCommand}.
26+
*/
27+
export interface SetUnhealthyNodeReplacementCommandOutput extends __MetadataBearer {}
28+
29+
/**
30+
* @public
31+
* <p>Specify whether to enable unhealthy node replacement, which lets Amazon EMR gracefully
32+
* replace core nodes on a cluster if any nodes become unhealthy. For example, a node becomes
33+
* unhealthy if disk usage is above 90%. If unhealthy node replacement is on and <code>TerminationProtected</code> are off,
34+
* Amazon EMR immediately terminates the unhealthy core nodes. To use unhealthy node replacement
35+
* and retain unhealthy core nodes, use to turn on
36+
* termination protection. In such cases, Amazon EMR adds
37+
* the unhealthy nodes to a denylist, reducing job interruptions and failures.</p>
38+
* <p>If unhealthy node replacement is on, Amazon EMR
39+
* notifies YARN and other applications on the cluster to stop scheduling tasks
40+
* with these nodes, moves the data, and then terminates the nodes.</p>
41+
* <p>For more information, see <a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_UnhealthyNodeReplacement.html">graceful
42+
* node replacement</a> in the <i>Amazon EMR Management Guide</i>.</p>
43+
* @example
44+
* Use a bare-bones client and the command you need to make an API call.
45+
* ```javascript
46+
* import { EMRClient, SetUnhealthyNodeReplacementCommand } from "@aws-sdk/client-emr"; // ES Modules import
47+
* // const { EMRClient, SetUnhealthyNodeReplacementCommand } = require("@aws-sdk/client-emr"); // CommonJS import
48+
* const client = new EMRClient(config);
49+
* const input = { // SetUnhealthyNodeReplacementInput
50+
* JobFlowIds: [ // XmlStringList // required
51+
* "STRING_VALUE",
52+
* ],
53+
* UnhealthyNodeReplacement: true || false, // required
54+
* };
55+
* const command = new SetUnhealthyNodeReplacementCommand(input);
56+
* const response = await client.send(command);
57+
* // {};
58+
*
59+
* ```
60+
*
61+
* @param SetUnhealthyNodeReplacementCommandInput - {@link SetUnhealthyNodeReplacementCommandInput}
62+
* @returns {@link SetUnhealthyNodeReplacementCommandOutput}
63+
* @see {@link SetUnhealthyNodeReplacementCommandInput} for command's `input` shape.
64+
* @see {@link SetUnhealthyNodeReplacementCommandOutput} for command's `response` shape.
65+
* @see {@link EMRClientResolvedConfig | config} for EMRClient's `config` shape.
66+
*
67+
* @throws {@link InternalServerError} (server fault)
68+
* <p>Indicates that an error occurred while processing the request and that the request was
69+
* not completed.</p>
70+
*
71+
* @throws {@link EMRServiceException}
72+
* <p>Base exception class for all service exceptions from EMR service.</p>
73+
*
74+
*/
75+
export class SetUnhealthyNodeReplacementCommand extends $Command
76+
.classBuilder<
77+
SetUnhealthyNodeReplacementCommandInput,
78+
SetUnhealthyNodeReplacementCommandOutput,
79+
EMRClientResolvedConfig,
80+
ServiceInputTypes,
81+
ServiceOutputTypes
82+
>()
83+
.ep({
84+
...commonParams,
85+
})
86+
.m(function (this: any, Command: any, cs: any, config: EMRClientResolvedConfig, o: any) {
87+
return [
88+
getSerdePlugin(config, this.serialize, this.deserialize),
89+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
90+
];
91+
})
92+
.s("ElasticMapReduce", "SetUnhealthyNodeReplacement", {})
93+
.n("EMRClient", "SetUnhealthyNodeReplacementCommand")
94+
.f(void 0, void 0)
95+
.ser(se_SetUnhealthyNodeReplacementCommand)
96+
.de(de_SetUnhealthyNodeReplacementCommand)
97+
.build() {}

clients/client-emr/src/commands/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export * from "./RemoveTagsCommand";
4848
export * from "./RunJobFlowCommand";
4949
export * from "./SetKeepJobFlowAliveWhenNoStepsCommand";
5050
export * from "./SetTerminationProtectionCommand";
51+
export * from "./SetUnhealthyNodeReplacementCommand";
5152
export * from "./SetVisibleToAllUsersCommand";
5253
export * from "./StartNotebookExecutionCommand";
5354
export * from "./StopNotebookExecutionCommand";

clients/client-emr/src/models/models_0.ts

+40
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,13 @@ export interface JobFlowInstancesDetail {
26892689
*/
26902690
TerminationProtected?: boolean;
26912691

2692+
/**
2693+
* @public
2694+
* <p>Indicates whether Amazon EMR should gracefully replace core nodes
2695+
* that have degraded within the cluster.</p>
2696+
*/
2697+
UnhealthyNodeReplacement?: boolean;
2698+
26922699
/**
26932700
* @public
26942701
* <p>The Hadoop version for the cluster.</p>
@@ -5765,6 +5772,25 @@ export interface SetTerminationProtectionInput {
57655772
TerminationProtected: boolean | undefined;
57665773
}
57675774

5775+
/**
5776+
* @public
5777+
*/
5778+
export interface SetUnhealthyNodeReplacementInput {
5779+
/**
5780+
* @public
5781+
* <p>The list of strings that uniquely identify the clusters for which to turn on
5782+
* unhealthy node replacement. You can get these identifiers by running the
5783+
* <a>RunJobFlow</a> or the <a>DescribeJobFlows</a> operations.</p>
5784+
*/
5785+
JobFlowIds: string[] | undefined;
5786+
5787+
/**
5788+
* @public
5789+
* <p>Indicates whether to turn on or turn off graceful unhealthy node replacement.</p>
5790+
*/
5791+
UnhealthyNodeReplacement: boolean | undefined;
5792+
}
5793+
57685794
/**
57695795
* @public
57705796
* <p>The input to the SetVisibleToAllUsers action.</p>
@@ -6209,6 +6235,13 @@ export interface Cluster {
62096235
*/
62106236
TerminationProtected?: boolean;
62116237

6238+
/**
6239+
* @public
6240+
* <p>Indicates whether Amazon EMR should gracefully replace Amazon EC2
6241+
* core instances that have degraded within the cluster.</p>
6242+
*/
6243+
UnhealthyNodeReplacement?: boolean;
6244+
62126245
/**
62136246
* @public
62146247
* <p>Indicates whether the cluster is visible to IAM principals in the Amazon Web Services account associated with the cluster. When <code>true</code>, IAM principals in the Amazon Web Services account can perform Amazon EMR cluster
@@ -7202,6 +7235,13 @@ export interface JobFlowInstancesConfig {
72027235
*/
72037236
TerminationProtected?: boolean;
72047237

7238+
/**
7239+
* @public
7240+
* <p>Indicates whether Amazon EMR should gracefully replace core nodes
7241+
* that have degraded within the cluster.</p>
7242+
*/
7243+
UnhealthyNodeReplacement?: boolean;
7244+
72057245
/**
72067246
* @public
72077247
* <p>Applies only to Amazon EMR release versions earlier than 4.0. The Hadoop version

clients/client-emr/src/protocols/Aws_json1_1.ts

+40
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ import {
158158
SetTerminationProtectionCommandInput,
159159
SetTerminationProtectionCommandOutput,
160160
} from "../commands/SetTerminationProtectionCommand";
161+
import {
162+
SetUnhealthyNodeReplacementCommandInput,
163+
SetUnhealthyNodeReplacementCommandOutput,
164+
} from "../commands/SetUnhealthyNodeReplacementCommand";
161165
import {
162166
SetVisibleToAllUsersCommandInput,
163167
SetVisibleToAllUsersCommandOutput,
@@ -319,6 +323,7 @@ import {
319323
SessionMappingSummary,
320324
SetKeepJobFlowAliveWhenNoStepsInput,
321325
SetTerminationProtectionInput,
326+
SetUnhealthyNodeReplacementInput,
322327
SetVisibleToAllUsersInput,
323328
ShrinkPolicy,
324329
SimpleScalingPolicyConfiguration,
@@ -982,6 +987,19 @@ export const se_SetTerminationProtectionCommand = async (
982987
return buildHttpRpcRequest(context, headers, "/", undefined, body);
983988
};
984989

990+
/**
991+
* serializeAws_json1_1SetUnhealthyNodeReplacementCommand
992+
*/
993+
export const se_SetUnhealthyNodeReplacementCommand = async (
994+
input: SetUnhealthyNodeReplacementCommandInput,
995+
context: __SerdeContext
996+
): Promise<__HttpRequest> => {
997+
const headers: __HeaderBag = sharedHeaders("SetUnhealthyNodeReplacement");
998+
let body: any;
999+
body = JSON.stringify(_json(input));
1000+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
1001+
};
1002+
9851003
/**
9861004
* serializeAws_json1_1SetVisibleToAllUsersCommand
9871005
*/
@@ -2019,6 +2037,23 @@ export const de_SetTerminationProtectionCommand = async (
20192037
return response;
20202038
};
20212039

2040+
/**
2041+
* deserializeAws_json1_1SetUnhealthyNodeReplacementCommand
2042+
*/
2043+
export const de_SetUnhealthyNodeReplacementCommand = async (
2044+
output: __HttpResponse,
2045+
context: __SerdeContext
2046+
): Promise<SetUnhealthyNodeReplacementCommandOutput> => {
2047+
if (output.statusCode >= 300) {
2048+
return de_CommandError(output, context);
2049+
}
2050+
await collectBody(output.body, context);
2051+
const response: SetUnhealthyNodeReplacementCommandOutput = {
2052+
$metadata: deserializeMetadata(output),
2053+
};
2054+
return response;
2055+
};
2056+
20222057
/**
20232058
* deserializeAws_json1_1SetVisibleToAllUsersCommand
20242059
*/
@@ -2504,6 +2539,7 @@ const se_JobFlowInstancesConfig = (input: JobFlowInstancesConfig, context: __Ser
25042539
ServiceAccessSecurityGroup: [],
25052540
SlaveInstanceType: [],
25062541
TerminationProtected: [],
2542+
UnhealthyNodeReplacement: [],
25072543
});
25082544
};
25092545

@@ -2721,6 +2757,8 @@ const se_ScalingTrigger = (input: ScalingTrigger, context: __SerdeContext): any
27212757

27222758
// se_SetTerminationProtectionInput omitted.
27232759

2760+
// se_SetUnhealthyNodeReplacementInput omitted.
2761+
27242762
// se_SetVisibleToAllUsersInput omitted.
27252763

27262764
// se_ShrinkPolicy omitted.
@@ -2890,6 +2928,7 @@ const de_Cluster = (output: any, context: __SerdeContext): Cluster => {
28902928
StepConcurrencyLevel: __expectInt32,
28912929
Tags: _json,
28922930
TerminationProtected: __expectBoolean,
2931+
UnhealthyNodeReplacement: __expectBoolean,
28932932
VisibleToAllUsers: __expectBoolean,
28942933
}) as any;
28952934
};
@@ -3438,6 +3477,7 @@ const de_JobFlowInstancesDetail = (output: any, context: __SerdeContext): JobFlo
34383477
Placement: _json,
34393478
SlaveInstanceType: __expectString,
34403479
TerminationProtected: __expectBoolean,
3480+
UnhealthyNodeReplacement: __expectBoolean,
34413481
}) as any;
34423482
};
34433483

0 commit comments

Comments
 (0)