aws / aws/aws-cdk

(aws_stepfunctions_tasks): (execution_class in GlueStartJobRun is fixed and cannot be changed dynamically )

Open
#34,292 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-stepfunctions-tasks effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Currently, when using the aws_stepfunctions_tasks.GlueStartJobRun construct in CDK to deploy a Step Function that triggers AWS Glue jobs, the execution_class property is statically set, for example:

```python
aws_tasks.GlueStartJobRun(
scope,
f"Run SparkSQL in Glue - Job {job_number}",
glue_job_name=aws_sfn.JsonPath.string_at("$.glue_job"),
integration_pattern=aws_sfn.IntegrationPattern.RUN_JOB,
................
................
worker_configuration=aws_tasks.WorkerConfigurationProperty(
worker_type_v2=aws_tasks.WorkerTypeV2.of(
aws_sfn.JsonPath.string_at("$.worker_type")
),
number_of_workers=aws_sfn.JsonPath.number_at("$.num_workers"),
),
execution_class=aws_tasks.ExecutionClass.FLEX,
result_path=f"$.result_{job_number}",
output_path="$"
)
```

This results in the Step Function definition containing a hardcoded value for ExecutionClass:
```json
{
"Next": "NotifySuccess - 0",
"Type": "Task",
"OutputPath": "$",
"ResultPath": "$.result_0",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName.$": "$.glue_job",
"WorkerType.$": "$.worker_type",
"NumberOfWorkers.$": "$.num_workers",
"ExecutionClass": "FLEX"
}
}
```
In some scenarios, users may need to dynamically assign the ExecutionClass at runtime (e.g., based on an attribute passed via SNS or other event sources).
Currently, aws_stepfunctions_tasks does not provide a way to dynamically set ExecutionClass using a JSONPath (.$) binding. As a result, users must manually edit the Step Function definition after CDK deployment to achieve the intended behavior:
```json
{
"Next": "NotifySuccess - 0",
"Type": "Task",
"OutputPath": "$",
"ResultPath": "$.result_0",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName.$": "$.glue_job",
"WorkerType.$": "$.worker_type",
"NumberOfWorkers.$": "$.num_workers",
"ExecutionClass.$": "$.execution_class"
}
}
```

### Use Case

Please enhance the GlueStartJobRun construct to allow dynamic assignment of the execution_class property via JSONPath (e.g., execution_class=JsonPath.string_at("$.execution_class")) in the same way that properties like JobName and WorkerType already support dynamic input.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.173.4

### Environment details (OS name and version, etc.)

Debian GNU/Linux 12 (bookworm)

Contributor guide

Open the contributing guide

Research direction

Locate the TypeScript implementation of the GlueStartJobRun construct and inspect how execution_class is rendered in the synthesized Step Functions task definition. Verify the existing static value behavior, then confirm that a JSONPath input produces ExecutionClass.$ with the requested path while static values remain supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.