From 81f0bb13e69d7b5c28fe868f47b42a0c6b101c4f Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Tue, 9 Dec 2025 14:23:52 -0800 Subject: [PATCH] examples: update map concurrency config - Update test case after we add early exit for concurrency - https://github.com/aws/aws-durable-execution-sdk-python/pull/242 --- examples/cli.py | 1 - examples/test/map/test_map_completion.py | 16 +++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/examples/cli.py b/examples/cli.py index 689d8f0..81dd699 100755 --- a/examples/cli.py +++ b/examples/cli.py @@ -258,7 +258,6 @@ def get_aws_config(): def get_lambda_client(): """Get configured Lambda client.""" config = get_aws_config() - LambdaClient.load_preview_botocore_models() return boto3.client( "lambda", endpoint_url=config["lambda_endpoint"], diff --git a/examples/test/map/test_map_completion.py b/examples/test/map/test_map_completion.py index 5e672e3..f7bd850 100644 --- a/examples/test/map/test_map_completion.py +++ b/examples/test/map/test_map_completion.py @@ -1,7 +1,5 @@ """Tests for map_completion.""" -import json - import pytest from src.map import map_completion @@ -23,19 +21,11 @@ def test_reproduce_completion_config_behavior_with_detailed_logging(durable_runn result_data = deserialize_operation_payload(result.result) - # 4 or 5 items are processed despite min_successful=2, which is expected due to the concurrent executor nature. - # When the completion requirements are met and 2 items succeed, a completion event is set and the main thread - # continues to cancel remaining futures. However, background threads cannot be stopped immediately since they're - # not in the critical section. There's a gap between setting the completion_event and all futures actually stopping, - # during which concurrent threads continue processing and increment counters. With max_concurrency=3 and 5 items, - # 4 or 5 items may complete before the cancellation takes effect. This means >= 4 items are processed as expected - # due to concurrency, with 4 or 5 items being typical in practice. - # + # 5 items are processed 2 of them succeeded. We exit early because min_successful is 2. # Additionally, failure_count shows 0 because failed items have retry strategies configured and are still retrying # when execution completes. Failures aren't finalized until retries complete, so they don't appear in the failure_count. - - assert result_data["totalItems"] >= 4 - assert result_data["successfulCount"] >= 2 + assert result_data["totalItems"] == 5 + assert result_data["successfulCount"] == 2 assert result_data["failedCount"] == 0 assert result_data["hasFailures"] is False assert result_data["batchStatus"] == "BatchItemStatus.SUCCEEDED"