Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion temporalio/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
tconley1428 marked this conversation as resolved.
if proto.non_retryable_error_types
else None,
)
Expand Down
24 changes: 24 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"]