Skip to content

Commit a55ec15

Browse files
committed
remove program copy
1 parent 630f782 commit a55ec15

File tree

6 files changed

+238
-1
lines changed

6 files changed

+238
-1
lines changed

localstack-core/localstack/services/stepfunctions/asl/component/state/state_execution/state_map/iteration/job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, job_program: Program, job_inputs: list[Any]):
5050

5151
self._jobs_number = len(job_inputs)
5252
self._open_jobs = [
53-
Job(job_index=job_index, job_program=copy.deepcopy(job_program), job_input=job_input)
53+
Job(job_index=job_index, job_program=job_program, job_input=job_input)
5454
for job_index, job_input in enumerate(job_inputs)
5555
]
5656
self._open_jobs.reverse()

tests/aws/services/stepfunctions/templates/scenarios/scenarios_templates.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class ScenariosTemplate(TemplateLoader):
8282
MAP_STATE_NESTED: Final[str] = os.path.join(
8383
_THIS_FOLDER, "statemachines/map_state_nested.json5"
8484
)
85+
MAP_STATE_NESTED_CONFIG_DISTRIBUTED: Final[str] = os.path.join(
86+
_THIS_FOLDER, "statemachines/map_state_nested_config_distributed.json5"
87+
)
8588
MAP_STATE_NO_PROCESSOR_CONFIG: Final[str] = os.path.join(
8689
_THIS_FOLDER, "statemachines/map_state_no_processor_config.json5"
8790
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"StartAt": "SetupState",
3+
"States": {
4+
"SetupState": {
5+
"Type": "Pass",
6+
"Result": {
7+
"values": [
8+
{
9+
"sub-values": [
10+
{
11+
"num": 1,
12+
"str": "A"
13+
},
14+
{
15+
"num": 2,
16+
"str": "B"
17+
}
18+
]
19+
}
20+
]
21+
},
22+
"Next": "MapState",
23+
},
24+
"MapState": {
25+
"Type": "Map",
26+
"MaxConcurrency": 1,
27+
"ItemsPath": "$.values",
28+
"ItemProcessor": {
29+
"ProcessorConfig": {
30+
"Mode": "DISTRIBUTED",
31+
"ExecutionType": "STANDARD",
32+
},
33+
"StartAt": "SubMapState",
34+
"States": {
35+
"SubMapState": {
36+
"Type": "Map",
37+
"MaxConcurrency": 1,
38+
"ItemsPath": "$.sub-values",
39+
"ResultPath": "$.result",
40+
"ItemProcessor": {
41+
"ProcessorConfig": {
42+
"Mode": "DISTRIBUTED",
43+
"ExecutionType": "STANDARD",
44+
},
45+
"StartAt": "SubMapStateSuccess",
46+
"States": {
47+
"SubMapStateSuccess": {
48+
"Type": "Succeed"
49+
}
50+
},
51+
},
52+
"End": true,
53+
}
54+
},
55+
},
56+
"End": true,
57+
},
58+
},
59+
}

tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,28 @@ def test_map_state_label(
13531353
exec_input,
13541354
)
13551355

1356+
@markers.aws.validated
1357+
@markers.snapshot.skip_snapshot_verify(paths=["$..events[8].previousEventId"])
1358+
def test_map_state_nested_config_distributed(
1359+
self,
1360+
aws_client,
1361+
create_state_machine_iam_role,
1362+
create_state_machine,
1363+
sfn_snapshot,
1364+
):
1365+
template = ST.load_sfn_template(ST.MAP_STATE_NESTED_CONFIG_DISTRIBUTED)
1366+
definition = json.dumps(template)
1367+
1368+
exec_input = json.dumps({})
1369+
create_and_record_execution(
1370+
aws_client,
1371+
create_state_machine_iam_role,
1372+
create_state_machine,
1373+
sfn_snapshot,
1374+
definition,
1375+
exec_input,
1376+
)
1377+
13561378
@markers.aws.validated
13571379
def test_map_state_result_writer(
13581380
self,

tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.snapshot.json

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24895,5 +24895,155 @@
2489524895
}
2489624896
}
2489724897
}
24898+
},
24899+
"tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_nested_config_distributed": {
24900+
"recorded-date": "13-12-2024, 13:38:16",
24901+
"recorded-content": {
24902+
"get_execution_history": {
24903+
"events": [
24904+
{
24905+
"executionStartedEventDetails": {
24906+
"input": {},
24907+
"inputDetails": {
24908+
"truncated": false
24909+
},
24910+
"roleArn": "snf_role_arn"
24911+
},
24912+
"id": 1,
24913+
"previousEventId": 0,
24914+
"timestamp": "timestamp",
24915+
"type": "ExecutionStarted"
24916+
},
24917+
{
24918+
"id": 2,
24919+
"previousEventId": 0,
24920+
"stateEnteredEventDetails": {
24921+
"input": {},
24922+
"inputDetails": {
24923+
"truncated": false
24924+
},
24925+
"name": "SetupState"
24926+
},
24927+
"timestamp": "timestamp",
24928+
"type": "PassStateEntered"
24929+
},
24930+
{
24931+
"id": 3,
24932+
"previousEventId": 2,
24933+
"stateExitedEventDetails": {
24934+
"name": "SetupState",
24935+
"output": {
24936+
"values": [
24937+
{
24938+
"sub-values": [
24939+
{
24940+
"num": 1,
24941+
"str": "A"
24942+
},
24943+
{
24944+
"num": 2,
24945+
"str": "B"
24946+
}
24947+
]
24948+
}
24949+
]
24950+
},
24951+
"outputDetails": {
24952+
"truncated": false
24953+
}
24954+
},
24955+
"timestamp": "timestamp",
24956+
"type": "PassStateExited"
24957+
},
24958+
{
24959+
"id": 4,
24960+
"previousEventId": 3,
24961+
"stateEnteredEventDetails": {
24962+
"input": {
24963+
"values": [
24964+
{
24965+
"sub-values": [
24966+
{
24967+
"num": 1,
24968+
"str": "A"
24969+
},
24970+
{
24971+
"num": 2,
24972+
"str": "B"
24973+
}
24974+
]
24975+
}
24976+
]
24977+
},
24978+
"inputDetails": {
24979+
"truncated": false
24980+
},
24981+
"name": "MapState"
24982+
},
24983+
"timestamp": "timestamp",
24984+
"type": "MapStateEntered"
24985+
},
24986+
{
24987+
"id": 5,
24988+
"mapStateStartedEventDetails": {
24989+
"length": 1
24990+
},
24991+
"previousEventId": 4,
24992+
"timestamp": "timestamp",
24993+
"type": "MapStateStarted"
24994+
},
24995+
{
24996+
"id": 6,
24997+
"mapRunStartedEventDetails": {
24998+
"mapRunArn": "arn:<partition>:states:<region>:111111111111:mapRun:<ArnPart_0idx>/<MapRunArnPart0_0idx>:<MapRunArnPart1_0idx>"
24999+
},
25000+
"previousEventId": 5,
25001+
"timestamp": "timestamp",
25002+
"type": "MapRunStarted"
25003+
},
25004+
{
25005+
"id": 7,
25006+
"previousEventId": 6,
25007+
"timestamp": "timestamp",
25008+
"type": "MapRunSucceeded"
25009+
},
25010+
{
25011+
"id": 8,
25012+
"previousEventId": 7,
25013+
"timestamp": "timestamp",
25014+
"type": "MapStateSucceeded"
25015+
},
25016+
{
25017+
"id": 9,
25018+
"previousEventId": 6,
25019+
"stateExitedEventDetails": {
25020+
"name": "MapState",
25021+
"output": "[{\"sub-values\":[{\"num\":1,\"str\":\"A\"},{\"num\":2,\"str\":\"B\"}],\"result\":[{\"num\":1,\"str\":\"A\"},{\"num\":2,\"str\":\"B\"}]}]",
25022+
"outputDetails": {
25023+
"truncated": false
25024+
}
25025+
},
25026+
"timestamp": "timestamp",
25027+
"type": "MapStateExited"
25028+
},
25029+
{
25030+
"executionSucceededEventDetails": {
25031+
"output": "[{\"sub-values\":[{\"num\":1,\"str\":\"A\"},{\"num\":2,\"str\":\"B\"}],\"result\":[{\"num\":1,\"str\":\"A\"},{\"num\":2,\"str\":\"B\"}]}]",
25032+
"outputDetails": {
25033+
"truncated": false
25034+
}
25035+
},
25036+
"id": 10,
25037+
"previousEventId": 9,
25038+
"timestamp": "timestamp",
25039+
"type": "ExecutionSucceeded"
25040+
}
25041+
],
25042+
"ResponseMetadata": {
25043+
"HTTPHeaders": {},
25044+
"HTTPStatusCode": 200
25045+
}
25046+
}
25047+
}
2489825048
}
2489925049
}

tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.validation.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@
278278
"tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_nested": {
279279
"last_validated_date": "2024-03-29T16:26:02+00:00"
280280
},
281+
"tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_nested_config_distributed": {
282+
"last_validated_date": "2024-12-13T13:38:16+00:00"
283+
},
281284
"tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_no_processor_config": {
282285
"last_validated_date": "2023-12-15T21:25:27+00:00"
283286
},

0 commit comments

Comments
 (0)