Skip to content

Commit e979ef0

Browse files
committed
Make local activities, worker sessions, and sticky execution portable
1 parent 3d016db commit e979ef0

8 files changed

Lines changed: 58 additions & 16 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9-
The Python SDK advances to prerelease `2.0.0-rc.36`. PyPI displays the normalized
10-
PEP 440 identity `2.0.0rc36`. This Avro-only SDK release is qualified with Server
11-
`2.0.0-rc.50`; JSON remains HTTP transport and is no longer a workflow payload
9+
The Python SDK advances to prerelease `2.0.0-rc.37`. PyPI displays the normalized
10+
PEP 440 identity `2.0.0rc37`. This Avro-only SDK release is qualified with Server
11+
`2.0.0-rc.51`; JSON remains HTTP transport and is no longer a workflow payload
1212
codec.
1313
Earlier SDK versions remain historical releases and are not alternate supported
1414
2.0 baselines; no prerelease compatibility shim is provided.
1515

1616
### Added
17+
- Worker registration now explicitly refuses local activities, worker
18+
sessions, and sticky execution at the portable worker-affinity protocol
19+
floor instead of advertising an unimplemented routing contract.
1720
- `WorkflowContext.message_stream()` now consumes named repeated input in
1821
ordered bounded batches. Runtime-owned cursor and wait metadata survives
1922
replay, worker replacement, server restart, duplicates, and continue-as-new

‎pyproject.toml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "durable-workflow"
7-
version = "2.0.0-rc.36"
7+
version = "2.0.0-rc.37"
88
description = "Release candidate Python SDK for the Durable Workflow 2.0 train"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -68,9 +68,9 @@ durable-workflow-replay-conformance = "durable_workflow.replay_conformance:main"
6868
durable-workflow-workflow-updates-conformance = "durable_workflow.workflow_updates_conformance:main"
6969

7070
[tool.durable-workflow]
71-
product-train = "2.0.0-rc.36"
72-
registry-version = "2.0.0rc36"
73-
supported-server-versions = "2.0.0-rc.50"
71+
product-train = "2.0.0-rc.37"
72+
registry-version = "2.0.0rc37"
73+
supported-server-versions = "2.0.0-rc.51"
7474
worker-protocol-version = "1.16"
7575
control-plane-version = "2"
7676
message-streams = true

‎src/durable_workflow/client.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@
6161

6262
PROTOCOL_VERSION = "1.16"
6363
CONTROL_PLANE_VERSION = "2"
64+
PORTABLE_WORKER_AFFINITY_CAPABILITY_MANIFEST: dict[str, dict[str, str | bool]] = {
65+
"local_activities": {
66+
"supported": False,
67+
"minimum_protocol_version": "1.18",
68+
"reason": "python_worker_does_not_execute_record_local_activity",
69+
},
70+
"worker_sessions": {
71+
"supported": False,
72+
"minimum_protocol_version": "1.18",
73+
"reason": "python_worker_has_no_typed_session_lifecycle",
74+
},
75+
"sticky_execution": {
76+
"supported": False,
77+
"minimum_protocol_version": "1.18",
78+
"reason": "python_worker_uses_complete_durable_history_replay",
79+
},
80+
}
6481
_MESSAGE_STREAMS_CAPABILITY = "message_streams"
6582
_MESSAGE_STREAMS_MINIMUM_WORKER_PROTOCOL = (1, 15)
6683
CONTROL_PLANE_REQUEST_CONTRACT_SCHEMA = "durable-workflow.v2.control-plane-request.contract"
@@ -4568,6 +4585,7 @@ async def register_worker(
45684585
sdk_version: str | None = None,
45694586
build_id: str | None = None,
45704587
capabilities: list[str] | None = None,
4588+
capability_manifest: dict[str, dict[str, Any]] | None = None,
45714589
task_slots: dict[str, int] | None = None,
45724590
process_metrics: dict[str, Any] | None = None,
45734591
heartbeat_interval_seconds: int | None = None,
@@ -4605,6 +4623,8 @@ async def register_worker(
46054623
body["workflow_command_contracts"] = workflow_command_contracts
46064624
if capabilities is not None:
46074625
body["capabilities"] = [capability for capability in capabilities if capability]
4626+
if capability_manifest is not None:
4627+
body["capability_manifest"] = capability_manifest
46084628
if build_id is not None:
46094629
body["build_id"] = build_id
46104630
if max_concurrent_workflow_tasks is not None:

‎src/durable_workflow/worker.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
CONTROL_PLANE_REQUEST_CONTRACT_SCHEMA,
4545
CONTROL_PLANE_REQUEST_CONTRACT_VERSION,
4646
CONTROL_PLANE_VERSION,
47+
PORTABLE_WORKER_AFFINITY_CAPABILITY_MANIFEST,
4748
PROTOCOL_VERSION,
4849
Client,
4950
WorkflowExecution,
@@ -1145,6 +1146,7 @@ async def _register(self) -> None:
11451146
max_concurrent_activity_tasks=self.max_concurrent_activity_tasks,
11461147
build_id=self.build_id,
11471148
capabilities=capabilities,
1149+
capability_manifest=PORTABLE_WORKER_AFFINITY_CAPABILITY_MANIFEST,
11481150
task_slots=self._current_task_slots(),
11491151
process_metrics=self._current_process_metrics(),
11501152
)

‎tests/test_pypi_project_surface.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424

2525
def source_metadata(*, stable: bool = False) -> SourceMetadata:
26-
version = "2.0.0" if stable else "2.0.0-rc.36"
27-
registry_version = "2.0.0" if stable else "2.0.0rc36"
26+
version = "2.0.0" if stable else "2.0.0-rc.37"
27+
registry_version = "2.0.0" if stable else "2.0.0rc37"
2828
return SourceMetadata(
2929
commit="a" * 40,
3030
name="durable-workflow",
@@ -226,7 +226,7 @@ def test_exact_pip_semantic_mismatch_fails_without_retrying(monkeypatch: pytest.
226226
)
227227
monkeypatch.setattr("scripts.check_pypi_project_surface.time.sleep", sleeps.append)
228228

229-
with pytest.raises(ProjectSurfaceError, match="pip selected 2.0.0rc24; expected 2.0.0rc36"):
229+
with pytest.raises(ProjectSurfaceError, match="pip selected 2.0.0rc24; expected 2.0.0rc37"):
230230
main(["--source-ref", "release-source", "--attempts", "30", "--interval-seconds", "10"])
231231

232232
assert requirements == [f"{source.name}=={source.registry_version}"]

‎tests/test_release_docs_source.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
REPO_ROOT = Path(__file__).resolve().parents[1]
77
VALIDATOR = REPO_ROOT / "scripts" / "ci" / "validate-release-docs-source.py"
8-
VERSION = "2.0.0-rc.36"
8+
VERSION = "2.0.0-rc.37"
99

1010

1111
def git(repo: Path, *arguments: str) -> str:

‎tests/test_release_metadata.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def source_metadata() -> SourceMetadata:
1818
return SourceMetadata(
1919
commit="a" * 40,
2020
name="durable-workflow",
21-
version="2.0.0-rc.36",
22-
registry_version="2.0.0rc36",
21+
version="2.0.0-rc.37",
22+
registry_version="2.0.0rc37",
2323
summary="Release candidate Python SDK for the Durable Workflow 2.0 train",
2424
classifiers=("Programming Language :: Python :: 3",),
2525
readme=(
@@ -36,10 +36,10 @@ def test_worker_release_identity_matches_supported_server_and_protocol() -> None
3636
project = manifest["project"]
3737
release = manifest["tool"]["durable-workflow"]
3838

39-
assert project["version"] == "2.0.0-rc.36"
39+
assert project["version"] == "2.0.0-rc.37"
4040
assert release["product-train"] == project["version"]
41-
assert release["registry-version"] == "2.0.0rc36"
42-
assert release["supported-server-versions"] == "2.0.0-rc.50"
41+
assert release["registry-version"] == "2.0.0rc37"
42+
assert release["supported-server-versions"] == "2.0.0-rc.51"
4343
assert release["worker-protocol-version"] == PROTOCOL_VERSION == "1.16"
4444

4545

‎tests/test_worker.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,23 @@ async def test_register(self, mock_client: AsyncMock) -> None:
400400
"query_tasks",
401401
MESSAGE_STREAMS_CAPABILITY,
402402
],
403+
"capability_manifest": {
404+
"local_activities": {
405+
"supported": False,
406+
"minimum_protocol_version": "1.18",
407+
"reason": "python_worker_does_not_execute_record_local_activity",
408+
},
409+
"worker_sessions": {
410+
"supported": False,
411+
"minimum_protocol_version": "1.18",
412+
"reason": "python_worker_has_no_typed_session_lifecycle",
413+
},
414+
"sticky_execution": {
415+
"supported": False,
416+
"minimum_protocol_version": "1.18",
417+
"reason": "python_worker_uses_complete_durable_history_replay",
418+
},
419+
},
403420
"task_slots": {
404421
"workflow_available": 10,
405422
"activity_available": 10,

0 commit comments

Comments
 (0)