diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af1f916e4..5288b402e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,7 +159,7 @@ jobs: - run: poe lint - run: mkdir junit-xml - run: poe test -s --junit-xml=junit-xml/latest-deps.xml - timeout-minutes: 10 + timeout-minutes: 15 - name: "Upload junit-xml artifacts" uses: actions/upload-artifact@v4 if: always() diff --git a/temporalio/common.py b/temporalio/common.py index d328863ed..2f34c6387 100644 --- a/temporalio/common.py +++ b/temporalio/common.py @@ -69,7 +69,7 @@ def from_proto(proto: temporalio.api.common.v1.RetryPolicy) -> RetryPolicy: if proto.HasField("maximum_interval") else None, maximum_attempts=proto.maximum_attempts, - non_retryable_error_types=proto.non_retryable_error_types + non_retryable_error_types=list(proto.non_retryable_error_types) if proto.non_retryable_error_types else None, ) diff --git a/tests/test_common.py b/tests/test_common.py index 84dfc09b9..59a5ebbdf 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -8,6 +8,7 @@ import pytest from temporalio.api.common.v1 import Payload +from temporalio.api.common.v1 import RetryPolicy as RetryPolicyProto from temporalio.common import ( Priority, RawValue, @@ -123,3 +124,26 @@ def test_cant_construct_bad_priority(): Priority(priority_key=1.1) # type: ignore with pytest.raises(ValueError): Priority(priority_key=-1) + + +def test_retry_policy_from_proto_pickle(): + """Test that RetryPolicy.from_proto() creates a picklable object when non_retryable_error_types is set.""" + # Create a protobuf with non_retryable_error_types + proto = RetryPolicyProto() + proto.initial_interval.seconds = 1 + proto.backoff_coefficient = 2.0 + proto.maximum_attempts = 3 + proto.non_retryable_error_types.extend(["SomeError", "AnotherError"]) + + # Convert from proto + retry_policy = RetryPolicy.from_proto(proto) + + # This should not raise a PickleError + pickled = pickle.dumps(retry_policy) + unpickled = pickle.loads(pickled) + + # Verify the data is intact + assert unpickled.initial_interval == timedelta(seconds=1) + assert unpickled.backoff_coefficient == 2.0 + assert unpickled.maximum_attempts == 3 + assert unpickled.non_retryable_error_types == ["SomeError", "AnotherError"]