Skip to content

Commit bc7e6dc

Browse files
committed
chore: remove unused invoke timeout
1 parent d238353 commit bc7e6dc

9 files changed

Lines changed: 45 additions & 53 deletions

File tree

src/aws_durable_execution_sdk_python/config.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,9 @@ class InvokeConfig(Generic[P, R]):
384384
Configuration for invoke operations.
385385
386386
This class configures how function invocations are executed, including
387-
timeout behavior, serialization, and tenant isolation.
387+
serialization and tenant isolation.
388388
389389
Args:
390-
timeout: Maximum duration to wait for the invoked function to complete.
391-
Default is no timeout. Use this to prevent long-running invocations
392-
from blocking execution indefinitely.
393-
394390
serdes_payload: Custom serialization/deserialization for the payload
395391
sent to the invoked function. Defaults to DEFAULT_JSON_SERDES when
396392
not set.
@@ -404,16 +400,10 @@ class InvokeConfig(Generic[P, R]):
404400
"""
405401

406402
# retry_strategy: Callable[[Exception, int], RetryDecision] | None = None
407-
timeout: Duration = field(default_factory=Duration)
408403
serdes_payload: SerDes[P] | None = None
409404
serdes_result: SerDes[R] | None = None
410405
tenant_id: str | None = None
411406

412-
@property
413-
def timeout_seconds(self) -> int:
414-
"""Get timeout in seconds."""
415-
return self.timeout.to_seconds()
416-
417407

418408
@dataclass(frozen=True)
419409
class CallbackConfig:

src/aws_durable_execution_sdk_python/operation/invoke.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def execute(self, _checkpointed_result: CheckpointedResult) -> R:
166166
ExecutionError: If suspend doesn't raise (should never happen)
167167
"""
168168
msg: str = f"Invoke {self.operation_identifier.operation_id} started, suspending for completion"
169-
suspend_with_optional_resume_delay(msg, self.config.timeout_seconds)
169+
suspend_with_optional_resume_delay(msg, None)
170170
# This line should never be reached since suspend_with_optional_resume_delay always raises
171171
error_msg: str = "suspend_with_optional_resume_delay should have raised an exception, but did not."
172172
raise ExecutionError(error_msg) from None

src/aws_durable_execution_sdk_python/serdes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,11 @@ def encode(self, obj: Any) -> EncodedValue:
316316
def decode(self, tag: TypeTag, value: Any) -> Any:
317317
match tag:
318318
case (
319-
TypeTag.NONE | TypeTag.STR | TypeTag.BOOL | TypeTag.INT | TypeTag.FLOAT
319+
TypeTag.NONE
320+
| TypeTag.STR
321+
| TypeTag.BOOL
322+
| TypeTag.INT
323+
| TypeTag.FLOAT
320324
):
321325
return self.primitive_codec.decode(tag, value)
322326
case TypeTag.BYTES:

tests/concurrency_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,9 +2833,9 @@ def task_func(ctx, item, idx, items):
28332833
# With tolerated_failure_count=1, executor stops when failure_count > 1 (at 2 failures)
28342834
# Executor terminates early rather than executing all 100 tasks
28352835
assert executed_count["value"] < 100
2836-
assert result.completion_reason == CompletionReason.FAILURE_TOLERANCE_EXCEEDED, (
2837-
executed_count
2838-
)
2836+
assert (
2837+
result.completion_reason == CompletionReason.FAILURE_TOLERANCE_EXCEEDED
2838+
), executed_count
28392839
assert sum(1 for item in result.all if item.status == BatchItemStatus.FAILED) == 2
28402840
assert (
28412841
sum(1 for item in result.all if item.status == BatchItemStatus.SUCCEEDED) < 98
@@ -2965,9 +2965,9 @@ def slow_branch():
29652965

29662966
# Slow branch may or may not have started (depends on thread scheduling)
29672967
# but it definitely should not have completed
2968-
assert operation_tracker.slow_completed.call_count == 0, (
2969-
"Executor should return before slow branch completes"
2970-
)
2968+
assert (
2969+
operation_tracker.slow_completed.call_count == 0
2970+
), "Executor should return before slow branch completes"
29712971

29722972
# Result should show MIN_SUCCESSFUL_REACHED
29732973
assert result.completion_reason == CompletionReason.MIN_SUCCESSFUL_REACHED
@@ -3019,9 +3019,9 @@ def slow_func():
30193019
result = executor.execute(execution_state, executor_context)
30203020

30213021
# Executor should have returned before slow branch completed
3022-
assert not slow_branch_mock.completed.called, (
3023-
"Executor should return before slow branch completes"
3024-
)
3022+
assert (
3023+
not slow_branch_mock.completed.called
3024+
), "Executor should return before slow branch completes"
30253025

30263026
# Result should show MIN_SUCCESSFUL_REACHED
30273027
assert result.completion_reason == CompletionReason.MIN_SUCCESSFUL_REACHED

tests/config_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ def test_invoke_config_defaults():
282282
"""Test InvokeConfig defaults."""
283283
config = InvokeConfig()
284284
assert config.tenant_id is None
285-
assert config.timeout_seconds == 0
286285

287286

288287
def test_invoke_config_with_tenant_id():

tests/context_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ def test_invoke_with_name_and_config(mock_executor_class):
616616
mock_state.durable_execution_arn = (
617617
"arn:aws:durable:us-east-1:123456789012:execution/test"
618618
)
619-
config = InvokeConfig[str, str](timeout=Duration.from_seconds(30))
619+
config = InvokeConfig[str, str]()
620620

621621
context = create_test_context(state=mock_state)
622622
[context._create_step_id() for _ in range(5)] # Set counter to 5 # noqa: SLF001
@@ -756,7 +756,6 @@ def test_invoke_with_custom_serdes(mock_executor_class):
756756
config = InvokeConfig[dict, dict](
757757
serdes_payload=payload_serdes,
758758
serdes_result=result_serdes,
759-
timeout=Duration.from_minutes(1),
760759
)
761760

762761
context = create_test_context(state=mock_state)

tests/operation/invoke_test.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def test_invoke_handler_already_started_with_timeout(status):
219219
mock_result = CheckpointedResult.create_from_operation(operation)
220220
mock_state.get_checkpoint_result.return_value = mock_result
221221

222-
config = InvokeConfig[str, str](timeout=Duration.from_seconds(30))
222+
config = InvokeConfig[str, str]()
223223

224-
with pytest.raises(TimedSuspendExecution):
224+
with pytest.raises(SuspendExecution):
225225
invoke_handler(
226226
function_name="test_function",
227227
payload="test_input",
@@ -246,7 +246,7 @@ def test_invoke_handler_new_operation():
246246
started = CheckpointedResult.create_from_operation(started_op)
247247
mock_state.get_checkpoint_result.side_effect = [not_found, started]
248248

249-
config = InvokeConfig[str, str](timeout=Duration.from_minutes(1))
249+
config = InvokeConfig[str, str]()
250250

251251
with pytest.raises(
252252
SuspendExecution, match="Invoke invoke8 started, suspending for completion"
@@ -285,9 +285,9 @@ def test_invoke_handler_new_operation_with_timeout():
285285
started = CheckpointedResult.create_from_operation(started_op)
286286
mock_state.get_checkpoint_result.side_effect = [not_found, started]
287287

288-
config = InvokeConfig[str, str](timeout=Duration.from_seconds(30))
288+
config = InvokeConfig[str, str]()
289289

290-
with pytest.raises(TimedSuspendExecution):
290+
with pytest.raises(SuspendExecution):
291291
invoke_handler(
292292
function_name="test_function",
293293
payload="test_input",
@@ -311,7 +311,7 @@ def test_invoke_handler_new_operation_no_timeout():
311311
started = CheckpointedResult.create_from_operation(started_op)
312312
mock_state.get_checkpoint_result.side_effect = [not_found, started]
313313

314-
config = InvokeConfig[str, str](timeout=Duration.from_seconds(0))
314+
config = InvokeConfig[str, str]()
315315

316316
with pytest.raises(SuspendExecution):
317317
invoke_handler(
@@ -1026,7 +1026,7 @@ def test_invoke_immediate_response_with_timeout_immediate_success():
10261026
succeeded = CheckpointedResult.create_from_operation(succeeded_op)
10271027
mock_state.get_checkpoint_result.side_effect = [not_found, succeeded]
10281028

1029-
config = InvokeConfig[str, str](timeout=Duration.from_seconds(30))
1029+
config = InvokeConfig[str, str]()
10301030

10311031
result = invoke_handler(
10321032
function_name="test_function",
@@ -1061,10 +1061,10 @@ def test_invoke_immediate_response_with_timeout_no_immediate_response():
10611061
started = CheckpointedResult.create_from_operation(started_op)
10621062
mock_state.get_checkpoint_result.side_effect = [not_found, started]
10631063

1064-
config = InvokeConfig[str, str](timeout=Duration.from_seconds(30))
1064+
config = InvokeConfig[str, str]()
10651065

1066-
# Verify operation suspends with timeout
1067-
with pytest.raises(TimedSuspendExecution):
1066+
# Verify operation suspends
1067+
with pytest.raises(SuspendExecution):
10681068
invoke_handler(
10691069
function_name="test_function",
10701070
payload="test_input",

tests/operation/wait_for_condition_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,9 @@ def wait_strategy(state, attempt):
662662
context_logger=mock_logger,
663663
)
664664

665-
assert captured_attempts[-1] == 2, (
666-
"After first retry (checkpoint.attempt=1), current attempt should be 2"
667-
)
665+
assert (
666+
captured_attempts[-1] == 2
667+
), "After first retry (checkpoint.attempt=1), current attempt should be 2"
668668

669669
# Test 3: After second retry (checkpoint has attempt=2)
670670
operation = Operation(
@@ -684,9 +684,9 @@ def wait_strategy(state, attempt):
684684
context_logger=mock_logger,
685685
)
686686

687-
assert captured_attempts[-1] == 3, (
688-
"After second retry (checkpoint.attempt=2), current attempt should be 3"
689-
)
687+
assert (
688+
captured_attempts[-1] == 3
689+
), "After second retry (checkpoint.attempt=2), current attempt should be 3"
690690

691691
# Test 4: After third retry (checkpoint has attempt=3)
692692
operation = Operation(
@@ -706,9 +706,9 @@ def wait_strategy(state, attempt):
706706
context_logger=mock_logger,
707707
)
708708

709-
assert captured_attempts[-1] == 4, (
710-
"After third retry (checkpoint.attempt=3), current attempt should be 4"
711-
)
709+
assert (
710+
captured_attempts[-1] == 4
711+
), "After third retry (checkpoint.attempt=3), current attempt should be 4"
712712

713713
# Verify the complete sequence is monotonically increasing
714714
assert captured_attempts == [

tests/state_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,9 @@ def test_checkpointed_result_is_timed_out_false_for_other_statuses():
608608
status=status,
609609
)
610610
result = CheckpointedResult.create_from_operation(operation)
611-
assert result.is_timed_out() is False, (
612-
f"is_timed_out should be False for status {status}"
613-
)
611+
assert (
612+
result.is_timed_out() is False
613+
), f"is_timed_out should be False for status {status}"
614614

615615

616616
def test_fetch_paginated_operations_with_marker():
@@ -2535,9 +2535,9 @@ def test_create_checkpoint_is_sync_false_returns_immediately():
25352535
elapsed_time = time.time() - start_time
25362536

25372537
# Verify it returns immediately (should be < 10ms, we allow 50ms for safety)
2538-
assert elapsed_time < 0.05, (
2539-
f"Async checkpoint took {elapsed_time:.3f}s, expected < 0.05s"
2540-
)
2538+
assert (
2539+
elapsed_time < 0.05
2540+
), f"Async checkpoint took {elapsed_time:.3f}s, expected < 0.05s"
25412541

25422542
# Verify operation was enqueued
25432543
assert state._checkpoint_queue.qsize() == 1
@@ -3115,9 +3115,9 @@ def background_processor():
31153115
# Verify all calls blocked for at least the delay time
31163116
for i in range(num_callers):
31173117
elapsed = end_times[i] - start_times[i]
3118-
assert elapsed >= 0.15, (
3119-
f"Caller {i} expected blocking for at least 0.15s, got {elapsed}s"
3120-
)
3118+
assert (
3119+
elapsed >= 0.15
3120+
), f"Caller {i} expected blocking for at least 0.15s, got {elapsed}s"
31213121

31223122

31233123
def test_create_checkpoint_sync_with_empty_checkpoint():

0 commit comments

Comments
 (0)