Skip to content

Commit 90dda94

Browse files
Add retrying of workflow validation errors only on python 3.10 (#1223)
* Add retrying of workflow validation errors only on python 3.10 * use session scoped shared state manager to ensure shutdown occurs. * run formatter
1 parent a48cece commit 90dda94

File tree

5 files changed

+348
-73
lines changed

5 files changed

+348
-73
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
- os: ubuntu-latest
3333
python: "3.10"
3434
protoCheckTarget: true
35+
- python: "3.10"
36+
pytestExtraArgs: "--reruns 3 --only-rerun \"RuntimeError: Failed validating workflow\""
3537
- os: ubuntu-arm
3638
runsOn: ubuntu-24.04-arm64-2-core
3739
- os: macos-intel

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ dev = [
5959
"openai-agents>=0.3,<0.5; python_version >= '3.14'",
6060
"openai-agents[litellm]>=0.3,<0.4; python_version < '3.14'",
6161
"googleapis-common-protos==1.70.0",
62+
"pytest-rerunfailures>=16.1",
6263
]
6364

6465
[tool.poe.tasks]

tests/conftest.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import pytest
88
import pytest_asyncio
99

10+
from temporalio.client import Client
11+
from temporalio.testing import WorkflowEnvironment
12+
from temporalio.worker import SharedStateManager
13+
from tests.helpers.worker import ExternalPythonWorker, ExternalWorker
14+
1015
from . import DEV_SERVER_DOWNLOAD_VERSION
1116

1217
# If there is an integration test environment variable set, we must remove the
@@ -38,10 +43,6 @@
3843
or protobuf_version.startswith("6.")
3944
), f"Expected protobuf 4.x/5.x/6.x, got {protobuf_version}"
4045

41-
from temporalio.client import Client
42-
from temporalio.testing import WorkflowEnvironment
43-
from tests.helpers.worker import ExternalPythonWorker, ExternalWorker
44-
4546

4647
def pytest_runtest_setup(item):
4748
"""Print a newline so that custom printed output starts on new line."""
@@ -134,6 +135,17 @@ async def env(env_type: str) -> AsyncGenerator[WorkflowEnvironment, None]:
134135
await env.shutdown()
135136

136137

138+
@pytest.fixture(scope="session")
139+
def shared_state_manager() -> Iterator[SharedStateManager]:
140+
mp_mgr = multiprocessing.Manager()
141+
mgr = SharedStateManager.create_from_multiprocessing(mp_mgr)
142+
143+
try:
144+
yield mgr
145+
finally:
146+
mp_mgr.shutdown()
147+
148+
137149
@pytest.fixture(scope="session")
138150
def mp_fork_ctx() -> Iterator[multiprocessing.context.BaseContext | None]:
139151
mp_ctx = None

0 commit comments

Comments
 (0)