Skip to content
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 step concurrency level to EmrCreateCluster #15242

Merged
merged 26 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c5eb4fc
feat(aws-stepfunctions-tasks) set StepConcurrencyLevel when creating …
Jun 22, 2021
ba6a817
Merge branch 'master' into emr_step_concurrency_level
MousaZeidBaker Jun 22, 2021
70626ff
add test for StepConcurrencyLevel
Jun 22, 2021
7f396b2
update documentation
Jun 22, 2021
8e86cf5
validate release label when step Concurrency Level is specified
Jun 22, 2021
521d356
Merge branch 'master' into emr_step_concurrency_level
MousaZeidBaker Jun 22, 2021
c76f5d1
Merge branch 'master' into emr_step_concurrency_level
MousaZeidBaker Jun 23, 2021
98fe675
Merge branch 'master' into emr_step_concurrency_level
MousaZeidBaker Jul 5, 2021
a2a05ad
Update packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-c…
MousaZeidBaker Jul 12, 2021
2e1b333
Update packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-c…
MousaZeidBaker Jul 12, 2021
fec6016
Update packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-c…
MousaZeidBaker Jul 12, 2021
c1a951c
Update packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-c…
MousaZeidBaker Jul 12, 2021
20f1a8e
update dependencies
Jul 12, 2021
69e07df
complete unterminated string literal
BenChaimberg Jul 21, 2021
b745bb3
Merge remote-tracking branch 'origin/master' into emr_step_concurrenc…
BenChaimberg Jul 21, 2021
0f7a584
Merge branch 'master' into emr_step_concurrency_level
kaizencc Sep 30, 2021
0c9b7b9
incoporate PCR comments on stale PR.
kaizencc Sep 30, 2021
3b5151e
fix edge case where StepConcurrencyLevel set to 1
kaizencc Sep 30, 2021
d48052f
add README blurb
kaizencc Sep 30, 2021
88d9fd1
1 line change
kaizencc Sep 30, 2021
581ea13
add validateReleaseLabel to EmrCreateCluster
kaizencc Sep 30, 2021
020f1c4
add documentation for validateReleaseLabel
kaizencc Sep 30, 2021
3300891
add documentation for validateReleaseLabel
kaizencc Sep 30, 2021
8034932
Merge branch 'master' into emr_step_concurrency_level
kaizencc Sep 30, 2021
0e9382d
Merge branch 'master' into emr_step_concurrency_level
kaizencc Oct 1, 2021
4e75b74
Merge branch 'master' into emr_step_concurrency_level
mergify[bot] Oct 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ export interface EmrCreateClusterProps extends sfn.TaskStateBaseProps {
*/
readonly securityConfiguration?: string;

/**
* Specifies the step concurrency level to allow multiple steps to run in parallel
*
* Requires EMR release label 5.28.0 or above.
* Must be in range [1, 256].
*
* @default 1 - no step concurrency allowed
*/
readonly stepConcurrencyLevel?: number;

/**
* A list of tags to associate with a cluster and propagate to Amazon EC2 instances.
*
Expand Down Expand Up @@ -191,6 +201,18 @@ export class EmrCreateCluster extends sfn.TaskStateBase {
}

this.taskPolicies = this.createPolicyStatements(this._serviceRole, this._clusterRole, this._autoScalingRole);

if (this.props.stepConcurrencyLevel) {
kaizencc marked this conversation as resolved.
Show resolved Hide resolved
if (this.props.stepConcurrencyLevel < 1 || this.props.stepConcurrencyLevel > 256) {
throw new Error('Step concurrency level must be in range [1, 256]');
}
if (this.props.releaseLabel) {
const [major, minor] = this.props.releaseLabel.substr(4).split('.');
kaizencc marked this conversation as resolved.
Show resolved Hide resolved
if (Number(major) < 5 || (Number(major) === 5 && Number(minor) < 28)) {
throw new Error('Step concurrency is only supported in EMR release version 5.28.0 and above');
}
}
}
}

/**
Expand Down Expand Up @@ -252,6 +274,7 @@ export class EmrCreateCluster extends sfn.TaskStateBase {
ReleaseLabel: cdk.stringToCloudFormation(this.props.releaseLabel),
ScaleDownBehavior: cdk.stringToCloudFormation(this.props.scaleDownBehavior?.valueOf()),
SecurityConfiguration: cdk.stringToCloudFormation(this.props.securityConfiguration),
StepConcurrencyLevel: cdk.numberToCloudFormation(this.props.stepConcurrencyLevel),
...(this.props.tags ? this.renderTags(this.props.tags) : undefined),
VisibleToAllUsers: cdk.booleanToCloudFormation(this.visibleToAllUsers),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,54 @@ test('Create Cluster with clusterConfiguration Name from payload', () => {
});
});

test('Create Cluster with StepConcurrencyLevel', async () => {
// WHEN
const task = new EmrCreateCluster(stack, 'Task', {
instances: {},
clusterRole,
name: 'Cluster',
serviceRole,
autoScalingRole,
stepConcurrencyLevel: 2,
integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE,
});

// THEN
expect(stack.resolve(task.toStateJson())).toEqual({
kaizencc marked this conversation as resolved.
Show resolved Hide resolved
Type: 'Task',
Resource: {
'Fn::Join': [
'',
[
'arn:',
{
Ref: 'AWS::Partition',
},
':states:::elasticmapreduce:createCluster',
],
],
},
End: true,
Parameters: {
Name: 'Cluster',
Instances: {
KeepJobFlowAliveWhenNoSteps: true,
},
VisibleToAllUsers: true,
JobFlowRole: {
Ref: 'ClusterRoleD9CA7471',
},
ServiceRole: {
Ref: 'ServiceRole4288B192',
},
AutoScalingRole: {
Ref: 'AutoScalingRole015ADA0A',
},
StepConcurrencyLevel: 2,
},
});
});

test('Create Cluster with Tags', () => {
// WHEN
const task = new EmrCreateCluster(stack, 'Task', {
Expand Down