Skip to content

Commit a0f366b

Browse files
committed
Cleanup
1 parent 379ab27 commit a0f366b

File tree

8 files changed

+0
-136
lines changed

8 files changed

+0
-136
lines changed

scripts/_proto/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ COPY ./ ./
1010
RUN mkdir -p ./temporalio/api
1111
RUN uv add "protobuf<4"
1212
RUN uv sync --all-extras
13-
RUN poe build-develop
1413
RUN poe gen-protos
1514

1615
CMD cp -r ./temporalio/api/* /api_new && cp -r ./temporalio/bridge/proto/* /bridge_new

temporalio/bridge/worker.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
)
2121

2222
import google.protobuf.internal.containers
23-
from google.protobuf.message import Message
2423
from typing_extensions import TypeAlias
2524

2625
import temporalio.api.common.v1
@@ -278,94 +277,6 @@ async def finalize_shutdown(self) -> None:
278277
await ref.finalize_shutdown()
279278

280279

281-
# See https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-classes-that-are-generic-in-stubs-but-not-at-runtime
282-
if TYPE_CHECKING:
283-
PayloadContainer: TypeAlias = (
284-
google.protobuf.internal.containers.RepeatedCompositeFieldContainer[
285-
temporalio.api.common.v1.Payload
286-
]
287-
)
288-
else:
289-
PayloadContainer: TypeAlias = (
290-
google.protobuf.internal.containers.RepeatedCompositeFieldContainer
291-
)
292-
293-
294-
async def _apply_to_headers(
295-
headers: Mapping[str, temporalio.api.common.v1.Payload],
296-
cb: Callable[
297-
[Sequence[temporalio.api.common.v1.Payload]],
298-
Awaitable[List[temporalio.api.common.v1.Payload]],
299-
],
300-
) -> None:
301-
"""Apply API payload callback to headers."""
302-
for payload in headers.values():
303-
new_payload = (await cb([payload]))[0]
304-
payload.CopyFrom(new_payload)
305-
306-
307-
async def _decode_headers(
308-
headers: Mapping[str, temporalio.api.common.v1.Payload],
309-
codec: temporalio.converter.PayloadCodec,
310-
) -> None:
311-
"""Decode headers with the given codec."""
312-
return await _apply_to_headers(headers, codec.decode)
313-
314-
315-
async def _encode_headers(
316-
headers: Mapping[str, temporalio.api.common.v1.Payload],
317-
codec: temporalio.converter.PayloadCodec,
318-
) -> None:
319-
"""Encode headers with the given codec."""
320-
return await _apply_to_headers(headers, codec.encode)
321-
322-
323-
async def _apply_to_payloads(
324-
payloads: PayloadContainer,
325-
cb: Callable[
326-
[Sequence[temporalio.api.common.v1.Payload]],
327-
Awaitable[List[temporalio.api.common.v1.Payload]],
328-
],
329-
) -> None:
330-
"""Apply API payload callback to payloads."""
331-
if len(payloads) == 0:
332-
return
333-
new_payloads = await cb(payloads)
334-
if new_payloads is payloads:
335-
return
336-
del payloads[:]
337-
# TODO(cretz): Copy too expensive?
338-
payloads.extend(new_payloads)
339-
340-
341-
async def _apply_to_payload(
342-
payload: temporalio.api.common.v1.Payload,
343-
cb: Callable[
344-
[Sequence[temporalio.api.common.v1.Payload]],
345-
Awaitable[List[temporalio.api.common.v1.Payload]],
346-
],
347-
) -> None:
348-
"""Apply API payload callback to payload."""
349-
new_payload = (await cb([payload]))[0]
350-
payload.CopyFrom(new_payload)
351-
352-
353-
async def _decode_payloads(
354-
payloads: PayloadContainer,
355-
codec: temporalio.converter.PayloadCodec,
356-
) -> None:
357-
"""Decode payloads with the given codec."""
358-
return await _apply_to_payloads(payloads, codec.decode)
359-
360-
361-
async def _decode_payload(
362-
payload: temporalio.api.common.v1.Payload,
363-
codec: temporalio.converter.PayloadCodec,
364-
) -> None:
365-
"""Decode a payload with the given codec."""
366-
return await _apply_to_payload(payload, codec.decode)
367-
368-
369280
async def decode_activation(
370281
act: temporalio.bridge.proto.workflow_activation.WorkflowActivation,
371282
codec: temporalio.converter.PayloadCodec,

temporalio/worker/_workflow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ def _create_workflow_instance(
563563
extern_functions=self._extern_functions,
564564
disable_eager_activity_execution=self._disable_eager_activity_execution,
565565
worker_level_failure_exception_types=self._workflow_failure_exception_types,
566-
last_completion_result=init.last_completion_result,
567566
)
568567
if defn.sandboxed:
569568
return self._workflow_runner.create_instance(det)

temporalio/worker/_workflow_instance.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import temporalio.workflow
6565
from temporalio.service import __version__
6666

67-
from ..api.common.v1.message_pb2 import Payloads
6867
from ._interceptor import (
6968
ContinueAsNewInput,
7069
ExecuteWorkflowInput,
@@ -144,7 +143,6 @@ class WorkflowInstanceDetails:
144143
extern_functions: Mapping[str, Callable]
145144
disable_eager_activity_execution: bool
146145
worker_level_failure_exception_types: Sequence[Type[BaseException]]
147-
last_completion_result: Payloads
148146

149147

150148
class WorkflowInstance(ABC):
@@ -322,8 +320,6 @@ def __init__(self, det: WorkflowInstanceDetails) -> None:
322320
# metadata query
323321
self._current_details = ""
324322

325-
self._last_completion_result = det.last_completion_result
326-
327323
# The versioning behavior of this workflow, as established by annotation or by the dynamic
328324
# config function. Is only set once upon initialization.
329325
self._versioning_behavior: Optional[temporalio.common.VersioningBehavior] = None
@@ -1690,34 +1686,6 @@ def workflow_set_current_details(self, details: str):
16901686
self._assert_not_read_only("set current details")
16911687
self._current_details = details
16921688

1693-
def workflow_last_completion_result(
1694-
self, type_hint: Optional[Type]
1695-
) -> Optional[Any]:
1696-
print(
1697-
"workflow_last_completion_result: ",
1698-
self._last_completion_result,
1699-
type(self._last_completion_result),
1700-
"payload length:",
1701-
len(self._last_completion_result.payloads),
1702-
)
1703-
if len(self._last_completion_result.payloads) == 0:
1704-
return None
1705-
elif len(self._last_completion_result.payloads) > 1:
1706-
warnings.warn(
1707-
f"Expected single last completion result, got {len(self._last_completion_result.payloads)}"
1708-
)
1709-
return None
1710-
1711-
print("Payload:", self._last_completion_result.payloads[0])
1712-
if type_hint is None:
1713-
return self._payload_converter.from_payload(
1714-
self._last_completion_result.payloads[0]
1715-
)
1716-
else:
1717-
return self._payload_converter.from_payload(
1718-
self._last_completion_result.payloads[0], type_hint
1719-
)
1720-
17211689
#### Calls from outbound impl ####
17221690
# These are in alphabetical order and all start with "_outbound_".
17231691

@@ -2798,7 +2766,6 @@ def _apply_schedule_command(
27982766
v.start_to_close_timeout.FromTimedelta(self._input.start_to_close_timeout)
27992767
if self._input.retry_policy:
28002768
self._input.retry_policy.apply_to_proto(v.retry_policy)
2801-
28022769
v.cancellation_type = cast(
28032770
temporalio.bridge.proto.workflow_commands.ActivityCancellationType.ValueType,
28042771
int(self._input.cancellation_type),

temporalio/worker/workflow_sandbox/_runner.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import temporalio.worker._workflow_instance
1919
import temporalio.workflow
2020

21-
from ...api.common.v1.message_pb2 import Payloads
22-
2321
# Workflow instance has to be relative import
2422
from .._workflow_instance import (
2523
UnsandboxedWorkflowRunner,
@@ -86,7 +84,6 @@ def prepare_workflow(self, defn: temporalio.workflow._Definition) -> None:
8684
extern_functions={},
8785
disable_eager_activity_execution=False,
8886
worker_level_failure_exception_types=self._worker_level_failure_exception_types,
89-
last_completion_result=Payloads(),
9087
),
9188
)
9289

temporalio/workflow.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,6 @@ def workflow_get_current_details(self) -> str: ...
897897
@abstractmethod
898898
def workflow_set_current_details(self, details: str): ...
899899

900-
@abstractmethod
901-
def workflow_last_completion_result(
902-
self, type_hint: Optional[Type]
903-
) -> Optional[Any]: ...
904-
905900

906901
_current_update_info: contextvars.ContextVar[UpdateInfo] = contextvars.ContextVar(
907902
"__temporal_current_update_info"

tests/test_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import dataclasses
32
import json
43
import os

tests/worker/test_workflow.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8275,7 +8275,6 @@ async def test_workflow_headers_with_codec(
82758275
"Temporal",
82768276
id=f"workflow-{uuid.uuid4()}",
82778277
task_queue=worker.task_queue,
8278-
execution_timeout=timedelta(seconds=1),
82798278
)
82808279
assert await workflow_handle.result() == "Hello, Temporal!"
82818280

@@ -8289,7 +8288,6 @@ async def test_workflow_headers_with_codec(
82898288
SignalAndQueryWorkflow.run,
82908289
id=f"workflow-{uuid.uuid4()}",
82918290
task_queue=worker.task_queue,
8292-
execution_timeout=timedelta(seconds=1),
82938291
)
82948292

82958293
# Simple signals and queries
@@ -8329,4 +8327,3 @@ async def test_workflow_headers_with_codec(
83298327
assert headers["foo"].data == b"bar"
83308328
else:
83318329
assert headers["foo"].data != b"bar"
8332-
assert False

0 commit comments

Comments
 (0)