Skip to content

Commit 81f0bb1

Browse files
author
Alex Wang
committed
examples: update map concurrency config
- Update test case after we add early exit for concurrency - aws/aws-durable-execution-sdk-python#242
1 parent 4d19cb1 commit 81f0bb1

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

examples/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ def get_aws_config():
258258
def get_lambda_client():
259259
"""Get configured Lambda client."""
260260
config = get_aws_config()
261-
LambdaClient.load_preview_botocore_models()
262261
return boto3.client(
263262
"lambda",
264263
endpoint_url=config["lambda_endpoint"],

examples/test/map/test_map_completion.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Tests for map_completion."""
22

3-
import json
4-
53
import pytest
64

75
from src.map import map_completion
@@ -23,19 +21,11 @@ def test_reproduce_completion_config_behavior_with_detailed_logging(durable_runn
2321

2422
result_data = deserialize_operation_payload(result.result)
2523

26-
# 4 or 5 items are processed despite min_successful=2, which is expected due to the concurrent executor nature.
27-
# When the completion requirements are met and 2 items succeed, a completion event is set and the main thread
28-
# continues to cancel remaining futures. However, background threads cannot be stopped immediately since they're
29-
# not in the critical section. There's a gap between setting the completion_event and all futures actually stopping,
30-
# during which concurrent threads continue processing and increment counters. With max_concurrency=3 and 5 items,
31-
# 4 or 5 items may complete before the cancellation takes effect. This means >= 4 items are processed as expected
32-
# due to concurrency, with 4 or 5 items being typical in practice.
33-
#
24+
# 5 items are processed 2 of them succeeded. We exit early because min_successful is 2.
3425
# Additionally, failure_count shows 0 because failed items have retry strategies configured and are still retrying
3526
# when execution completes. Failures aren't finalized until retries complete, so they don't appear in the failure_count.
36-
37-
assert result_data["totalItems"] >= 4
38-
assert result_data["successfulCount"] >= 2
27+
assert result_data["totalItems"] == 5
28+
assert result_data["successfulCount"] == 2
3929
assert result_data["failedCount"] == 0
4030
assert result_data["hasFailures"] is False
4131
assert result_data["batchStatus"] == "BatchItemStatus.SUCCEEDED"

0 commit comments

Comments
 (0)