From 7af879d5930c50f16294c9802804dc3f20dbc716 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Tue, 15 Sep 2026 15:35:51 -0700 Subject: [PATCH 01/51] Added the temporalio.streams interface with a provider registry. --- temporalio/streams/__init__.py | 143 +++++++++++++++ temporalio/streams/_frame.py | 72 ++++++++ temporalio/streams/_handles.py | 215 ++++++++++++++++++++++ temporalio/streams/_policy.py | 56 ++++++ temporalio/streams/_provider.py | 216 +++++++++++++++++++++++ temporalio/streams/_record.py | 90 ++++++++++ temporalio/streams/providers/__init__.py | 19 ++ 7 files changed, 811 insertions(+) create mode 100644 temporalio/streams/__init__.py create mode 100644 temporalio/streams/_frame.py create mode 100644 temporalio/streams/_handles.py create mode 100644 temporalio/streams/_policy.py create mode 100644 temporalio/streams/_provider.py create mode 100644 temporalio/streams/_record.py create mode 100644 temporalio/streams/providers/__init__.py diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py new file mode 100644 index 000000000..a25c2bdca --- /dev/null +++ b/temporalio/streams/__init__.py @@ -0,0 +1,143 @@ +"""A stream a workflow can read, decide on, and write. + +The contract, in five statements: + +1. **A workflow publishes only to its own stream, and it publishes + transactionally.** :meth:`StreamWriter.publish` returns without the record + being visible. The record appears when the workflow task is accepted, and + never if the task fails, so no reader can see a decision the workflow did + not commit. +2. **Reading is an observation, and the SDK records it.** What + :class:`StreamReader` handed to workflow code, including the boundary where + it found nothing, is committed with the commands that reading produced. + Recovery re-supplies the same records in the same order. +3. **Anything that does I/O publishes on its own account.** An activity, a + local activity, or an outside process writes through :func:`producer`, and + its records are visible as soon as they are written. It carries a producer + id, an attempt and a sequence so a retry can be told from a new generation. +4. **A cursor is opaque and belongs to its provider.** Hand it back to resume. + Do not compare two cursors or do arithmetic on one: one provider numbers + records with integers and another with a millisecond-and-sequence pair. +5. **A workflow names its streams relative to itself, and the provider + resolves them.** ``reader("inputs")`` is this workflow's inbound stream + called ``inputs``; ``writer("decisions")`` is a topic it publishes on. One + provider stores that as a namespace-level stream id and another as a name + under the run's chain key, and workflow code does not have to know which. + The provider itself is chosen when the worker is built. + +Outside a workflow there is no worker to carry the choice, so a process calls +:func:`configure` once before it opens a :func:`producer` or a +:func:`consumer`, and passes :func:`worker_options` to its ``Worker`` and +``Replayer``. Those two calls are where a provider is named. Nothing else in +this module mentions one. + +Reading somebody else's stream is out of scope for the first release. It is +the topology neither prototype has evidence for, and leaving it out is what +lets both of them implement the rest. + +What the contract does not promise: that a :attr:`RecordKind.FINISH` record +means the writing activity succeeded, that a superseded attempt's records can +be withdrawn, or that a stream outlives the retention its provider is +configured for. + +Prototype support for AI-198. The public names are the proposal; providers +live under :mod:`temporalio.streams.providers`, one module each, registered +by name and chosen by :func:`configure`. Everything else is shared. +""" + +from __future__ import annotations + +from datetime import timedelta +from typing import Any, TypeVar + +from temporalio.streams._handles import ReadSource, StreamReader, StreamWriter, WriteSink +from temporalio.streams._provider import ( + Consumer, + Producer, + StreamProvider, + configure, + consumer, + open_read, + open_write, + producer, + worker_options, +) +from temporalio.streams._record import ( + BEGINNING, + Cursor, + RecordKind, + StreamRecord, + Supersession, +) + +__all__ = [ + "BEGINNING", + "Consumer", + "Cursor", + "Producer", + "ReadSource", + "RecordKind", + "StreamProvider", + "StreamReader", + "StreamRecord", + "StreamWriter", + "Supersession", + "WriteSink", + "configure", + "consumer", + "producer", + "worker_options", + "reader", + "writer", +] + +T = TypeVar("T") + + +def reader( + stream: str, + *, + type: type | None = None, + topic: str | None = None, + start: Cursor = BEGINNING, + idle_timeout: timedelta | None = None, +) -> StreamReader[Any]: + """Subscribe this workflow to its inbound stream ``stream``. + + Each call is a separate subscription with its own cursor, so adding, + removing or reordering one renumbers the waits after it. Gate a change + behind :func:`temporalio.workflow.patched` as you would for a timer. + + Args: + stream: The inbound stream's name, relative to this workflow. + type: The value type, used as the decode hint. + topic: Only records on this topic, or every topic when omitted. + start: Where to start. Only honoured on the first subscription of a + run, because after that the recorded cursor decides. + idle_timeout: How long the workflow waits with nothing arriving before + the provider is allowed to release the worker. ``None`` takes the + provider's default. + """ + return StreamReader( + open_read(stream, start=start, idle_timeout=idle_timeout), + topic=topic, + type=type, + ) + + +def writer(topic: str, *, type: type | None = None) -> StreamWriter[Any]: + """Publish to ``topic`` on the stream this workflow owns. + + Args: + topic: The topic name. + type: Declared for symmetry with :func:`reader` and for documentation. + Encoding follows the value. + """ + del type + return StreamWriter(open_write(topic), topic) + + +# Importing the package registers every provider whose dependencies are +# present in this tree. Import order matters: the registry above must exist +# before a provider module can register with it. +from temporalio.streams import providers as _providers # noqa: E402,F401 diff --git a/temporalio/streams/_frame.py b/temporalio/streams/_frame.py new file mode 100644 index 000000000..c32811d32 --- /dev/null +++ b/temporalio/streams/_frame.py @@ -0,0 +1,72 @@ +"""The record envelope both bindings put on the wire. + +A provider stores an opaque body. The contract needs more than a body: which +topic a record belongs to, whether it is data or a terminal marker, and which +producer attempt wrote it. Neither prototype carries all of that in a channel +of its own, so the interface carries it here and each binding stores the result +as an ordinary body. + +Encoding is synchronous and deterministic because a workflow publishes on the +workflow thread. The header is JSON with sorted keys for that reason, and +because a stored record that a person can read is worth more during an +incident than a few saved bytes. +""" + +from __future__ import annotations + +import json +from typing import Any + +from temporalio.streams._record import RecordKind + +__all__ = ["decode", "encode"] + +_MAGIC = b"tsf1" + + +def encode( + *, + topic: str, + kind: RecordKind, + producer: str, + attempt: int, + sequence: int, + body: bytes, +) -> bytes: + """Wrap one already-encoded body with the contract's metadata.""" + header: dict[str, Any] = {"k": int(kind), "t": topic} + # Omitted rather than written as a default, so a workflow's own publish + # does not carry three fields that only mean something for a producer. + if producer: + header["p"] = producer + if attempt: + header["a"] = attempt + if sequence >= 0: + header["s"] = sequence + raw = json.dumps(header, sort_keys=True, separators=(",", ":")).encode() + return _MAGIC + len(raw).to_bytes(4, "big") + raw + body + + +def decode(frame: bytes) -> tuple[RecordKind, str, str, int, int, bytes]: + """Split a frame into ``(kind, topic, producer, attempt, sequence, body)``. + + Raises: + ValueError: The bytes are not a frame this interface wrote. Reading a + stream someone else populated is a real case, so it fails with a + name rather than an index error. + """ + if len(frame) < 8 or frame[:4] != _MAGIC: + raise ValueError( + "this record was not written through the stream interface, so its " + "topic and producer are unknown" + ) + size = int.from_bytes(frame[4:8], "big") + header = json.loads(frame[8 : 8 + size]) + return ( + RecordKind(header.get("k", int(RecordKind.DATA))), + header.get("t", ""), + header.get("p", ""), + int(header.get("a", 0)), + int(header.get("s", -1)), + frame[8 + size :], + ) diff --git a/temporalio/streams/_handles.py b/temporalio/streams/_handles.py new file mode 100644 index 000000000..a6dc9a073 --- /dev/null +++ b/temporalio/streams/_handles.py @@ -0,0 +1,215 @@ +"""The handles workflow code holds. + +Everything provider-specific sits behind the two protocols at the top. A +handle converts values, frames records, filters topics and synthesizes +supersession; a binding only moves bytes. +""" + +from __future__ import annotations + +from collections.abc import AsyncIterator +from typing import Any, Generic, Protocol, TypeVar + +from temporalio import workflow +from temporalio.api.common.v1 import Payload +from temporalio.streams import _frame +from temporalio.streams._policy import AttemptTracker +from temporalio.streams._record import Cursor, RecordKind, StreamRecord + +__all__ = ["ReadSource", "StreamReader", "StreamWriter", "WriteSink"] + +T = TypeVar("T") + + +class ReadSource(Protocol): + """One subscription, as a provider supplies it.""" + + async def next_batch(self) -> list[tuple[Cursor, bytes]]: + """The next records, waiting until there is at least one. + + A batch rather than a record because delivery boundaries are what a + provider actually records, and flattening them here keeps that out of + the contract. + + Raises: + StopAsyncIteration: This subscription has ended. + """ + ... + + def close(self) -> None: + """End the subscription. Idempotent.""" + ... + + +class WriteSink(Protocol): + """One topic on the stream the running workflow owns.""" + + async def publish(self, frame: bytes) -> None: + """Accept one framed record into this workflow task's output. + + Awaitable because a provider may hold the publisher back when its + batch is full. It does not mean the record is visible: it becomes + visible when the workflow task is accepted. + """ + ... + + +def _encode_value(value: Any) -> bytes: + converter = workflow.payload_converter() + payload = value if isinstance(value, Payload) else converter.to_payloads([value])[0] + return payload.SerializeToString() + + +def _decode_value(body: bytes, as_type: type | None) -> Any: + converter = workflow.payload_converter() + payload = Payload() + payload.ParseFromString(body) + if as_type is None: + return converter.from_payloads([payload])[0] + return converter.from_payloads([payload], [as_type])[0] + + +class StreamWriter(Generic[T]): + """Publishes to a topic on the stream this workflow owns. + + A workflow can only publish transactionally to a stream it owns, on both + providers. Writing to somebody else's stream is an activity's job, and it + gets the weaker guarantee that goes with doing I/O. + """ + + def __init__(self, sink: WriteSink, topic: str) -> None: + """Prefer :func:`temporalio.streams.writer`.""" + self._sink = sink + self._topic = topic + self._finished = False + + @property + def topic(self) -> str: + """The topic this writer is bound to.""" + return self._topic + + async def publish(self, value: T) -> None: + """Append ``value`` to this topic. + + Returning does not mean the record is visible. It becomes visible when + this workflow task is accepted, and never at all if the task fails, so + a reader cannot see a decision the workflow did not commit. + """ + if self._finished: + raise RuntimeError(f"topic {self._topic!r} was already finished") + await self._sink.publish( + _frame.encode( + topic=self._topic, + kind=RecordKind.DATA, + producer="", + attempt=0, + sequence=-1, + body=_encode_value(value), + ) + ) + + async def finish(self) -> None: + """Declare this topic complete. + + Says the writer has nothing more to send. It does not say the workflow + or the activity behind it succeeded, and a reader that treats it that + way will accept output from an attempt that later timed out. + """ + if self._finished: + return + self._finished = True + await self._sink.publish( + _frame.encode( + topic=self._topic, + kind=RecordKind.FINISH, + producer="", + attempt=0, + sequence=-1, + body=b"", + ) + ) + + +class StreamReader(Generic[T]): + """Reads a stream from inside workflow code. + + Iterating yields every kind of record, including the supersession the + reader synthesizes when a producer's newer attempt appears. Check + ``record.kind``, or use :meth:`values` when the workflow genuinely only + wants data. + """ + + def __init__( + self, + source: ReadSource, + *, + topic: str | None = None, + type: type | None = None, + ) -> None: + """Prefer :func:`temporalio.streams.reader`.""" + self._source = source + self._topic = topic + self._type = type + self._pending: list[StreamRecord[Any]] = [] + self._attempts = AttemptTracker() + self._closed = False + + def __aiter__(self) -> AsyncIterator[StreamRecord[T]]: + """Iterate records until the reader is closed.""" + return self._iterate() + + async def _iterate(self) -> AsyncIterator[StreamRecord[T]]: + while not self._closed: + try: + record = await self.next() + except StopAsyncIteration: + # The provider ended the subscription. Iteration stops rather + # than raising, so a workflow that reads to the end of a + # finished stream leaves the loop instead of failing its task. + return + yield record + + async def values(self) -> AsyncIterator[T]: + """Iterate the data values, dropping control records.""" + async for record in self: + if record.kind is RecordKind.DATA: + yield record.value + + async def next(self) -> StreamRecord[T]: + """The next record, waiting for one if there is none buffered. + + Raises: + StopAsyncIteration: The provider ended the subscription. + """ + while not self._pending: + await self._fill() + return self._pending.pop(0) + + async def _fill(self) -> None: + for cursor, frame in await self._source.next_batch(): + kind, topic, producer, attempt, sequence, body = _frame.decode(frame) + if self._topic is not None and topic != self._topic: + continue + superseded = self._attempts.note(producer, attempt, cursor) + if superseded is not None: + self._pending.append(superseded) + self._pending.append( + StreamRecord( + value=( + _decode_value(body, self._type) + if kind is RecordKind.DATA + else None + ), + cursor=cursor, + kind=kind, + topic=topic, + producer=producer, + attempt=attempt, + sequence=sequence, + ) + ) + + def close(self) -> None: + """End the subscription. Idempotent.""" + self._closed = True + self._source.close() diff --git a/temporalio/streams/_policy.py b/temporalio/streams/_policy.py new file mode 100644 index 000000000..24e20ab2f --- /dev/null +++ b/temporalio/streams/_policy.py @@ -0,0 +1,56 @@ +"""Turning a producer's newer attempt into something a reader can act on. + +An activity that streams half an answer and then fails leaves those records in +the stream. Its retry calls the model again and writes different words. No +provider can undo the first half, and a workflow that already acted on it has +committed that decision, so the honest thing is to tell the reader that a new +attempt began and let the application decide. + +This runs in the reader over records it already observed, so it costs no round +trip and replays without the provider being involved. +""" + +from __future__ import annotations + +from temporalio.streams._record import ( + Cursor, + RecordKind, + StreamRecord, + Supersession, +) + +__all__ = ["AttemptTracker"] + + +class AttemptTracker: + """Watches producer attempts on one subscription.""" + + def __init__(self) -> None: + self._attempts: dict[str, int] = {} + + def note( + self, producer: str, attempt: int, cursor: Cursor + ) -> StreamRecord[Supersession] | None: + """A supersession record when this record starts a newer attempt. + + A producer that declares no attempt supersedes nothing, because there + is no generation to compare. That is the same answer as an unnumbered + record: the interface reports what it was told and invents nothing. + """ + if not producer or attempt <= 0: + return None + previous = self._attempts.get(producer, 0) + if attempt <= previous: + return None + self._attempts[producer] = attempt + if previous == 0: + return None + return StreamRecord( + value=Supersession( + producer=producer, previous_attempt=previous, attempt=attempt + ), + cursor=cursor, + kind=RecordKind.SUPERSEDED, + producer=producer, + attempt=attempt, + ) diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py new file mode 100644 index 000000000..58282cc55 --- /dev/null +++ b/temporalio/streams/_provider.py @@ -0,0 +1,216 @@ +"""The provider registry: where a process names its stream provider. + +A provider only moves bytes. The handles, records, framing and supersession +around it are shared, so every provider module is small: it implements +:class:`StreamProvider` and registers a factory under a short name when it is +imported. One :func:`configure` call decides which factory serves this +process; when exactly one provider is registered, it is the default and the +call can be omitted. +""" + +from __future__ import annotations + +from collections.abc import AsyncIterator +from datetime import timedelta +from typing import Any, Callable, Protocol + +from temporalio.streams._handles import ReadSource, WriteSink +from temporalio.streams._record import BEGINNING, Cursor, StreamRecord + +__all__ = [ + "Consumer", + "Producer", + "StreamProvider", + "configure", + "consumer", + "open_read", + "open_write", + "producer", + "register", + "registered", + "worker_options", +] + + +class Producer(Protocol): + """Appends to a stream from outside workflow code. + + Every append is visible as soon as the provider accepts it, and carries + the producer id, attempt and sequence that let a reader tell a retried + append from a new generation. + """ + + @property + def attempt(self) -> int: + """The generation this producer is writing.""" + ... + + async def append(self, *values: Any) -> Cursor: + """Append values and return where the first one landed.""" + ... + + async def finish(self) -> None: + """Declare this producer's output complete.""" + ... + + +class Consumer(Protocol): + """Reads a stream from outside workflow code, resumably.""" + + def read( + self, + *, + start: Cursor = BEGINNING, + topic: str | None = None, + type: type | None = None, + ) -> AsyncIterator[StreamRecord[Any]]: + """Yield records from ``start`` as they arrive.""" + ... + + +class StreamProvider(Protocol): + """What a provider module implements. + + The workflow-side pair (:meth:`open_read`, :meth:`open_write`) runs inside + workflow code and must keep the contract's first two rules: publishes + commit with the workflow task, and reads are recorded observations. The + outside pair (:meth:`producer`, :meth:`consumer`) runs anywhere and moves + framed bytes. A transport-only provider may serve just the outside pair + and raise on the workflow side, naming the provider a worker should use. + """ + + name: str + + def configure(self, **options: Any) -> None: + """Accept this provider's process-level options.""" + ... + + def worker_options(self) -> dict[str, Any]: + """What a ``Worker`` or ``Replayer`` needs to serve this provider.""" + ... + + def open_read( + self, + stream: str, + *, + start: Cursor = BEGINNING, + idle_timeout: timedelta | None = None, + ) -> ReadSource: + """Subscribe the running workflow to its inbound stream ``stream``.""" + ... + + def open_write(self, topic: str) -> WriteSink: + """Bind ``topic`` on the stream the running workflow owns.""" + ... + + async def producer( + self, + client: Any, + *, + workflow_id: str, + stream: str, + producer_id: str = "", + attempt: int = 0, + ) -> Producer: + """Open a producer for ``workflow_id``'s inbound stream ``stream``.""" + ... + + async def consumer( + self, client: Any, *, workflow_id: str, stream: str = "" + ) -> Consumer: + """Open a reader for what ``workflow_id`` publishes.""" + ... + + +_factories: dict[str, Callable[[], StreamProvider]] = {} +_active: StreamProvider | None = None + + +def register(name: str, factory: Callable[[], StreamProvider]) -> None: + """Make ``factory`` selectable as ``configure(provider=name)``.""" + _factories[name] = factory + + +def registered() -> list[str]: + """The provider names this process can configure.""" + return sorted(_factories) + + +def _make(name: str | None) -> StreamProvider: + if name is None: + if len(_factories) == 1: + name = next(iter(_factories)) + else: + raise RuntimeError( + "name a provider: configure(provider=...) with one of " + f"{registered()}" + ) + factory = _factories.get(name) + if factory is None: + raise RuntimeError( + f"no stream provider {name!r} is registered; available: {registered()}" + ) + return factory() + + +def configure(provider: str | None = None, **options: Any) -> None: + """Name the provider for this process and hand it its options. + + ``provider`` may be omitted when exactly one provider is registered. + """ + global _active + chosen = _make(provider) + chosen.configure(**options) + _active = chosen + + +def _current() -> StreamProvider: + global _active + if _active is None: + chosen = _make(None) + chosen.configure() + _active = chosen + return _active + + +def worker_options() -> dict[str, Any]: + """What a ``Worker`` or ``Replayer`` needs to serve this provider.""" + return _current().worker_options() + + +def open_read( + stream: str, + *, + start: Cursor = BEGINNING, + idle_timeout: timedelta | None = None, +) -> ReadSource: + """Subscribe the running workflow to its inbound stream ``stream``.""" + return _current().open_read(stream, start=start, idle_timeout=idle_timeout) + + +def open_write(topic: str) -> WriteSink: + """Bind ``topic`` on the stream the running workflow owns.""" + return _current().open_write(topic) + + +async def producer( + client: Any, + *, + workflow_id: str, + stream: str, + producer_id: str = "", + attempt: int = 0, +) -> Producer: + """Open a producer for the inbound stream ``stream`` of ``workflow_id``.""" + return await _current().producer( + client, + workflow_id=workflow_id, + stream=stream, + producer_id=producer_id, + attempt=attempt, + ) + + +async def consumer(client: Any, *, workflow_id: str, stream: str = "") -> Consumer: + """Open a reader for what ``workflow_id`` publishes.""" + return await _current().consumer(client, workflow_id=workflow_id, stream=stream) diff --git a/temporalio/streams/_record.py b/temporalio/streams/_record.py new file mode 100644 index 000000000..d458ef0c4 --- /dev/null +++ b/temporalio/streams/_record.py @@ -0,0 +1,90 @@ +"""The value types the stream contract is expressed in. + +Nothing here touches Temporal or a provider, so both bindings share it +unchanged. +""" + +from __future__ import annotations + +import enum +from dataclasses import dataclass +from typing import Generic, TypeVar + +__all__ = [ + "BEGINNING", + "Cursor", + "RecordKind", + "StreamRecord", + "Supersession", +] + +T = TypeVar("T") + + +@enum.unique +class RecordKind(enum.IntEnum): + """What a record is.""" + + DATA = 1 + """Carries a value published by a workflow or a producer.""" + + FINISH = 2 + """The writer of this topic declared it complete. + + Separate from the activity or workflow that wrote it having succeeded. A + reader that treats it as proof of success is wrong: the activity can still + time out after writing it. + """ + + SUPERSEDED = 3 + """A later attempt of the same producer started writing. + + Synthesized by the reader from what it observed, so both providers deliver + it identically and replay reproduces it without the provider's help. + """ + + +@dataclass(frozen=True) +class Cursor: + """A position in a stream, ordered by its provider rather than by value. + + Opaque on purpose. One provider numbers records with integers and another + with a millisecond-and-sequence pair, so comparing tokens here would be + right for one and wrong for the other. Hand a cursor back to resume from + it; ask the reader to compare two. + """ + + token: str + + def __str__(self) -> str: + """The provider's position token.""" + return self.token + + +BEGINNING = Cursor("") +"""Read from the oldest record the stream still retains.""" + + +@dataclass(frozen=True) +class Supersession: + """The body of a :attr:`RecordKind.SUPERSEDED` record.""" + + producer: str + previous_attempt: int + attempt: int + + +@dataclass(frozen=True) +class StreamRecord(Generic[T]): + """One record as workflow code sees it.""" + + value: T + cursor: Cursor + kind: RecordKind = RecordKind.DATA + topic: str = "" + producer: str = "" + """Who wrote it, or empty when the owning workflow wrote it itself.""" + attempt: int = 0 + """The producer's attempt, or 0 when it did not declare one.""" + sequence: int = -1 + """The producer's position within its attempt, or -1 when unnumbered.""" diff --git a/temporalio/streams/providers/__init__.py b/temporalio/streams/providers/__init__.py new file mode 100644 index 000000000..dff94b250 --- /dev/null +++ b/temporalio/streams/providers/__init__.py @@ -0,0 +1,19 @@ +"""Stream providers, one module each. + +Importing this package registers every provider whose dependencies are +present. A tree that lacks a provider's dependencies simply does not offer +that name; nothing else changes, because everything above the provider is +shared. +""" + +from __future__ import annotations + +_KNOWN = ("memory", "workflow_streams", "native", "redis", "nexus") + +for _name in _KNOWN: + try: + __import__(f"{__name__}.{_name}") + except ImportError: + # This tree does not carry that provider. The registry error message + # lists what is actually available. + pass From c2f0251b4542d43c9ab3881b527c9d26b1477c30 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Tue, 15 Sep 2026 15:35:51 -0700 Subject: [PATCH 02/51] Added the in-memory reference provider and the conformance tests. --- temporalio/streams/providers/memory.py | 315 ++++++++++++++++++++++ tests/streams/__init__.py | 0 tests/streams/test_streams_conformance.py | 164 +++++++++++ 3 files changed, 479 insertions(+) create mode 100644 temporalio/streams/providers/memory.py create mode 100644 tests/streams/__init__.py create mode 100644 tests/streams/test_streams_conformance.py diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py new file mode 100644 index 000000000..808a84f13 --- /dev/null +++ b/temporalio/streams/providers/memory.py @@ -0,0 +1,315 @@ +"""The in-process reference provider. + +Exists so the conformance suite can exercise the whole surface without a +store, and to document in one file what a provider owes. Two honest limits, +both stated so nobody mistakes this for evidence: + +- It is not replay-safe. Workflow-side state lives in plain process memory, + so run it with a warm workflow cache and do not use it to demonstrate + recovery. +- A workflow's publish becomes visible at ``publish`` time rather than at + task acceptance, so it only approximates rule 1 of the contract. + +The outside surface (producer, consumer, dedupe, supersession, cursors) is +faithful, which is what the conformance tests lean on. +""" + +from __future__ import annotations + +import asyncio +from collections.abc import AsyncIterator +from datetime import timedelta +from typing import Any + +import temporalio.converter +from temporalio import workflow +from temporalio.api.common.v1 import Payload +from temporalio.streams import _frame, _provider +from temporalio.streams._handles import ReadSource, WriteSink +from temporalio.streams._policy import AttemptTracker +from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord + +_DEFAULT_POLL = timedelta(milliseconds=100) + + +class _MemoryStream: + def __init__(self) -> None: + self.frames: list[bytes] = [] + # Dedupe identity is (producer#attempt, first sequence of the append), + # the same pair the storage providers use. + self.seen: dict[tuple[str, int], int] = {} + self._arrival = asyncio.Event() + + def append(self, frames: list[bytes], *, producer_id: str, sequence: int) -> int: + key = (producer_id, sequence) + already = self.seen.get(key) + if already is not None: + return already + offset = len(self.frames) + self.frames.extend(frames) + self.seen[key] = offset + arrival, self._arrival = self._arrival, asyncio.Event() + arrival.set() + return offset + + async def wait_past(self, offset: int) -> None: + while len(self.frames) <= offset: + await self._arrival.wait() + + +_streams: dict[str, _MemoryStream] = {} + + +def _stream(stream_id: str) -> _MemoryStream: + found = _streams.get(stream_id) + if found is None: + found = _streams[stream_id] = _MemoryStream() + return found + + +def reset() -> None: + """Drop every stream. For tests.""" + _streams.clear() + + +def _inbound_id(workflow_id: str, stream: str) -> str: + return f"{workflow_id}:{stream}" if stream else workflow_id + + +def _converter(client: Any) -> Any: + if client is None: + return temporalio.converter.DataConverter.default.payload_converter + return client.data_converter.payload_converter + + +class _MemReadSource: + """Workflow-side read that wakes by polling a timer. + + A real provider wakes the workflow by delivering; polling is the price of + having no delivery path, and it is why this provider is for tests. + """ + + def __init__(self, store: _MemoryStream, start: int, poll: timedelta) -> None: + self._store = store + self._cursor = start + self._poll = poll + self._closed = False + + async def next_batch(self) -> list[tuple[Cursor, bytes]]: + while not self._closed: + frames = self._store.frames + if len(frames) > self._cursor: + batch = [ + (Cursor(str(offset)), frames[offset]) + for offset in range(self._cursor, len(frames)) + ] + self._cursor = len(frames) + return batch + await workflow.sleep(self._poll) + raise StopAsyncIteration + + def close(self) -> None: + self._closed = True + + +class _MemWriteSink: + def __init__(self, store: _MemoryStream, topic: str) -> None: + self._store = store + self._topic = topic + self._sequence = 0 + + async def publish(self, frame: bytes) -> None: + self._store.append( + [frame], + producer_id=f"__workflow__:{self._topic}", + sequence=self._sequence, + ) + self._sequence += 1 + + +class MemoryProducer: + """The outside producer, faithful to the contract.""" + + def __init__( + self, store: _MemoryStream, converter: Any, topic: str, producer_id: str, attempt: int + ) -> None: + self._store = store + self._converter = converter + self._topic = topic + self._producer_id = producer_id + self._attempt = attempt + self._sequence = 0 + + @property + def attempt(self) -> int: + return self._attempt + + @property + def _provider_id(self) -> str: + return ( + f"{self._producer_id}#{self._attempt}" if self._attempt else self._producer_id + ) + + async def append(self, *values: Any) -> Cursor: + frames = [] + for value in values: + frames.append( + _frame.encode( + topic=self._topic, + kind=RecordKind.DATA, + producer=self._producer_id, + attempt=self._attempt, + sequence=self._sequence, + body=self._encode(value), + ) + ) + self._sequence += 1 + offset = self._store.append( + frames, + producer_id=self._provider_id, + sequence=self._sequence - len(frames), + ) + return Cursor(str(offset)) + + async def finish(self) -> None: + frame = _frame.encode( + topic=self._topic, + kind=RecordKind.FINISH, + producer=self._producer_id, + attempt=self._attempt, + sequence=self._sequence, + body=b"", + ) + self._sequence += 1 + self._store.append( + [frame], producer_id=self._provider_id, sequence=self._sequence - 1 + ) + + def _encode(self, value: Any) -> bytes: + payload = ( + value + if isinstance(value, Payload) + else self._converter.to_payloads([value])[0] + ) + return payload.SerializeToString() + + +class MemoryConsumer: + """The outside reader, with the shared supersession rule.""" + + def __init__(self, store: _MemoryStream, converter: Any) -> None: + self._store = store + self._converter = converter + + async def read( + self, + *, + start: Cursor = BEGINNING, + topic: str | None = None, + type: type | None = None, + ) -> AsyncIterator[StreamRecord[Any]]: + attempts = AttemptTracker() + offset = int(start.token) if start.token else 0 + while True: + await self._store.wait_past(offset) + frames = self._store.frames + while offset < len(frames): + cursor = Cursor(str(offset)) + frame = frames[offset] + offset += 1 + try: + kind, frame_topic, source, attempt, sequence, body = _frame.decode( + frame + ) + except ValueError: + continue + if topic is not None and frame_topic != topic: + continue + superseded = attempts.note(source, attempt, cursor) + if superseded is not None: + yield superseded + yield StreamRecord( + value=self._decode(body, type) if kind is RecordKind.DATA else None, + cursor=cursor, + kind=kind, + topic=frame_topic, + producer=source, + attempt=attempt, + sequence=sequence, + ) + + def _decode(self, body: bytes, as_type: type | None) -> Any: + payload = Payload() + payload.ParseFromString(body) + if as_type is None: + return self._converter.from_payloads([payload])[0] + return self._converter.from_payloads([payload], [as_type])[0] + + +class _MemoryProvider: + name = "memory" + + def __init__(self) -> None: + self._poll = _DEFAULT_POLL + + def configure(self, **options: Any) -> None: + poll = options.pop("poll_interval", None) + if poll is not None: + self._poll = poll + if options: + raise TypeError( + f"the memory provider takes only poll_interval, got {sorted(options)}" + ) + + def worker_options(self) -> dict[str, Any]: + return {} + + def open_read( + self, + stream: str, + *, + start: Cursor = BEGINNING, + idle_timeout: timedelta | None = None, + ) -> ReadSource: + store = _stream(_inbound_id(workflow.info().workflow_id, stream)) + return _MemReadSource( + store, + int(start.token) if start.token else 0, + idle_timeout or self._poll, + ) + + def open_write(self, topic: str) -> WriteSink: + store = _stream(_inbound_id(workflow.info().workflow_id, "")) + return _MemWriteSink(store, topic) + + async def producer( + self, + client: Any, + *, + workflow_id: str, + stream: str, + producer_id: str = "", + attempt: int = 0, + ) -> MemoryProducer: + if not producer_id: + from temporalio import activity + + producer_id = activity.info().activity_id + attempt = attempt or activity.info().attempt + return MemoryProducer( + _stream(_inbound_id(workflow_id, stream)), + _converter(client), + stream, + producer_id, + attempt, + ) + + async def consumer( + self, client: Any, *, workflow_id: str, stream: str = "" + ) -> MemoryConsumer: + return MemoryConsumer( + _stream(_inbound_id(workflow_id, stream)), _converter(client) + ) + + +_provider.register("memory", _MemoryProvider) diff --git a/tests/streams/__init__.py b/tests/streams/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py new file mode 100644 index 000000000..d01132851 --- /dev/null +++ b/tests/streams/test_streams_conformance.py @@ -0,0 +1,164 @@ +"""Conformance tests for the stream contract. + +Written against the public surface plus the in-memory reference provider, so +they run with no server and no store. A storage provider reuses the same +expectations through its own fixtures; what this file pins down is the +contract: framing, producer identity, retry deduplication, supersession, +topic filtering, and cursor resumption. +""" + +from __future__ import annotations + +import asyncio +from typing import Any + +import pytest + +from temporalio import streams +from temporalio.streams import _frame +from temporalio.streams._policy import AttemptTracker +from temporalio.streams._record import Cursor, RecordKind +from temporalio.streams.providers import memory + + +@pytest.fixture(autouse=True) +def _fresh_memory_provider(): + memory.reset() + streams.configure(provider="memory") + yield + memory.reset() + + +async def take(records: Any, count: int, timeout: float = 5.0) -> list: + out: list = [] + + async def _collect() -> None: + async for record in records: + out.append(record) + if len(out) >= count: + return + + await asyncio.wait_for(_collect(), timeout) + return out + + +def test_frame_roundtrip(): + frame = _frame.encode( + topic="decisions", + kind=RecordKind.DATA, + producer="model", + attempt=3, + sequence=7, + body=b"payload-bytes", + ) + kind, topic, producer, attempt, sequence, body = _frame.decode(frame) + assert (kind, topic, producer, attempt, sequence, body) == ( + RecordKind.DATA, + "decisions", + "model", + 3, + 7, + b"payload-bytes", + ) + + +def test_supersession_is_synthesized_from_observations(): + attempts = AttemptTracker() + assert attempts.note("model", 1, Cursor("0")) is None + superseded = attempts.note("model", 2, Cursor("1")) + assert superseded is not None + assert superseded.kind is RecordKind.SUPERSEDED + assert superseded.value.previous_attempt == 1 + # The same attempt again is not a new generation. + assert attempts.note("model", 2, Cursor("2")) is None + + +async def test_append_read_roundtrip(): + producer = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + await producer.append({"id": "r1"}, {"id": "r2"}) + await producer.finish() + + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + records = await take(consumer.read(type=dict), 3) + assert [r.kind for r in records] == [ + RecordKind.DATA, + RecordKind.DATA, + RecordKind.FINISH, + ] + assert [r.value for r in records[:2]] == [{"id": "r1"}, {"id": "r2"}] + assert all(r.producer == "model" and r.attempt == 1 for r in records) + assert [r.sequence for r in records] == [0, 1, 2] + + +async def test_retried_append_is_deduplicated(): + first = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + await first.append({"id": "r1"}) + # The retry of the same attempt starts its sequence over and appends the + # same record. The provider must not store it twice. + retry = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + await retry.append({"id": "r1"}) + + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + records = await take(consumer.read(type=dict), 1) + assert records[0].value == {"id": "r1"} + with pytest.raises(asyncio.TimeoutError): + await take(consumer.read(type=dict), 2, timeout=0.2) + + +async def test_new_attempt_supersedes_the_old_one(): + first = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + await first.append({"text": "The capital of"}) + second = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=2 + ) + await second.append({"text": "Paris is the capital"}) + + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + records = await take(consumer.read(type=dict), 3) + assert records[0].kind is RecordKind.DATA and records[0].attempt == 1 + assert records[1].kind is RecordKind.SUPERSEDED + assert records[1].value.previous_attempt == 1 + assert records[2].kind is RecordKind.DATA and records[2].attempt == 2 + + +async def test_topic_filter(): + producer = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + await producer.append({"n": 1}) + other = await streams.producer( + None, workflow_id="wf", stream="other", producer_id="model", attempt=1 + ) + await other.append({"n": 2}) + + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + records = await take(consumer.read(type=dict, topic="inputs"), 1) + assert records[0].value == {"n": 1} + + +async def test_cursor_resumes_where_it_points(): + producer = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + await producer.append({"n": 1}, {"n": 2}, {"n": 3}) + + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + records = await take(consumer.read(type=dict), 3) + checkpoint = records[1].cursor + + resumed = await streams.consumer(None, workflow_id="wf", stream="inputs") + again = await take(resumed.read(type=dict, start=checkpoint), 2) + assert [r.value for r in again] == [{"n": 2}, {"n": 3}] + + +def test_unknown_provider_is_a_clear_error(): + with pytest.raises(RuntimeError, match="no stream provider 'nope'"): + streams.configure(provider="nope") From 2815caffadb3a9b8c6ec8d7520f3e9ba779221b0 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Tue, 15 Sep 2026 15:35:51 -0700 Subject: [PATCH 03/51] Added the shared demo loop. --- streams_demo/agent_loop.py | 92 ++++++++++++++++++++ streams_demo/provider_setup.py | 21 +++++ streams_demo/run_demo.py | 154 +++++++++++++++++++++++++++++++++ 3 files changed, 267 insertions(+) create mode 100644 streams_demo/agent_loop.py create mode 100644 streams_demo/provider_setup.py create mode 100644 streams_demo/run_demo.py diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py new file mode 100644 index 000000000..afbb7ea4c --- /dev/null +++ b/streams_demo/agent_loop.py @@ -0,0 +1,92 @@ +"""One agent loop, written once, run on both stream providers. + +Reads input, decides on it, publishes the decision, and runs an ordinary +Activity in the same workflow task. Also handles the two control records the +contract defines, so a retried producer and a finished topic are exercised +rather than described. + +This file is byte-identical in the server-side tree and the client-side tree. +Only the worker that runs it differs, and only in which provider it is given. +""" + +from __future__ import annotations + +from datetime import timedelta +from typing import Any + +from temporalio import activity, streams, workflow + +DECISIONS = "decisions" +INPUTS = "inputs" + + +@activity.defn(name="AI198RecordDecision") +async def record_decision(decision: dict[str, Any]) -> str: + """An ordinary command in the same task as the publish.""" + return f"recorded:{decision['source']}:{decision['branch']}" + + +def decide(token: dict[str, Any]) -> dict[str, Any]: + """The decision the workflow is here to make.""" + if token["value"] % 2 == 0: + return {"source": token["id"], "branch": "even", "computed": token["value"] * 10} + return {"source": token["id"], "branch": "odd", "computed": token["value"] + 100} + + +@workflow.defn(name="AI198StreamContractDemo", sandboxed=False) +class AgentLoop: + """Read, decide, write, until the producer says it has finished.""" + + @workflow.run + async def run(self, limit: int) -> list[dict[str, Any]]: + inputs = streams.reader( + INPUTS, type=dict, idle_timeout=timedelta(seconds=1) + ) + decisions = streams.writer(DECISIONS) + trace: list[dict[str, Any]] = [] + accepted = 0 + try: + async for record in inputs: + if record.kind is streams.RecordKind.SUPERSEDED: + # A newer attempt of the same producer started writing. The + # decisions already published stand, so the workflow says so + # rather than pretending they can be withdrawn. + trace.append( + { + "kind": "superseded", + "producer": record.producer, + "replaced": record.value.previous_attempt, + "attempt": record.value.attempt, + } + ) + await decisions.publish( + {"retracting_attempt": record.value.previous_attempt} + ) + continue + if record.kind is streams.RecordKind.FINISH: + # The producer says it is done, which is what ends the loop. + # Counting decisions instead would leave the terminal record + # unread and let the workflow finish while its producer is + # still writing. + trace.append({"kind": "finish", "producer": record.producer}) + break + decision = decide(record.value) + await decisions.publish(decision) + receipt = await workflow.execute_activity( + record_decision, + decision, + activity_id=f"decision-{decision['source']}", + start_to_close_timeout=timedelta(seconds=10), + ) + trace.append( + {"kind": "decision", "value": decision, "receipt": receipt} + ) + accepted += 1 + if accepted >= limit: + # A bound so a stuck producer cannot run this forever. The + # terminal record above is the ordinary way out. + break + finally: + inputs.close() + await decisions.finish() + return trace diff --git a/streams_demo/provider_setup.py b/streams_demo/provider_setup.py new file mode 100644 index 000000000..81e7108e5 --- /dev/null +++ b/streams_demo/provider_setup.py @@ -0,0 +1,21 @@ +"""Pick the provider for a demo run from the environment. + +``STREAMS_PROVIDER`` names any registered provider; this base tree carries +only ``memory``, and each provider branch adds its own name. The demo needs a +Temporal server to run the workflow either way; ``TEMPORAL_ADDRESS`` points +at it. +""" + +from __future__ import annotations + +import os + +NAME = os.environ.get("STREAMS_PROVIDER", "memory") + +# The memory provider is not replay-safe, so its demo keeps the cache warm. +# Storage providers run with the smallest cache they support instead. +WORKFLOW_CACHE = int(os.environ.get("STREAMS_WORKFLOW_CACHE", "512")) + + +async def open() -> tuple[str, dict]: + return os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"), {"provider": NAME} diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py new file mode 100644 index 000000000..027a95103 --- /dev/null +++ b/streams_demo/run_demo.py @@ -0,0 +1,154 @@ +"""Run the shared agent loop against whichever provider is configured. + +Three cases, the same on both providers: + +- read, decide, publish and an ordinary Activity in the same workflow task, + with the smallest workflow cache the provider supports, so that as much of + the run as it allows is rebuilt rather than remembered; +- a producer whose second attempt supersedes its first, which the reader has + to report and the workflow has to act on; +- an outside consumer reading what the workflow published. + +Byte-identical in both trees. ``provider_setup`` is what differs, and it is +the only import here that names a provider. +""" + +from __future__ import annotations + +import asyncio +import json +from pathlib import Path +import sys +import time +import uuid +from typing import Any + +from temporalio import streams +from temporalio.api.enums.v1 import EventType +from temporalio.client import Client +from temporalio.worker import Worker + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from agent_loop import INPUTS, AgentLoop, record_decision # noqa: E402 +import provider_setup # noqa: E402 + +DECISION_LIMIT = 8 +EXPECTED_OUTPUT = 6 + + +async def collect_output(client: Client, workflow_id: str, want: int) -> list[dict]: + reader = await streams.consumer(client, workflow_id=workflow_id) + seen: list[dict] = [] + async for record in reader.read(type=dict, topic="decisions"): + seen.append({"kind": record.kind.name, "value": record.value}) + if len(seen) >= want: + break + return seen + + +async def main() -> int: + out = Path(__file__).resolve().parent / f"results-{provider_setup.NAME}" + out.mkdir(exist_ok=True) + target, options = await provider_setup.open() + client = await Client.connect(target, namespace="default") + streams.configure(**options) + + uid = f"ai198-contract-{provider_setup.NAME}-" + uuid.uuid4().hex + record: dict[str, Any] = { + "provider": provider_setup.NAME, + "workflow_id": uid, + "target": target, + "max_cached_workflows": provider_setup.WORKFLOW_CACHE, + } + + async with Worker( + client, + task_queue=uid, + workflows=[AgentLoop], + activities=[record_decision], + max_cached_workflows=provider_setup.WORKFLOW_CACHE, + **streams.worker_options(), + ): + handle = await client.start_workflow( + AgentLoop.run, DECISION_LIMIT, id=uid, task_queue=uid + ) + output = asyncio.create_task(collect_output(client, uid, EXPECTED_OUTPUT)) + + # The first attempt writes two records and then stops, as a failed + # activity would. The second writes different inputs under the same + # logical producer, which is what the reader has to report. + first = await streams.producer( + client, workflow_id=uid, stream=INPUTS, producer_id="model", attempt=1 + ) + await first.append({"id": "r1", "value": 1}, {"id": "r2", "value": 2}) + await asyncio.sleep(0.5) + second = await streams.producer( + client, workflow_id=uid, stream=INPUTS, producer_id="model", attempt=2 + ) + await second.append({"id": "r3", "value": 3}, {"id": "r4", "value": 4}) + await second.finish() + + # A failed Workflow Task is not an outcome. The server rejects a + # completion that raced newly buffered events, and the retry usually + # gets through, so reading the first failure as the result reports a + # working run as a broken one. Wait for a terminal event, then report + # the retries separately so they are neither the headline nor hidden. + deadline = time.monotonic() + 120 + # Taken from the enum rather than written out, because guessing these + # numbers is how a run that completed gets reported as terminated. + terminal = { + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: "completed", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED: "workflow_failed", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT: "execution_timed_out", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED: "canceled", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED: "terminated", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW: "continued_as_new", + } + while time.monotonic() < deadline: + history = await handle.fetch_history() + reached = [ + terminal[e.event_type] + for e in history.events + if e.event_type in terminal + ] + if reached: + record["outcome"] = reached[-1] + if record["outcome"] == "completed": + record["trace"] = await handle.result() + break + await asyncio.sleep(0.1) + else: + record["outcome"] = "timed_out_waiting" + history = await handle.fetch_history() + + retried = [ + e + for e in history.events + if e.event_type == EventType.EVENT_TYPE_WORKFLOW_TASK_FAILED + ] + record["task_failures"] = [ + { + "event_id": e.event_id, + "cause": int(e.workflow_task_failed_event_attributes.cause), + "message": e.workflow_task_failed_event_attributes.failure.message, + } + for e in retried + ] + + try: + record["observed_output"] = await asyncio.wait_for(output, timeout=20) + except asyncio.TimeoutError: + output.cancel() + record["observed_output"] = "timed_out" + + history = await handle.fetch_history() + record["history_events"] = len(history.events) + (out / "history.json").write_text(history.to_json()) + await provider_setup.close() + (out / "results.json").write_text(json.dumps(record, indent=2) + "\n") + print(json.dumps(record, indent=2)) + return 0 if record["outcome"] == "completed" else 1 + + +if __name__ == "__main__": + sys.exit(asyncio.run(main())) From ccae2b46b309cf49a7d2fb5fffda49398e8fc398 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Tue, 15 Sep 2026 17:58:03 -0700 Subject: [PATCH 04/51] Added the prepare and drain hooks the Workflow Streams transport needs. A provider that answers outside readers through handlers on the workflow has to register them before the first task completes, and one that parks a long-poll update against the run has to let go before the workflow returns. Both are no-ops on the storage providers, so workflow code calls them unconditionally and stays portable. --- temporalio/streams/__init__.py | 4 +++ temporalio/streams/_provider.py | 57 ++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index a25c2bdca..699919ffe 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -57,8 +57,10 @@ StreamProvider, configure, consumer, + drain, open_read, open_write, + prepare, producer, worker_options, ) @@ -85,6 +87,8 @@ "WriteSink", "configure", "consumer", + "drain", + "prepare", "producer", "worker_options", "reader", diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 58282cc55..48439d754 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -23,8 +23,10 @@ "StreamProvider", "configure", "consumer", + "drain", "open_read", "open_write", + "prepare", "producer", "register", "registered", @@ -121,6 +123,24 @@ async def consumer( """Open a reader for what ``workflow_id`` publishes.""" ... + def prepare(self) -> None: + """Install whatever this provider needs before the workflow runs. + + Optional. A provider that serves outside readers through handlers on + the workflow itself has to register them before the first task + completes, or a reader that arrives early finds nothing to talk to. + """ + ... + + def drain(self) -> None: + """Release anything this provider parked on the workflow's behalf. + + Optional. A provider that parks an outside reader against the running + workflow, as the Workflow Streams transport does with its long-poll + update, has to let go before the workflow can return. + """ + ... + _factories: dict[str, Callable[[], StreamProvider]] = {} _active: StreamProvider | None = None @@ -159,9 +179,18 @@ def configure(provider: str | None = None, **options: Any) -> None: ``provider`` may be omitted when exactly one provider is registered. """ global _active + _active = instance(provider, **options) + + +def instance(provider: str | None = None, **options: Any) -> StreamProvider: + """A configured provider that is not installed as the process default. + + For code that serves one provider while the process is configured with + another, such as a Nexus stream handler delegating to its store. + """ chosen = _make(provider) chosen.configure(**options) - _active = chosen + return chosen def _current() -> StreamProvider: @@ -193,6 +222,32 @@ def open_write(topic: str) -> WriteSink: return _current().open_write(topic) +def prepare() -> None: + """Let the provider install what it needs, before the workflow runs. + + Call it from the workflow's constructor. It is a no-op on providers that + need nothing, so workflow code can call it unconditionally and stay + portable. + """ + provider = _current() + install = getattr(provider, "prepare", None) + if install is not None: + install() + + +def drain() -> None: + """Release anything the provider parked on this workflow's behalf. + + Call it before a workflow that read a stream returns. It is a no-op on + providers that park nothing, so workflow code can call it unconditionally + and stay portable. + """ + provider = _current() + release = getattr(provider, "drain", None) + if release is not None: + release() + + async def producer( client: Any, *, From 8926913e29716b022a57d20738f7b79dda3f327c Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Tue, 15 Sep 2026 18:01:04 -0700 Subject: [PATCH 05/51] Made cursors exclusive, added latest(), and allowed topic appends. Porting the agent harness onto the interface surfaced three things the small example never needed. A reader resumes after the record a cursor names, so it can store the last cursor it handled without advancing an opaque token. A consumer reports its latest position, so a client can follow a turn it is about to start without the workflow reporting a position. And a producer can append onto a topic of the stream the workflow publishes, so an activity's live output lands next to the workflow's own records for one outside reader. --- temporalio/streams/__init__.py | 25 ++++++----- temporalio/streams/_provider.py | 55 +++++++++++++++++++---- temporalio/streams/_record.py | 4 +- temporalio/streams/providers/memory.py | 20 ++++++--- tests/streams/test_streams_conformance.py | 40 ++++++++++++++++- 5 files changed, 115 insertions(+), 29 deletions(-) diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index 699919ffe..aaf0a444d 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -12,12 +12,16 @@ it found nothing, is committed with the commands that reading produced. Recovery re-supplies the same records in the same order. 3. **Anything that does I/O publishes on its own account.** An activity, a - local activity, or an outside process writes through :func:`producer`, and - its records are visible as soon as they are written. It carries a producer - id, an attempt and a sequence so a retry can be told from a new generation. -4. **A cursor is opaque and belongs to its provider.** Hand it back to resume. - Do not compare two cursors or do arithmetic on one: one provider numbers - records with integers and another with a millisecond-and-sequence pair. + local activity, or an outside process writes through :func:`producer`, + either into one of the workflow's inbound streams or onto a topic of the + stream the workflow publishes, and its records are visible as soon as they + are written. It carries a producer id, an attempt and a sequence so a retry + can be told from a new generation. +4. **A cursor is opaque and belongs to its provider.** Hand it back to resume + after the record it names. Do not compare two cursors or do arithmetic on + one: one provider numbers records with integers and another with a + millisecond-and-sequence pair. A reader that wants to follow from now asks + the consumer for :meth:`Consumer.latest` instead of guessing a position. 5. **A workflow names its streams relative to itself, and the provider resolves them.** ``reader("inputs")`` is this workflow's inbound stream called ``inputs``; ``writer("decisions")`` is a topic it publishes on. One @@ -103,7 +107,7 @@ def reader( *, type: type | None = None, topic: str | None = None, - start: Cursor = BEGINNING, + after: Cursor = BEGINNING, idle_timeout: timedelta | None = None, ) -> StreamReader[Any]: """Subscribe this workflow to its inbound stream ``stream``. @@ -116,14 +120,15 @@ def reader( stream: The inbound stream's name, relative to this workflow. type: The value type, used as the decode hint. topic: Only records on this topic, or every topic when omitted. - start: Where to start. Only honoured on the first subscription of a - run, because after that the recorded cursor decides. + after: Resume after this record. Only honoured on the first + subscription of a run, because after that the recorded cursor + decides. idle_timeout: How long the workflow waits with nothing arriving before the provider is allowed to release the worker. ``None`` takes the provider's default. """ return StreamReader( - open_read(stream, start=start, idle_timeout=idle_timeout), + open_read(stream, after=after, idle_timeout=idle_timeout), topic=topic, type=type, ) diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 48439d754..c224b47bf 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -62,11 +62,28 @@ class Consumer(Protocol): def read( self, *, - start: Cursor = BEGINNING, + after: Cursor = BEGINNING, topic: str | None = None, type: type | None = None, ) -> AsyncIterator[StreamRecord[Any]]: - """Yield records from ``start`` as they arrive.""" + """Yield the records after ``after`` as they arrive. + + ``BEGINNING`` yields everything the stream retains. Any other cursor + came from a record this or another reader saw, and reading resumes + just past it, so a reader that stores the last cursor it handled and + hands it back sees every record exactly once. + """ + ... + + async def latest(self, *, topic: str | None = None) -> Cursor: + """The cursor of the newest record, or ``BEGINNING`` when there is none. + + For a reader that wants to follow from now: ``read(after=latest())`` + yields only what is published after this call returned, which is how + a client that is about to send a message positions itself before + sending, without the workflow having to report a position. ``topic`` + is for the provider that keeps each topic in its own store. + """ ... @@ -95,7 +112,7 @@ def open_read( self, stream: str, *, - start: Cursor = BEGINNING, + after: Cursor = BEGINNING, idle_timeout: timedelta | None = None, ) -> ReadSource: """Subscribe the running workflow to its inbound stream ``stream``.""" @@ -110,11 +127,18 @@ async def producer( client: Any, *, workflow_id: str, - stream: str, + stream: str = "", + topic: str = "", producer_id: str = "", attempt: int = 0, ) -> Producer: - """Open a producer for ``workflow_id``'s inbound stream ``stream``.""" + """Open a producer that appends on ``workflow_id``'s account. + + ``stream`` names one of the workflow's inbound streams. With no + ``stream``, ``topic`` names a topic on the stream the workflow itself + publishes, which is how an activity puts its live output next to the + workflow's own records for the same outside reader. + """ ... async def consumer( @@ -210,11 +234,11 @@ def worker_options() -> dict[str, Any]: def open_read( stream: str, *, - start: Cursor = BEGINNING, + after: Cursor = BEGINNING, idle_timeout: timedelta | None = None, ) -> ReadSource: """Subscribe the running workflow to its inbound stream ``stream``.""" - return _current().open_read(stream, start=start, idle_timeout=idle_timeout) + return _current().open_read(stream, after=after, idle_timeout=idle_timeout) def open_write(topic: str) -> WriteSink: @@ -252,15 +276,28 @@ async def producer( client: Any, *, workflow_id: str, - stream: str, + stream: str = "", + topic: str = "", producer_id: str = "", attempt: int = 0, ) -> Producer: - """Open a producer for the inbound stream ``stream`` of ``workflow_id``.""" + """Open a producer that appends on ``workflow_id``'s account. + + Name either an inbound ``stream`` of the workflow, or a ``topic`` on the + stream the workflow publishes. Inside an activity, leave ``producer_id`` + and ``attempt`` unset: the activity's own id and attempt are the right + answer, and they are what let a reader tell a retry from a new generation. + """ + if bool(stream) == bool(topic): + raise ValueError( + "name exactly one of stream (an inbound stream of the workflow) or " + "topic (a topic on the stream the workflow publishes)" + ) return await _current().producer( client, workflow_id=workflow_id, stream=stream, + topic=topic, producer_id=producer_id, attempt=attempt, ) diff --git a/temporalio/streams/_record.py b/temporalio/streams/_record.py index d458ef0c4..4fd322189 100644 --- a/temporalio/streams/_record.py +++ b/temporalio/streams/_record.py @@ -50,8 +50,8 @@ class Cursor: Opaque on purpose. One provider numbers records with integers and another with a millisecond-and-sequence pair, so comparing tokens here would be - right for one and wrong for the other. Hand a cursor back to resume from - it; ask the reader to compare two. + right for one and wrong for the other. Hand a cursor back to resume after + the record it names; nothing here advances one. """ token: str diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 808a84f13..477a17b68 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -204,12 +204,12 @@ def __init__(self, store: _MemoryStream, converter: Any) -> None: async def read( self, *, - start: Cursor = BEGINNING, + after: Cursor = BEGINNING, topic: str | None = None, type: type | None = None, ) -> AsyncIterator[StreamRecord[Any]]: attempts = AttemptTracker() - offset = int(start.token) if start.token else 0 + offset = int(after.token) + 1 if after.token else 0 while True: await self._store.wait_past(offset) frames = self._store.frames @@ -238,6 +238,11 @@ async def read( sequence=sequence, ) + async def latest(self, *, topic: str | None = None) -> Cursor: + del topic # one store per stream, so the position is topic-independent + count = len(self._store.frames) + return Cursor(str(count - 1)) if count else BEGINNING + def _decode(self, body: bytes, as_type: type | None) -> Any: payload = Payload() payload.ParseFromString(body) @@ -268,13 +273,13 @@ def open_read( self, stream: str, *, - start: Cursor = BEGINNING, + after: Cursor = BEGINNING, idle_timeout: timedelta | None = None, ) -> ReadSource: store = _stream(_inbound_id(workflow.info().workflow_id, stream)) return _MemReadSource( store, - int(start.token) if start.token else 0, + int(after.token) + 1 if after.token else 0, idle_timeout or self._poll, ) @@ -287,7 +292,8 @@ async def producer( client: Any, *, workflow_id: str, - stream: str, + stream: str = "", + topic: str = "", producer_id: str = "", attempt: int = 0, ) -> MemoryProducer: @@ -296,10 +302,12 @@ async def producer( producer_id = activity.info().activity_id attempt = attempt or activity.info().attempt + # With no inbound stream named, the target is the store the workflow's + # own writer appends to, and the frame carries the topic instead. return MemoryProducer( _stream(_inbound_id(workflow_id, stream)), _converter(client), - stream, + stream or topic, producer_id, attempt, ) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index d01132851..978ef5ca1 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -152,13 +152,49 @@ async def test_cursor_resumes_where_it_points(): consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") records = await take(consumer.read(type=dict), 3) - checkpoint = records[1].cursor + checkpoint = records[0].cursor + # Resuming after a record hands back everything past it and nothing + # twice, without the reader ever advancing a cursor itself. resumed = await streams.consumer(None, workflow_id="wf", stream="inputs") - again = await take(resumed.read(type=dict, start=checkpoint), 2) + again = await take(resumed.read(type=dict, after=checkpoint), 2) assert [r.value for r in again] == [{"n": 2}, {"n": 3}] +async def test_latest_positions_a_reader_at_the_end(): + producer = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + assert await consumer.latest() == streams.BEGINNING + + await producer.append({"n": 1}, {"n": 2}) + since = await consumer.latest() + await producer.append({"n": 3}) + + # A reader that positioned itself before the last append sees only what + # came after, which is how a client follows a turn it is about to start. + records = await take(consumer.read(type=dict, after=since), 1) + assert [r.value for r in records] == [{"n": 3}] + + +async def test_producer_appends_onto_the_owners_topic(): + # An activity's live output lands on the same topic the workflow + # publishes, so one outside reader follows both. + producer = await streams.producer( + None, workflow_id="wf", topic="events", producer_id="model", attempt=1 + ) + await producer.append({"delta": "hel"}, {"delta": "lo"}) + + consumer = await streams.consumer(None, workflow_id="wf") + records = await take(consumer.read(type=dict, topic="events"), 2) + assert [r.value["delta"] for r in records] == ["hel", "lo"] + assert {r.producer for r in records} == {"model"} + + with pytest.raises(ValueError): + await streams.producer(None, workflow_id="wf", producer_id="model", attempt=1) + + def test_unknown_provider_is_a_clear_error(): with pytest.raises(RuntimeError, match="no stream provider 'nope'"): streams.configure(provider="nope") From 8e36829b37803bc7dcd725e860a8ff9ab28bb4b4 Mon Sep 17 00:00:00 2001 From: Moe Dashti Date: Wed, 16 Sep 2026 14:37:39 -0700 Subject: [PATCH 06/51] Sorted and formatted the streams package for ruff. CI runs `ruff check --select I` and `ruff format --check` over the whole tree, and the new files were written by hand. --- streams_demo/agent_loop.py | 10 ++++++---- streams_demo/run_demo.py | 4 ++-- temporalio/streams/__init__.py | 7 ++++++- temporalio/streams/_provider.py | 3 +-- temporalio/streams/providers/memory.py | 11 +++++++++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index afbb7ea4c..e68bb0a58 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -29,7 +29,11 @@ async def record_decision(decision: dict[str, Any]) -> str: def decide(token: dict[str, Any]) -> dict[str, Any]: """The decision the workflow is here to make.""" if token["value"] % 2 == 0: - return {"source": token["id"], "branch": "even", "computed": token["value"] * 10} + return { + "source": token["id"], + "branch": "even", + "computed": token["value"] * 10, + } return {"source": token["id"], "branch": "odd", "computed": token["value"] + 100} @@ -39,9 +43,7 @@ class AgentLoop: @workflow.run async def run(self, limit: int) -> list[dict[str, Any]]: - inputs = streams.reader( - INPUTS, type=dict, idle_timeout=timedelta(seconds=1) - ) + inputs = streams.reader(INPUTS, type=dict, idle_timeout=timedelta(seconds=1)) decisions = streams.writer(DECISIONS) trace: list[dict[str, Any]] = [] accepted = 0 diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index 027a95103..687dc1a05 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -17,10 +17,10 @@ import asyncio import json -from pathlib import Path import sys import time import uuid +from pathlib import Path from typing import Any from temporalio import streams @@ -29,8 +29,8 @@ from temporalio.worker import Worker sys.path.insert(0, str(Path(__file__).resolve().parent)) -from agent_loop import INPUTS, AgentLoop, record_decision # noqa: E402 import provider_setup # noqa: E402 +from agent_loop import INPUTS, AgentLoop, record_decision # noqa: E402 DECISION_LIMIT = 8 EXPECTED_OUTPUT = 6 diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index aaf0a444d..caaa03ffb 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -54,7 +54,12 @@ from datetime import timedelta from typing import Any, TypeVar -from temporalio.streams._handles import ReadSource, StreamReader, StreamWriter, WriteSink +from temporalio.streams._handles import ( + ReadSource, + StreamReader, + StreamWriter, + WriteSink, +) from temporalio.streams._provider import ( Consumer, Producer, diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index c224b47bf..a36339a97 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -186,8 +186,7 @@ def _make(name: str | None) -> StreamProvider: name = next(iter(_factories)) else: raise RuntimeError( - "name a provider: configure(provider=...) with one of " - f"{registered()}" + f"name a provider: configure(provider=...) with one of {registered()}" ) factory = _factories.get(name) if factory is None: diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 477a17b68..fb2712350 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -131,7 +131,12 @@ class MemoryProducer: """The outside producer, faithful to the contract.""" def __init__( - self, store: _MemoryStream, converter: Any, topic: str, producer_id: str, attempt: int + self, + store: _MemoryStream, + converter: Any, + topic: str, + producer_id: str, + attempt: int, ) -> None: self._store = store self._converter = converter @@ -147,7 +152,9 @@ def attempt(self) -> int: @property def _provider_id(self) -> str: return ( - f"{self._producer_id}#{self._attempt}" if self._attempt else self._producer_id + f"{self._producer_id}#{self._attempt}" + if self._attempt + else self._producer_id ) async def append(self, *values: Any) -> Cursor: From a62702275b4b2c53e1c432b99491ac124f1c5195 Mon Sep 17 00:00:00 2001 From: Moe Dashti Date: Wed, 16 Sep 2026 14:37:53 -0700 Subject: [PATCH 07/51] Added the changelog entry for the stream interface. The changelog checkpoint requires an entry for any user-facing change. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f016f34ff..568f64b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,11 @@ to include examples, links to docs, or any other relevant information. ### Added - Added the `temporalio.contrib.gcp.cloud_run.id` module with the `CloudRunIdPlugin` client plugin to set the worker identity on Cloud Run. +- **Experimental**: `temporalio.streams` defines one stream interface a workflow + can read, decide on, and write, with a registry that picks the provider when + the worker is built. `temporalio.streams.providers.memory` is the in-memory + reference provider the conformance tests run against. + ### Changed ### Deprecated From 0fbac2951e3c6292070a15ecb5aca85a7488d6ce Mon Sep 17 00:00:00 2001 From: Moe Dashti Date: Wed, 16 Sep 2026 14:48:04 -0700 Subject: [PATCH 08/51] Made the streams package pass the type and doc linters. `prepare` and `drain` are hooks only a transport that parks something against the running workflow needs, so they move to their own protocol rather than making every provider carry two empty methods. The demo's teardown called a `close` that no provider setup defined. --- streams_demo/agent_loop.py | 1 + streams_demo/provider_setup.py | 10 +++++++++ streams_demo/run_demo.py | 2 ++ temporalio/streams/__init__.py | 6 +++++- temporalio/streams/_policy.py | 1 + temporalio/streams/_provider.py | 25 +++++++++++++++++------ temporalio/streams/providers/memory.py | 7 +++++++ tests/streams/test_streams_conformance.py | 2 +- 8 files changed, 46 insertions(+), 8 deletions(-) diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index e68bb0a58..f3f39dca9 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -43,6 +43,7 @@ class AgentLoop: @workflow.run async def run(self, limit: int) -> list[dict[str, Any]]: + """Decide on at most ``limit`` inputs, then return the trace.""" inputs = streams.reader(INPUTS, type=dict, idle_timeout=timedelta(seconds=1)) decisions = streams.writer(DECISIONS) trace: list[dict[str, Any]] = [] diff --git a/streams_demo/provider_setup.py b/streams_demo/provider_setup.py index 81e7108e5..52ebbd266 100644 --- a/streams_demo/provider_setup.py +++ b/streams_demo/provider_setup.py @@ -18,4 +18,14 @@ async def open() -> tuple[str, dict]: + """The server to connect to and the options :func:`configure` takes.""" return os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"), {"provider": NAME} + + +async def close() -> None: + """Let go of whatever :func:`open` acquired. + + Nothing here: the memory provider holds no connection. A provider branch + that opens one closes it here, so the demo's teardown reads the same on + every provider. + """ diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index 687dc1a05..9d6a62cb5 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -37,6 +37,7 @@ async def collect_output(client: Client, workflow_id: str, want: int) -> list[dict]: + """Read ``want`` decisions off the workflow's stream from outside it.""" reader = await streams.consumer(client, workflow_id=workflow_id) seen: list[dict] = [] async for record in reader.read(type=dict, topic="decisions"): @@ -47,6 +48,7 @@ async def collect_output(client: Client, workflow_id: str, want: int) -> list[di async def main() -> int: + """Run the demo once and write what happened next to this file.""" out = Path(__file__).resolve().parent / f"results-{provider_setup.NAME}" out.mkdir(exist_ok=True) target, options = await provider_setup.open() diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index caaa03ffb..cd55ee9d4 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -64,6 +64,7 @@ Consumer, Producer, StreamProvider, + StreamProviderLifecycle, configure, consumer, drain, @@ -89,6 +90,7 @@ "ReadSource", "RecordKind", "StreamProvider", + "StreamProviderLifecycle", "StreamReader", "StreamRecord", "StreamWriter", @@ -154,4 +156,6 @@ def writer(topic: str, *, type: type | None = None) -> StreamWriter[Any]: # Importing the package registers every provider whose dependencies are # present in this tree. Import order matters: the registry above must exist # before a provider module can register with it. -from temporalio.streams import providers as _providers # noqa: E402,F401 +from temporalio.streams import ( + providers as _providers, # noqa: E402,F401 # pyright: ignore[reportUnusedImport] +) diff --git a/temporalio/streams/_policy.py b/temporalio/streams/_policy.py index 24e20ab2f..73114bbdb 100644 --- a/temporalio/streams/_policy.py +++ b/temporalio/streams/_policy.py @@ -26,6 +26,7 @@ class AttemptTracker: """Watches producer attempts on one subscription.""" def __init__(self) -> None: + """Start with no producer seen.""" self._attempts: dict[str, int] = {} def note( diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index a36339a97..18e2bb983 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -21,6 +21,7 @@ "Consumer", "Producer", "StreamProvider", + "StreamProviderLifecycle", "configure", "consumer", "drain", @@ -96,6 +97,9 @@ class StreamProvider(Protocol): outside pair (:meth:`producer`, :meth:`consumer`) runs anywhere and moves framed bytes. A transport-only provider may serve just the outside pair and raise on the workflow side, naming the provider a worker should use. + + A provider whose transport parks something against the running workflow + also implements :class:`StreamProviderLifecycle`. """ name: str @@ -147,21 +151,30 @@ async def consumer( """Open a reader for what ``workflow_id`` publishes.""" ... + +class StreamProviderLifecycle(Protocol): + """The hooks a provider adds when it needs the workflow's own lifetime. + + Separate from :class:`StreamProvider` because most transports need + neither, and a provider is not asked to carry a pair of empty methods to + say so. :func:`prepare` and :func:`drain` call whichever half is present. + """ + def prepare(self) -> None: """Install whatever this provider needs before the workflow runs. - Optional. A provider that serves outside readers through handlers on - the workflow itself has to register them before the first task - completes, or a reader that arrives early finds nothing to talk to. + A provider that serves outside readers through handlers on the + workflow itself has to register them before the first task completes, + or a reader that arrives early finds nothing to talk to. """ ... def drain(self) -> None: """Release anything this provider parked on the workflow's behalf. - Optional. A provider that parks an outside reader against the running - workflow, as the Workflow Streams transport does with its long-poll - update, has to let go before the workflow can return. + A provider that parks an outside reader against the running workflow, + as the Workflow Streams transport does with its long-poll update, has + to let go before the workflow can return. """ ... diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index fb2712350..f7e58ef44 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -138,6 +138,7 @@ def __init__( producer_id: str, attempt: int, ) -> None: + """Bind this producer to ``topic`` on ``store``.""" self._store = store self._converter = converter self._topic = topic @@ -147,6 +148,7 @@ def __init__( @property def attempt(self) -> int: + """The generation this producer is writing.""" return self._attempt @property @@ -158,6 +160,7 @@ def _provider_id(self) -> str: ) async def append(self, *values: Any) -> Cursor: + """Append ``values`` and return the cursor of the last one.""" frames = [] for value in values: frames.append( @@ -179,6 +182,7 @@ async def append(self, *values: Any) -> Cursor: return Cursor(str(offset)) async def finish(self) -> None: + """Mark this producer done, so a reader stops waiting on it.""" frame = _frame.encode( topic=self._topic, kind=RecordKind.FINISH, @@ -205,6 +209,7 @@ class MemoryConsumer: """The outside reader, with the shared supersession rule.""" def __init__(self, store: _MemoryStream, converter: Any) -> None: + """Read whatever ``store`` holds, now and as it grows.""" self._store = store self._converter = converter @@ -215,6 +220,7 @@ async def read( topic: str | None = None, type: type | None = None, ) -> AsyncIterator[StreamRecord[Any]]: + """Yield records after ``after``, waiting for ones not written yet.""" attempts = AttemptTracker() offset = int(after.token) + 1 if after.token else 0 while True: @@ -246,6 +252,7 @@ async def read( ) async def latest(self, *, topic: str | None = None) -> Cursor: + """The cursor of the last record written, for following from now.""" del topic # one store per stream, so the position is topic-independent count = len(self._store.frames) return Cursor(str(count - 1)) if count else BEGINNING diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 978ef5ca1..0c7818064 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -22,7 +22,7 @@ @pytest.fixture(autouse=True) -def _fresh_memory_provider(): +def _fresh_memory_provider(): # pyright: ignore[reportUnusedFunction] memory.reset() streams.configure(provider="memory") yield From 6b8b35ed68d9d1cb2839acf491f418c23b4ec87f Mon Sep 17 00:00:00 2001 From: Moe Dashti Date: Wed, 16 Sep 2026 16:22:04 -0700 Subject: [PATCH 09/51] Made the demo call the provider lifecycle hooks. A transport that serves outside readers through handlers on the workflow registers them in `prepare`, so without the call an outside reader finds no handler and the demo's follow fails against that provider. --- streams_demo/agent_loop.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index f3f39dca9..79d92c367 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -41,6 +41,15 @@ def decide(token: dict[str, Any]) -> dict[str, Any]: class AgentLoop: """Read, decide, write, until the producer says it has finished.""" + def __init__(self) -> None: + """Let the provider install what it needs before the first task. + + A no-op except on a transport that serves outside readers through + handlers on this workflow, which has to register them before the + first task completes or an early reader finds nothing to talk to. + """ + streams.prepare() + @workflow.run async def run(self, limit: int) -> list[dict[str, Any]]: """Decide on at most ``limit`` inputs, then return the trace.""" @@ -92,4 +101,7 @@ async def run(self, limit: int) -> list[dict[str, Any]]: finally: inputs.close() await decisions.finish() + # Lets go of anything the provider parked against this run, so a + # transport that holds a long poll open can let the workflow return. + streams.drain() return trace From 696d355f20c899090a5eba2e6d2c2d40803ee84e Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:28 -0700 Subject: [PATCH 10/51] Woke outside readers across threads and ignored idle_timeout in memory. A workflow's publish runs on the workflow thread, so waking a consumer parked on another loop needs call_soon_threadsafe. The memory provider also stops reading idle_timeout as its poll period, which gave the parameter a second meaning. --- temporalio/streams/providers/memory.py | 38 ++++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index f7e58ef44..7b6e74fdc 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -31,6 +31,13 @@ _DEFAULT_POLL = timedelta(milliseconds=100) +logger = logging.getLogger(__name__) + + +def _wake(future: asyncio.Future[None]) -> None: + if not future.done(): + future.set_result(None) + class _MemoryStream: def __init__(self) -> None: @@ -38,9 +45,16 @@ def __init__(self) -> None: # Dedupe identity is (producer#attempt, first sequence of the append), # the same pair the storage providers use. self.seen: dict[tuple[str, int], int] = {} - self._arrival = asyncio.Event() - - def append(self, frames: list[bytes], *, producer_id: str, sequence: int) -> int: + # Each waiter is parked with the loop it belongs to. A workflow's + # publish runs on the workflow thread, and waking a foreign loop's + # future from there needs call_soon_threadsafe or the loop stays + # blocked in select until unrelated I/O happens to wake it. + self._waiters: list[tuple[asyncio.AbstractEventLoop, asyncio.Future[None]]] = [] + + def append( + self, frames: list[bytes], *, producer_id: str, sequence: int + ) -> int | None: + """Store ``frames`` and return the first one's offset, or ``None`` for a repeat.""" key = (producer_id, sequence) already = self.seen.get(key) if already is not None: @@ -48,13 +62,17 @@ def append(self, frames: list[bytes], *, producer_id: str, sequence: int) -> int offset = len(self.frames) self.frames.extend(frames) self.seen[key] = offset - arrival, self._arrival = self._arrival, asyncio.Event() - arrival.set() + waiters, self._waiters = self._waiters, [] + for loop, future in waiters: + loop.call_soon_threadsafe(_wake, future) return offset async def wait_past(self, offset: int) -> None: while len(self.frames) <= offset: - await self._arrival.wait() + loop = asyncio.get_running_loop() + future: asyncio.Future[None] = loop.create_future() + self._waiters.append((loop, future)) + await future _streams: dict[str, _MemoryStream] = {} @@ -290,11 +308,13 @@ def open_read( after: Cursor = BEGINNING, idle_timeout: timedelta | None = None, ) -> ReadSource: + # Ignored: this provider never releases the worker, it polls. Reading + # idle_timeout as the poll period would give the parameter a second + # meaning that a port copying the reference would copy too. + del idle_timeout store = _stream(_inbound_id(workflow.info().workflow_id, stream)) return _MemReadSource( - store, - int(after.token) + 1 if after.token else 0, - idle_timeout or self._poll, + store, int(after.token) + 1 if after.token else 0, self._poll ) def open_write(self, topic: str) -> WriteSink: From ba750700087505d7dc1f6a4160abd9e40aa41a20 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:28 -0700 Subject: [PATCH 11/51] Named the last record in append's cursor and allowed None for it. A caller resuming with read(after=appended) must see only what came later, so the cursor names the last record of the batch. None says nothing was written, or that the transport learns positions at read time. --- temporalio/streams/_provider.py | 11 ++++++++-- temporalio/streams/providers/memory.py | 15 ++++++++------ tests/streams/test_streams_conformance.py | 25 +++++++++++++++++++---- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 18e2bb983..e0011b0c7 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -48,8 +48,15 @@ def attempt(self) -> int: """The generation this producer is writing.""" ... - async def append(self, *values: Any) -> Cursor: - """Append values and return where the first one landed.""" + async def append(self, *values: Any) -> Cursor | None: + """Append values and return the cursor of the last one written. + + The last rather than the first, so ``read(after=appended)`` yields + only what came later. ``None`` when nothing was written, because the + batch was empty or a repeat the provider dropped, and on a transport + that learns positions only at read time; a caller that needs to + position itself on such a transport asks :meth:`Consumer.latest`. + """ ... async def finish(self) -> None: diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 7b6e74fdc..2244069b8 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -56,9 +56,8 @@ def append( ) -> int | None: """Store ``frames`` and return the first one's offset, or ``None`` for a repeat.""" key = (producer_id, sequence) - already = self.seen.get(key) - if already is not None: - return already + if key in self.seen: + return None offset = len(self.frames) self.frames.extend(frames) self.seen[key] = offset @@ -177,8 +176,10 @@ def _provider_id(self) -> str: else self._producer_id ) - async def append(self, *values: Any) -> Cursor: - """Append ``values`` and return the cursor of the last one.""" + async def append(self, *values: Any) -> Cursor | None: + """Append ``values`` and return the last one's cursor, or ``None`` if nothing landed.""" + if not values: + return None frames = [] for value in values: frames.append( @@ -197,7 +198,9 @@ async def append(self, *values: Any) -> Cursor: producer_id=self._provider_id, sequence=self._sequence - len(frames), ) - return Cursor(str(offset)) + if offset is None: + return None + return Cursor(str(offset + len(frames) - 1)) async def finish(self) -> None: """Mark this producer done, so a reader stops waiting on it.""" diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 0c7818064..a0cae8fc7 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -98,17 +98,18 @@ async def test_retried_append_is_deduplicated(): ) await first.append({"id": "r1"}) # The retry of the same attempt starts its sequence over and appends the - # same record. The provider must not store it twice. + # same record. The provider must not store it twice, and says so by + # returning no position for what it dropped. retry = await streams.producer( None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 ) - await retry.append({"id": "r1"}) + assert await retry.append({"id": "r1"}) is None consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") records = await take(consumer.read(type=dict), 1) assert records[0].value == {"id": "r1"} - with pytest.raises(asyncio.TimeoutError): - await take(consumer.read(type=dict), 2, timeout=0.2) + # The store holds exactly the one record: the newest position is its cursor. + assert await consumer.latest() == records[0].cursor async def test_new_attempt_supersedes_the_old_one(): @@ -161,6 +162,22 @@ async def test_cursor_resumes_where_it_points(): assert [r.value for r in again] == [{"n": 2}, {"n": 3}] +async def test_append_cursor_names_the_last_record_of_the_batch(): + producer = await streams.producer( + None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + ) + appended = await producer.append({"n": 1}, {"n": 2}, {"n": 3}) + assert appended is not None + await producer.append({"n": 4}) + + # A producer that resumes a reader after its own append must see only + # what came later, not the tail of the batch it just wrote. + consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") + records = await take(consumer.read(type=dict, after=appended), 1) + assert [r.value for r in records] == [{"n": 4}] + assert await producer.append() is None + + async def test_latest_positions_a_reader_at_the_end(): producer = await streams.producer( None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 From 9de9342f1d6035f565e207472948a0069a58c9ca Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:28 -0700 Subject: [PATCH 12/51] Resolved producer identity once in the package. The activity defaulting rule is an interface rule, and every provider carried its own copy. --- temporalio/streams/_provider.py | 14 +++++++++++++- temporalio/streams/providers/memory.py | 5 ----- tests/streams/test_streams_conformance.py | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index e0011b0c7..2d8e14f2b 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -14,6 +14,7 @@ from datetime import timedelta from typing import Any, Callable, Protocol +from temporalio import activity from temporalio.streams._handles import ReadSource, WriteSink from temporalio.streams._record import BEGINNING, Cursor, StreamRecord @@ -148,7 +149,9 @@ async def producer( ``stream`` names one of the workflow's inbound streams. With no ``stream``, ``topic`` names a topic on the stream the workflow itself publishes, which is how an activity puts its live output next to the - workflow's own records for the same outside reader. + workflow's own records for the same outside reader. ``producer_id`` + is never empty here: the package resolved it, from the activity + context when the caller left it unset. """ ... @@ -312,6 +315,15 @@ async def producer( "name exactly one of stream (an inbound stream of the workflow) or " "topic (a topic on the stream the workflow publishes)" ) + if not producer_id: + if not activity.in_activity(): + raise ValueError( + "producer_id is required outside an activity; inside one it " + "defaults to the activity's id and attempt" + ) + info = activity.info() + producer_id = info.activity_id + attempt = attempt or info.attempt return await _current().producer( client, workflow_id=workflow_id, diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 2244069b8..64e8feb8f 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -334,11 +334,6 @@ async def producer( producer_id: str = "", attempt: int = 0, ) -> MemoryProducer: - if not producer_id: - from temporalio import activity - - producer_id = activity.info().activity_id - attempt = attempt or activity.info().attempt # With no inbound stream named, the target is the store the workflow's # own writer appends to, and the frame carries the topic instead. return MemoryProducer( diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index a0cae8fc7..4db5b9fe9 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -210,6 +210,9 @@ async def test_producer_appends_onto_the_owners_topic(): with pytest.raises(ValueError): await streams.producer(None, workflow_id="wf", producer_id="model", attempt=1) + # Outside an activity there is no identity to fall back on. + with pytest.raises(ValueError, match="producer_id is required"): + await streams.producer(None, workflow_id="wf", stream="inputs") def test_unknown_provider_is_a_clear_error(): From fe4ec72c77ae7afefb73f5a0d4e157492e76d20f Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:28 -0700 Subject: [PATCH 13/51] Required an explicit provider and exported instance. Building a provider is process setup. Workers resolve the default through worker_options(); workflow code that opens a stream before that gets a clear error instead of a racy lazy build. --- temporalio/streams/__init__.py | 8 ++++-- temporalio/streams/_provider.py | 33 ++++++++++++++++------- tests/streams/test_streams_conformance.py | 12 ++++++++- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index cd55ee9d4..ea0d86c81 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -33,7 +33,9 @@ :func:`configure` once before it opens a :func:`producer` or a :func:`consumer`, and passes :func:`worker_options` to its ``Worker`` and ``Replayer``. Those two calls are where a provider is named. Nothing else in -this module mentions one. +this module mentions one. Code that needs a second provider next to the +process default, such as a handler that serves one store while its process +talks to another, holds one from :func:`instance`. Reading somebody else's stream is out of scope for the first release. It is the topology neither prototype has evidence for, and leaving it out is what @@ -68,6 +70,7 @@ configure, consumer, drain, + instance, open_read, open_write, prepare, @@ -99,10 +102,11 @@ "configure", "consumer", "drain", + "instance", "prepare", "producer", - "worker_options", "reader", + "worker_options", "writer", ] diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 2d8e14f2b..b22dbbfd8 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -4,8 +4,8 @@ around it are shared, so every provider module is small: it implements :class:`StreamProvider` and registers a factory under a short name when it is imported. One :func:`configure` call decides which factory serves this -process; when exactly one provider is registered, it is the default and the -call can be omitted. +process; :func:`worker_options` makes the same choice for a worker when +exactly one provider is registered. """ from __future__ import annotations @@ -26,6 +26,7 @@ "configure", "consumer", "drain", + "instance", "open_read", "open_write", "prepare", @@ -158,7 +159,7 @@ async def producer( async def consumer( self, client: Any, *, workflow_id: str, stream: str = "" ) -> Consumer: - """Open a reader for what ``workflow_id`` publishes.""" + """Open a reader on ``workflow_id``'s own stream, or its inbound ``stream``.""" ... @@ -240,16 +241,25 @@ def instance(provider: str | None = None, **options: Any) -> StreamProvider: def _current() -> StreamProvider: - global _active if _active is None: - chosen = _make(None) - chosen.configure() - _active = chosen + # Building a provider is process setup. Doing it on the first + # workflow's thread would race a second workflow thread for the + # global and hide the choice inside workflow code. + raise RuntimeError( + "no stream provider is configured; call streams.configure() or " + "streams.worker_options() before opening a stream" + ) return _active def worker_options() -> dict[str, Any]: - """What a ``Worker`` or ``Replayer`` needs to serve this provider.""" + """What a ``Worker`` or ``Replayer`` needs to serve this provider. + + Every worker calls this, so it is where the default is resolved when + :func:`configure` was not called and exactly one provider is registered. + """ + if _active is None: + configure() return _current().worker_options() @@ -335,5 +345,10 @@ async def producer( async def consumer(client: Any, *, workflow_id: str, stream: str = "") -> Consumer: - """Open a reader for what ``workflow_id`` publishes.""" + """Open a reader on ``workflow_id``'s own stream, or its inbound ``stream``. + + With no ``stream`` the reader follows what the workflow publishes, topic + by topic. With one, it follows the inbound stream of that name, which is + how a process watches what producers hand the workflow. + """ return await _current().consumer(client, workflow_id=workflow_id, stream=stream) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 4db5b9fe9..3a69ea2dd 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -15,7 +15,7 @@ import pytest from temporalio import streams -from temporalio.streams import _frame +from temporalio.streams import _frame, _provider from temporalio.streams._policy import AttemptTracker from temporalio.streams._record import Cursor, RecordKind from temporalio.streams.providers import memory @@ -218,3 +218,13 @@ async def test_producer_appends_onto_the_owners_topic(): def test_unknown_provider_is_a_clear_error(): with pytest.raises(RuntimeError, match="no stream provider 'nope'"): streams.configure(provider="nope") + + +async def test_opening_a_stream_needs_a_configured_provider(): + # Building a provider is process setup, so the first workflow's thread + # is not allowed to do it as a side effect of opening a stream. + _provider._active = None + with pytest.raises(RuntimeError, match="streams.configure"): + await streams.consumer(None, workflow_id="wf") + streams.configure(provider="memory") + assert await streams.consumer(None, workflow_id="wf") is not None From 0af0389ad012f1bef4af9a174baa8eeb3a16af9d Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:29 -0700 Subject: [PATCH 14/51] Typed the handles and records honestly. reader() and Consumer.read bind T through overloads, StreamRecord.value admits the control bodies it actually carries, writer() drops the type it ignored, and next() leaves the public surface. --- streams_demo/agent_loop.py | 3 ++- temporalio/streams/__init__.py | 33 ++++++++++++++++------- temporalio/streams/_handles.py | 13 +++------ temporalio/streams/_provider.py | 32 +++++++++++++++++++--- temporalio/streams/_record.py | 9 +++++-- temporalio/streams/providers/memory.py | 5 ++-- tests/streams/test_streams_conformance.py | 2 ++ 7 files changed, 70 insertions(+), 27 deletions(-) diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index 79d92c367..0ab6831b5 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -59,7 +59,7 @@ async def run(self, limit: int) -> list[dict[str, Any]]: accepted = 0 try: async for record in inputs: - if record.kind is streams.RecordKind.SUPERSEDED: + if isinstance(record.value, streams.Supersession): # A newer attempt of the same producer started writing. The # decisions already published stand, so the workflow says so # rather than pretending they can be withdrawn. @@ -82,6 +82,7 @@ async def run(self, limit: int) -> list[dict[str, Any]]: # still writing. trace.append({"kind": "finish", "producer": record.producer}) break + assert isinstance(record.value, dict) decision = decide(record.value) await decisions.publish(decision) receipt = await workflow.execute_activity( diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index ea0d86c81..1f1f6acba 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -54,7 +54,7 @@ from __future__ import annotations from datetime import timedelta -from typing import Any, TypeVar +from typing import Any, TypeVar, overload from temporalio.streams._handles import ( ReadSource, @@ -113,6 +113,26 @@ T = TypeVar("T") +@overload +def reader( + stream: str, + *, + type: type[T], + after: Cursor = ..., + idle_timeout: timedelta | None = ..., +) -> StreamReader[T]: ... + + +@overload +def reader( + stream: str, + *, + type: None = None, + after: Cursor = ..., + idle_timeout: timedelta | None = ..., +) -> StreamReader[Any]: ... + + def reader( stream: str, *, @@ -145,21 +165,16 @@ def reader( ) -def writer(topic: str, *, type: type | None = None) -> StreamWriter[Any]: +def writer(topic: str) -> StreamWriter[Any]: """Publish to ``topic`` on the stream this workflow owns. Args: - topic: The topic name. - type: Declared for symmetry with :func:`reader` and for documentation. - Encoding follows the value. + topic: The topic name. Encoding follows each published value. """ - del type return StreamWriter(open_write(topic), topic) # Importing the package registers every provider whose dependencies are # present in this tree. Import order matters: the registry above must exist # before a provider module can register with it. -from temporalio.streams import ( - providers as _providers, # noqa: E402,F401 # pyright: ignore[reportUnusedImport] -) +from temporalio.streams import providers as providers # noqa: E402 diff --git a/temporalio/streams/_handles.py b/temporalio/streams/_handles.py index a6dc9a073..24c6defa2 100644 --- a/temporalio/streams/_handles.py +++ b/temporalio/streams/_handles.py @@ -8,7 +8,7 @@ from __future__ import annotations from collections.abc import AsyncIterator -from typing import Any, Generic, Protocol, TypeVar +from typing import Any, Generic, Protocol, TypeVar, cast from temporalio import workflow from temporalio.api.common.v1 import Payload @@ -161,7 +161,7 @@ def __aiter__(self) -> AsyncIterator[StreamRecord[T]]: async def _iterate(self) -> AsyncIterator[StreamRecord[T]]: while not self._closed: try: - record = await self.next() + record = await self._next() except StopAsyncIteration: # The provider ended the subscription. Iteration stops rather # than raising, so a workflow that reads to the end of a @@ -173,14 +173,9 @@ async def values(self) -> AsyncIterator[T]: """Iterate the data values, dropping control records.""" async for record in self: if record.kind is RecordKind.DATA: - yield record.value + yield cast("T", record.value) - async def next(self) -> StreamRecord[T]: - """The next record, waiting for one if there is none buffered. - - Raises: - StopAsyncIteration: The provider ended the subscription. - """ + async def _next(self) -> StreamRecord[T]: while not self._pending: await self._fill() return self._pending.pop(0) diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index b22dbbfd8..1f9dc727d 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -10,9 +10,9 @@ from __future__ import annotations -from collections.abc import AsyncIterator +from collections.abc import AsyncGenerator from datetime import timedelta -from typing import Any, Callable, Protocol +from typing import Any, Callable, Protocol, TypeVar, overload from temporalio import activity from temporalio.streams._handles import ReadSource, WriteSink @@ -36,6 +36,8 @@ "worker_options", ] +T = TypeVar("T") + class Producer(Protocol): """Appends to a stream from outside workflow code. @@ -69,19 +71,41 @@ async def finish(self) -> None: class Consumer(Protocol): """Reads a stream from outside workflow code, resumably.""" + @overload + def read( + self, + *, + after: Cursor = ..., + topic: str | None = ..., + type: type[T], + ) -> AsyncGenerator[StreamRecord[T], None]: ... + + @overload + def read( + self, + *, + after: Cursor = ..., + topic: str | None = ..., + type: None = None, + ) -> AsyncGenerator[StreamRecord[Any], None]: ... + def read( self, *, after: Cursor = BEGINNING, topic: str | None = None, type: type | None = None, - ) -> AsyncIterator[StreamRecord[Any]]: + ) -> AsyncGenerator[StreamRecord[Any], None]: """Yield the records after ``after`` as they arrive. ``BEGINNING`` yields everything the stream retains. Any other cursor came from a record this or another reader saw, and reading resumes just past it, so a reader that stores the last cursor it handled and - hands it back sees every record exactly once. + hands it back sees every record exactly once. ``topic`` filters the + stream the workflow publishes; an inbound stream has no topics, and + naming one there raises ``ValueError``. The result is a generator so + a caller that stops early can ``aclose()`` it and release whatever + the provider parked against the store. """ ... diff --git a/temporalio/streams/_record.py b/temporalio/streams/_record.py index 4fd322189..5eb3e21e4 100644 --- a/temporalio/streams/_record.py +++ b/temporalio/streams/_record.py @@ -76,9 +76,14 @@ class Supersession: @dataclass(frozen=True) class StreamRecord(Generic[T]): - """One record as workflow code sees it.""" + """One record as workflow code sees it. - value: T + ``value`` follows ``kind``: a data record carries a ``T``, a supersession + carries the :class:`Supersession` it reports, and a finish marker carries + ``None``. Check ``kind`` before reading it. + """ + + value: T | Supersession | None cursor: Cursor kind: RecordKind = RecordKind.DATA topic: str = "" diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 64e8feb8f..fcf873184 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -17,7 +17,8 @@ from __future__ import annotations import asyncio -from collections.abc import AsyncIterator +import logging +from collections.abc import AsyncGenerator from datetime import timedelta from typing import Any @@ -240,7 +241,7 @@ async def read( after: Cursor = BEGINNING, topic: str | None = None, type: type | None = None, - ) -> AsyncIterator[StreamRecord[Any]]: + ) -> AsyncGenerator[StreamRecord[Any], None]: """Yield records after ``after``, waiting for ones not written yet.""" attempts = AttemptTracker() offset = int(after.token) + 1 if after.token else 0 diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 3a69ea2dd..47b6e29d5 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -68,6 +68,7 @@ def test_supersession_is_synthesized_from_observations(): superseded = attempts.note("model", 2, Cursor("1")) assert superseded is not None assert superseded.kind is RecordKind.SUPERSEDED + assert isinstance(superseded.value, streams.Supersession) assert superseded.value.previous_attempt == 1 # The same attempt again is not a new generation. assert attempts.note("model", 2, Cursor("2")) is None @@ -126,6 +127,7 @@ async def test_new_attempt_supersedes_the_old_one(): records = await take(consumer.read(type=dict), 3) assert records[0].kind is RecordKind.DATA and records[0].attempt == 1 assert records[1].kind is RecordKind.SUPERSEDED + assert isinstance(records[1].value, streams.Supersession) assert records[1].value.previous_attempt == 1 assert records[2].kind is RecordKind.DATA and records[2].attempt == 2 From 8a2bf8d2c99f5c1e588f7cf833b108aef823112a Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:29 -0700 Subject: [PATCH 15/51] Kept topics off inbound frames and skipped unreadable frames with a warning. An inbound stream's name is its whole address, so its records carry no topic and a topic filter there is a ValueError on every provider. Both readers now skip a frame the interface did not write and log it, instead of one failing the task while the other drops it silently. --- temporalio/streams/__init__.py | 10 +++---- temporalio/streams/_handles.py | 27 ++++++++++--------- temporalio/streams/_provider.py | 16 ++++++++++++ temporalio/streams/_record.py | 1 + temporalio/streams/providers/memory.py | 15 +++++++---- tests/streams/test_streams_conformance.py | 32 ++++++++++++++++------- 6 files changed, 69 insertions(+), 32 deletions(-) diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index 1f1f6acba..ff2a75c61 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -137,7 +137,6 @@ def reader( stream: str, *, type: type | None = None, - topic: str | None = None, after: Cursor = BEGINNING, idle_timeout: timedelta | None = None, ) -> StreamReader[Any]: @@ -147,10 +146,13 @@ def reader( removing or reordering one renumbers the waits after it. Gate a change behind :func:`temporalio.workflow.patched` as you would for a timer. + An inbound stream has no topics: its name is the whole address, and + every record on it arrives with an empty ``topic``. Topics belong to the + stream the workflow publishes, which :func:`consumer` reads from outside. + Args: stream: The inbound stream's name, relative to this workflow. type: The value type, used as the decode hint. - topic: Only records on this topic, or every topic when omitted. after: Resume after this record. Only honoured on the first subscription of a run, because after that the recorded cursor decides. @@ -159,9 +161,7 @@ def reader( provider's default. """ return StreamReader( - open_read(stream, after=after, idle_timeout=idle_timeout), - topic=topic, - type=type, + open_read(stream, after=after, idle_timeout=idle_timeout), type=type ) diff --git a/temporalio/streams/_handles.py b/temporalio/streams/_handles.py index 24c6defa2..9571d6e0c 100644 --- a/temporalio/streams/_handles.py +++ b/temporalio/streams/_handles.py @@ -1,8 +1,8 @@ """The handles workflow code holds. Everything provider-specific sits behind the two protocols at the top. A -handle converts values, frames records, filters topics and synthesizes -supersession; a binding only moves bytes. +handle converts values, frames records and synthesizes supersession; a +provider only moves bytes. """ from __future__ import annotations @@ -131,7 +131,7 @@ async def finish(self) -> None: class StreamReader(Generic[T]): - """Reads a stream from inside workflow code. + """Reads an inbound stream from inside workflow code. Iterating yields every kind of record, including the supersession the reader synthesizes when a producer's newer attempt appears. Check @@ -139,16 +139,9 @@ class StreamReader(Generic[T]): wants data. """ - def __init__( - self, - source: ReadSource, - *, - topic: str | None = None, - type: type | None = None, - ) -> None: + def __init__(self, source: ReadSource, *, type: type | None = None) -> None: """Prefer :func:`temporalio.streams.reader`.""" self._source = source - self._topic = topic self._type = type self._pending: list[StreamRecord[Any]] = [] self._attempts = AttemptTracker() @@ -182,8 +175,16 @@ async def _next(self) -> StreamRecord[T]: async def _fill(self) -> None: for cursor, frame in await self._source.next_batch(): - kind, topic, producer, attempt, sequence, body = _frame.decode(frame) - if self._topic is not None and topic != self._topic: + try: + kind, topic, producer, attempt, sequence, body = _frame.decode(frame) + except ValueError as error: + # Skipped rather than raised: a poisoned record would + # otherwise fail this task on every retry and pin the + # workflow, while an outside reader of the same stream + # skips it. The two readers agree on the answer. + workflow.logger.warning( + "skipping stream record at %s: %s", cursor, error + ) continue superseded = self._attempts.note(producer, attempt, cursor) if superseded is not None: diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 1f9dc727d..a2506649f 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -23,6 +23,7 @@ "Producer", "StreamProvider", "StreamProviderLifecycle", + "check_topic", "configure", "consumer", "drain", @@ -328,6 +329,21 @@ def drain() -> None: release() +def check_topic(stream: str, topic: str | None) -> None: + """Reject a topic filter on an inbound stream. + + An inbound record carries no topic; the stream's name is its whole + address, so a filter there could only ever match nothing. Every provider + calls this at the top of its ``read`` so the answer is the same on all + of them. + """ + if stream and topic is not None: + raise ValueError( + f"inbound stream {stream!r} has no topics; topic= applies to the " + "stream the workflow publishes" + ) + + async def producer( client: Any, *, diff --git a/temporalio/streams/_record.py b/temporalio/streams/_record.py index 5eb3e21e4..63f140aea 100644 --- a/temporalio/streams/_record.py +++ b/temporalio/streams/_record.py @@ -87,6 +87,7 @@ class StreamRecord(Generic[T]): cursor: Cursor kind: RecordKind = RecordKind.DATA topic: str = "" + """The topic on the owner's stream, or empty for an inbound record.""" producer: str = "" """Who wrote it, or empty when the owning workflow wrote it itself.""" attempt: int = 0 diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index fcf873184..ec1f78fc4 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -230,10 +230,11 @@ def _encode(self, value: Any) -> bytes: class MemoryConsumer: """The outside reader, with the shared supersession rule.""" - def __init__(self, store: _MemoryStream, converter: Any) -> None: + def __init__(self, store: _MemoryStream, converter: Any, stream: str) -> None: """Read whatever ``store`` holds, now and as it grows.""" self._store = store self._converter = converter + self._stream = stream async def read( self, @@ -243,6 +244,7 @@ async def read( type: type | None = None, ) -> AsyncGenerator[StreamRecord[Any], None]: """Yield records after ``after``, waiting for ones not written yet.""" + _provider.check_topic(self._stream, topic) attempts = AttemptTracker() offset = int(after.token) + 1 if after.token else 0 while True: @@ -256,7 +258,9 @@ async def read( kind, frame_topic, source, attempt, sequence, body = _frame.decode( frame ) - except ValueError: + except ValueError as error: + # Same answer as the workflow-side reader: skip and say so. + logger.warning("skipping stream record at %s: %s", cursor, error) continue if topic is not None and frame_topic != topic: continue @@ -336,11 +340,12 @@ async def producer( attempt: int = 0, ) -> MemoryProducer: # With no inbound stream named, the target is the store the workflow's - # own writer appends to, and the frame carries the topic instead. + # own writer appends to, and the frame carries the topic. An inbound + # record carries none: the stream's name is its whole address. return MemoryProducer( _stream(_inbound_id(workflow_id, stream)), _converter(client), - stream or topic, + topic, producer_id, attempt, ) @@ -349,7 +354,7 @@ async def consumer( self, client: Any, *, workflow_id: str, stream: str = "" ) -> MemoryConsumer: return MemoryConsumer( - _stream(_inbound_id(workflow_id, stream)), _converter(client) + _stream(_inbound_id(workflow_id, stream)), _converter(client), stream ) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 47b6e29d5..61eea6b70 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -91,6 +91,8 @@ async def test_append_read_roundtrip(): assert [r.value for r in records[:2]] == [{"id": "r1"}, {"id": "r2"}] assert all(r.producer == "model" and r.attempt == 1 for r in records) assert [r.sequence for r in records] == [0, 1, 2] + # An inbound stream has no topics; its name is the whole address. + assert all(r.topic == "" for r in records) async def test_retried_append_is_deduplicated(): @@ -132,19 +134,31 @@ async def test_new_attempt_supersedes_the_old_one(): assert records[2].kind is RecordKind.DATA and records[2].attempt == 2 -async def test_topic_filter(): - producer = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 +async def test_topic_filter_on_the_owners_stream(): + # Two producers on two topics of the stream the workflow publishes. The + # filter is only meaningful on a store that mixes topics, which is this + # one; an inbound stream carries none. + on_a = await streams.producer( + None, workflow_id="wf", topic="a", producer_id="tool-a", attempt=1 ) - await producer.append({"n": 1}) - other = await streams.producer( - None, workflow_id="wf", stream="other", producer_id="model", attempt=1 + await on_a.append({"n": 1}) + on_b = await streams.producer( + None, workflow_id="wf", topic="b", producer_id="tool-b", attempt=1 ) - await other.append({"n": 2}) + await on_b.append({"n": 2}) + + consumer = await streams.consumer(None, workflow_id="wf") + only_a = await take(consumer.read(type=dict, topic="a"), 1) + assert [r.value for r in only_a] == [{"n": 1}] + + both = await take(consumer.read(type=dict), 2) + assert [(r.topic, r.value) for r in both] == [("a", {"n": 1}), ("b", {"n": 2})] + +async def test_inbound_streams_have_no_topics(): consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - records = await take(consumer.read(type=dict, topic="inputs"), 1) - assert records[0].value == {"n": 1} + with pytest.raises(ValueError, match="inbound stream 'inputs' has no topics"): + await take(consumer.read(type=dict, topic="inputs"), 1) async def test_cursor_resumes_where_it_points(): From 35b12128b5a116ece9e6cb3e912fb57e42c48ffb Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:29 -0700 Subject: [PATCH 16/51] Let a broken provider import surface instead of vanishing from the registry. --- temporalio/streams/providers/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/temporalio/streams/providers/__init__.py b/temporalio/streams/providers/__init__.py index dff94b250..c254db0fb 100644 --- a/temporalio/streams/providers/__init__.py +++ b/temporalio/streams/providers/__init__.py @@ -13,7 +13,13 @@ for _name in _KNOWN: try: __import__(f"{__name__}.{_name}") - except ImportError: - # This tree does not carry that provider. The registry error message - # lists what is actually available. - pass + except ModuleNotFoundError as error: + # Two things may be missing: the provider module itself, or a + # dependency from outside this package. A name missing inside + # temporalio is a broken provider, and hiding that would turn its + # traceback into "no such provider". + missing = error.name or "" + if missing != f"{__name__}.{_name}" and ( + not missing or missing.startswith("temporalio") + ): + raise From 6e48b54c52bad3c903ad053458e3de1dcbf51c12 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:29 -0700 Subject: [PATCH 17/51] Added the workflow-side conformance tests. The reader and writer handles run in a real workflow on the memory provider. Rule 1 and rule 2 are strict expected failures there, so a storage provider running this module turns them into passes. --- tests/streams/test_streams_conformance.py | 5 +- tests/streams/test_streams_workflow.py | 208 ++++++++++++++++++++++ 2 files changed, 211 insertions(+), 2 deletions(-) create mode 100644 tests/streams/test_streams_workflow.py diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 61eea6b70..b66756af9 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -1,10 +1,11 @@ -"""Conformance tests for the stream contract. +"""Conformance tests for the stream contract's outside surface. Written against the public surface plus the in-memory reference provider, so they run with no server and no store. A storage provider reuses the same expectations through its own fixtures; what this file pins down is the contract: framing, producer identity, retry deduplication, supersession, -topic filtering, and cursor resumption. +topic filtering, and cursor resumption. The workflow-side handles and the +two rules about workflow tasks live in ``test_streams_workflow``. """ from __future__ import annotations diff --git a/tests/streams/test_streams_workflow.py b/tests/streams/test_streams_workflow.py new file mode 100644 index 000000000..40487686d --- /dev/null +++ b/tests/streams/test_streams_workflow.py @@ -0,0 +1,208 @@ +"""Workflow-side conformance for the stream contract. + +Runs the reader and writer handles inside a real workflow on the memory +provider with a warm cache, and states the two rules about workflow tasks as +tests: a publish commits with its task (rule 1), and reads are recorded +observations that replay re-supplies (rule 2). The memory provider keeps +neither and says so in its docstring, so those two are strict expected +failures here. A storage provider that runs this module turns them into +passes; that is the measurement they exist for. +""" + +from __future__ import annotations + +import uuid +from typing import Any + +import pytest + +from temporalio import streams, workflow +from temporalio.client import Client +from temporalio.streams import RecordKind +from temporalio.streams.providers import memory +from temporalio.testing import WorkflowEnvironment +from temporalio.worker import Replayer +from tests.helpers import new_worker +from tests.streams.test_streams_conformance import take + +INPUTS = "inputs" +DECISIONS = "decisions" + + +@pytest.fixture(autouse=True) +def _fresh_memory_provider(env: WorkflowEnvironment): # pyright: ignore[reportUnusedFunction] + if env.supports_time_skipping: + pytest.skip( + "the memory provider polls on a timer, which time skipping turns into a spin" + ) + memory.reset() + streams.configure(provider="memory") + yield + memory.reset() + + +@workflow.defn +class ContractLoop: + """Reads ``inputs``, publishes a decision per value, reports control records.""" + + def __init__(self) -> None: + streams.prepare() + + @workflow.run + async def run(self) -> list[dict[str, Any]]: + inputs = streams.reader(INPUTS, type=dict) + decisions = streams.writer(DECISIONS) + trace: list[dict[str, Any]] = [] + try: + async for record in inputs: + if isinstance(record.value, streams.Supersession): + trace.append( + { + "kind": "superseded", + "replaced": record.value.previous_attempt, + "attempt": record.value.attempt, + } + ) + await decisions.publish( + {"retracting_attempt": record.value.previous_attempt} + ) + continue + if record.kind is RecordKind.FINISH: + trace.append({"kind": "finish", "producer": record.producer}) + break + assert isinstance(record.value, dict) + await decisions.publish({"decided": record.value["n"]}) + trace.append( + { + "kind": "decision", + "n": record.value["n"], + "attempt": record.attempt, + } + ) + finally: + inputs.close() + await decisions.finish() + # Twice on purpose: a finished topic stays finished, with one marker. + await decisions.finish() + streams.drain() + return trace + + +async def _run_the_loop(client: Client) -> tuple[Any, list[dict[str, Any]]]: + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker(client, ContractLoop, **streams.worker_options()) as worker: + handle = await client.start_workflow( + ContractLoop.run, id=workflow_id, task_queue=worker.task_queue + ) + first = await streams.producer( + client, + workflow_id=workflow_id, + stream=INPUTS, + producer_id="model", + attempt=1, + ) + await first.append({"n": 1}, {"n": 2}) + second = await streams.producer( + client, + workflow_id=workflow_id, + stream=INPUTS, + producer_id="model", + attempt=2, + ) + await second.append({"n": 3}) + await second.finish() + trace = await handle.result() + return handle, trace + + +async def test_workflow_reads_decides_and_publishes(client: Client): + handle, trace = await _run_the_loop(client) + assert trace == [ + {"kind": "decision", "n": 1, "attempt": 1}, + {"kind": "decision", "n": 2, "attempt": 1}, + {"kind": "superseded", "replaced": 1, "attempt": 2}, + {"kind": "decision", "n": 3, "attempt": 2}, + {"kind": "finish", "producer": "model"}, + ] + + # The outside view of what the workflow published, on its own topic. + consumer = await streams.consumer(client, workflow_id=handle.id) + records = await take(consumer.read(type=dict, topic=DECISIONS), 5) + assert [(r.kind, r.value) for r in records] == [ + (RecordKind.DATA, {"decided": 1}), + (RecordKind.DATA, {"decided": 2}), + (RecordKind.DATA, {"retracting_attempt": 1}), + (RecordKind.DATA, {"decided": 3}), + (RecordKind.FINISH, None), + ] + assert all(r.producer == "" and r.topic == DECISIONS for r in records) + # The second finish() wrote nothing: the marker is the newest record. + assert await consumer.latest() == records[-1].cursor + + +@pytest.mark.xfail( + strict=True, + reason=( + "rule 2: reading is a recorded observation, so replaying the history " + "with the store gone must re-supply the same records; the memory " + "provider reads live process memory instead" + ), +) +async def test_replay_without_the_store_resupplies_the_records(client: Client): + handle, _ = await _run_the_loop(client) + history = await handle.fetch_history() + + memory.reset() + replayer = Replayer(workflows=[ContractLoop], **streams.worker_options()) + await replayer.replay_workflow(history) + + +# Run ids whose first workflow task already failed, shared with the workflow +# thread so the retry can tell it is the retry. Outside the sandbox on +# purpose: the sandbox re-imports this module per run and would hide the set. +_failed_once: set[str] = set() + + +@workflow.defn(sandboxed=False) +class PublishThenFail: + """Publishes, then fails its first workflow task; the retry publishes again.""" + + def __init__(self) -> None: + streams.prepare() + + @workflow.run + async def run(self) -> None: + decisions = streams.writer(DECISIONS) + run_id = workflow.info().run_id + committed = run_id in _failed_once + await decisions.publish({"committed": committed}) + if not committed: + _failed_once.add(run_id) + raise RuntimeError("the first task fails after publishing") + await decisions.finish() + streams.drain() + + +@pytest.mark.xfail( + strict=True, + reason=( + "rule 1: a publish commits with its workflow task, so no reader sees " + "a record from a task that failed; the memory provider makes it " + "visible at publish time" + ), +) +async def test_a_failed_task_publishes_nothing(client: Client): + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker( + client, PublishThenFail, **streams.worker_options() + ) as worker: + handle = await client.start_workflow( + PublishThenFail.run, id=workflow_id, task_queue=worker.task_queue + ) + consumer = await streams.consumer(client, workflow_id=workflow_id) + records = await take(consumer.read(type=dict, topic=DECISIONS), 2, timeout=30) + await handle.result() + assert [(r.kind, r.value) for r in records] == [ + (RecordKind.DATA, {"committed": True}), + (RecordKind.FINISH, None), + ] From 360d05424b1e31df5e33a37e551c39cf0210398b Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 16:41:29 -0700 Subject: [PATCH 18/51] Replaced stale wording and renamed the demo types. --- streams_demo/agent_loop.py | 6 +++--- streams_demo/run_demo.py | 4 ++-- temporalio/streams/__init__.py | 10 +++++----- temporalio/streams/_frame.py | 6 +++--- temporalio/streams/_handles.py | 6 +++--- temporalio/streams/_record.py | 7 ++++--- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index 0ab6831b5..f6f14b873 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -1,4 +1,4 @@ -"""One agent loop, written once, run on both stream providers. +"""One agent loop, written once, run on every stream provider. Reads input, decides on it, publishes the decision, and runs an ordinary Activity in the same workflow task. Also handles the two control records the @@ -20,7 +20,7 @@ INPUTS = "inputs" -@activity.defn(name="AI198RecordDecision") +@activity.defn(name="RecordDecision") async def record_decision(decision: dict[str, Any]) -> str: """An ordinary command in the same task as the publish.""" return f"recorded:{decision['source']}:{decision['branch']}" @@ -37,7 +37,7 @@ def decide(token: dict[str, Any]) -> dict[str, Any]: return {"source": token["id"], "branch": "odd", "computed": token["value"] + 100} -@workflow.defn(name="AI198StreamContractDemo", sandboxed=False) +@workflow.defn(name="StreamContractDemo", sandboxed=False) class AgentLoop: """Read, decide, write, until the producer says it has finished.""" diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index 9d6a62cb5..c4fc8e042 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -1,6 +1,6 @@ """Run the shared agent loop against whichever provider is configured. -Three cases, the same on both providers: +Three cases, the same on every provider: - read, decide, publish and an ordinary Activity in the same workflow task, with the smallest workflow cache the provider supports, so that as much of @@ -9,7 +9,7 @@ to report and the workflow has to act on; - an outside consumer reading what the workflow published. -Byte-identical in both trees. ``provider_setup`` is what differs, and it is +Byte-identical in every tree. ``provider_setup`` is what differs, and it is the only import here that names a provider. """ diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index ff2a75c61..c46a9faf0 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -38,17 +38,17 @@ talks to another, holds one from :func:`instance`. Reading somebody else's stream is out of scope for the first release. It is -the topology neither prototype has evidence for, and leaving it out is what -lets both of them implement the rest. +the topology no provider has evidence for, and leaving it out is what lets +every provider implement the rest. What the contract does not promise: that a :attr:`RecordKind.FINISH` record means the writing activity succeeded, that a superseded attempt's records can be withdrawn, or that a stream outlives the retention its provider is configured for. -Prototype support for AI-198. The public names are the proposal; providers -live under :mod:`temporalio.streams.providers`, one module each, registered -by name and chosen by :func:`configure`. Everything else is shared. +The public names are the proposal; providers live under +:mod:`temporalio.streams.providers`, one module each, registered by name and +chosen by :func:`configure`. Everything else is shared. """ from __future__ import annotations diff --git a/temporalio/streams/_frame.py b/temporalio/streams/_frame.py index c32811d32..df4b4dbd6 100644 --- a/temporalio/streams/_frame.py +++ b/temporalio/streams/_frame.py @@ -1,9 +1,9 @@ -"""The record envelope both bindings put on the wire. +"""The record envelope every provider puts on the wire. A provider stores an opaque body. The contract needs more than a body: which topic a record belongs to, whether it is data or a terminal marker, and which -producer attempt wrote it. Neither prototype carries all of that in a channel -of its own, so the interface carries it here and each binding stores the result +producer attempt wrote it. No provider carries all of that in a channel of +its own, so the interface carries it here and each provider stores the result as an ordinary body. Encoding is synchronous and deterministic because a workflow publishes on the diff --git a/temporalio/streams/_handles.py b/temporalio/streams/_handles.py index 9571d6e0c..6d821f32c 100644 --- a/temporalio/streams/_handles.py +++ b/temporalio/streams/_handles.py @@ -72,9 +72,9 @@ def _decode_value(body: bytes, as_type: type | None) -> Any: class StreamWriter(Generic[T]): """Publishes to a topic on the stream this workflow owns. - A workflow can only publish transactionally to a stream it owns, on both - providers. Writing to somebody else's stream is an activity's job, and it - gets the weaker guarantee that goes with doing I/O. + A workflow can only publish transactionally to a stream it owns, on + every provider. Writing to somebody else's stream is an activity's job, + and it gets the weaker guarantee that goes with doing I/O. """ def __init__(self, sink: WriteSink, topic: str) -> None: diff --git a/temporalio/streams/_record.py b/temporalio/streams/_record.py index 63f140aea..1f08302a8 100644 --- a/temporalio/streams/_record.py +++ b/temporalio/streams/_record.py @@ -1,6 +1,6 @@ """The value types the stream contract is expressed in. -Nothing here touches Temporal or a provider, so both bindings share it +Nothing here touches Temporal or a provider, so every provider shares it unchanged. """ @@ -39,8 +39,9 @@ class RecordKind(enum.IntEnum): SUPERSEDED = 3 """A later attempt of the same producer started writing. - Synthesized by the reader from what it observed, so both providers deliver - it identically and replay reproduces it without the provider's help. + Synthesized by the reader from what it observed, so every provider + delivers it identically and replay reproduces it without the provider's + help. """ From 936a725541bd338123ff335ad366090213d36a8f Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 17:09:22 -0700 Subject: [PATCH 19/51] Keyed stores by one helper that survives a colon in the workflow id. Joining the workflow id and the stream name with a bare colon let two addresses share a store. Every provider that keys by the pair now goes through stream_key, which percent-encodes both components first. --- temporalio/streams/_ids.py | 28 ++++++++++++++++++++++++++ temporalio/streams/providers/memory.py | 13 +++++------- 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 temporalio/streams/_ids.py diff --git a/temporalio/streams/_ids.py b/temporalio/streams/_ids.py new file mode 100644 index 000000000..625522f75 --- /dev/null +++ b/temporalio/streams/_ids.py @@ -0,0 +1,28 @@ +"""The store key a provider derives from a workflow id and a stream name. + +A workflow id may contain any character, ``:`` included, so joining the pair +with a bare ``:`` is ambiguous: ``("a:b", "c")`` and ``("a", "b:c")`` would +land in one store. Every provider that keys a store by the pair goes through +:func:`stream_key`, so they all agree and none of them collides. +""" + +from __future__ import annotations + +__all__ = ["stream_key"] + + +def _escape(component: str) -> str: + # Percent first, so an escaped component cannot be mistaken for one that + # already contained the escape. + return component.replace("%", "%25").replace(":", "%3A") + + +def stream_key(workflow_id: str, stream: str) -> str: + """The key for ``stream`` of ``workflow_id``, or for the owner's stream when empty. + + Both components are percent-encoded before joining, so the only bare ``:`` + in the result is the separator, and an owner-stream key has none. + """ + if not stream: + return _escape(workflow_id) + return f"{_escape(workflow_id)}:{_escape(stream)}" diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index ec1f78fc4..390c10b9c 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -27,6 +27,7 @@ from temporalio.api.common.v1 import Payload from temporalio.streams import _frame, _provider from temporalio.streams._handles import ReadSource, WriteSink +from temporalio.streams._ids import stream_key from temporalio.streams._policy import AttemptTracker from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord @@ -90,10 +91,6 @@ def reset() -> None: _streams.clear() -def _inbound_id(workflow_id: str, stream: str) -> str: - return f"{workflow_id}:{stream}" if stream else workflow_id - - def _converter(client: Any) -> Any: if client is None: return temporalio.converter.DataConverter.default.payload_converter @@ -320,13 +317,13 @@ def open_read( # idle_timeout as the poll period would give the parameter a second # meaning that a port copying the reference would copy too. del idle_timeout - store = _stream(_inbound_id(workflow.info().workflow_id, stream)) + store = _stream(stream_key(workflow.info().workflow_id, stream)) return _MemReadSource( store, int(after.token) + 1 if after.token else 0, self._poll ) def open_write(self, topic: str) -> WriteSink: - store = _stream(_inbound_id(workflow.info().workflow_id, "")) + store = _stream(stream_key(workflow.info().workflow_id, "")) return _MemWriteSink(store, topic) async def producer( @@ -343,7 +340,7 @@ async def producer( # own writer appends to, and the frame carries the topic. An inbound # record carries none: the stream's name is its whole address. return MemoryProducer( - _stream(_inbound_id(workflow_id, stream)), + _stream(stream_key(workflow_id, stream)), _converter(client), topic, producer_id, @@ -354,7 +351,7 @@ async def consumer( self, client: Any, *, workflow_id: str, stream: str = "" ) -> MemoryConsumer: return MemoryConsumer( - _stream(_inbound_id(workflow_id, stream)), _converter(client), stream + _stream(stream_key(workflow_id, stream)), _converter(client), stream ) From ad7c5772a7bf398dda47f8bc113964fd8292e126 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 17:09:22 -0700 Subject: [PATCH 20/51] Added an async close hook next to prepare and drain. A provider that holds a connection pool or an HTTP session needs a moment where the process says it is done. It is a no-op when nothing is configured, so a shutdown path can call it unconditionally. --- temporalio/streams/__init__.py | 10 ++++++++++ temporalio/streams/_provider.py | 30 +++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index c46a9faf0..f564135fd 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -37,6 +37,14 @@ process default, such as a handler that serves one store while its process talks to another, holds one from :func:`instance`. +Three lifecycle hooks let a provider borrow the caller's lifetime, and each +is a no-op on a provider that needs nothing, so portable code calls all +three unconditionally: :func:`prepare` from the workflow's constructor, for a +transport that registers handlers on the workflow; :func:`drain` before the +workflow returns, for one that parks readers against the run; and +:func:`close`, awaited when the process is done with streams, for one that +holds connections. + Reading somebody else's stream is out of scope for the first release. It is the topology no provider has evidence for, and leaving it out is what lets every provider implement the rest. @@ -67,6 +75,7 @@ Producer, StreamProvider, StreamProviderLifecycle, + close, configure, consumer, drain, @@ -99,6 +108,7 @@ "StreamWriter", "Supersession", "WriteSink", + "close", "configure", "consumer", "drain", diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index a2506649f..89e32a2c7 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -24,6 +24,7 @@ "StreamProvider", "StreamProviderLifecycle", "check_topic", + "close", "configure", "consumer", "drain", @@ -191,9 +192,10 @@ async def consumer( class StreamProviderLifecycle(Protocol): """The hooks a provider adds when it needs the workflow's own lifetime. - Separate from :class:`StreamProvider` because most transports need - neither, and a provider is not asked to carry a pair of empty methods to - say so. :func:`prepare` and :func:`drain` call whichever half is present. + Separate from :class:`StreamProvider` because most transports need none + of them, and a provider is not asked to carry empty methods to say so. + :func:`prepare`, :func:`drain` and :func:`close` each call the hook when + the provider defines it. """ def prepare(self) -> None: @@ -214,6 +216,14 @@ def drain(self) -> None: """ ... + async def close(self) -> None: + """Release what this provider holds for the process. + + A provider that keeps a connection pool or an HTTP session open needs + a moment where the process says it is done; this is it. + """ + ... + _factories: dict[str, Callable[[], StreamProvider]] = {} _active: StreamProvider | None = None @@ -329,6 +339,20 @@ def drain() -> None: release() +async def close() -> None: + """Release what the provider holds for this process. + + Await it when the process is done with streams. It is a no-op on + providers that hold nothing, and on a process that never configured one, + so a shutdown path can call it unconditionally. + """ + if _active is None: + return + release = getattr(_active, "close", None) + if release is not None: + await release() + + def check_topic(stream: str, topic: str | None) -> None: """Reject a topic filter on an inbound stream. From 27fb594f0897688f0eb705953386027816f41a71 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 17:09:22 -0700 Subject: [PATCH 21/51] Parametrised the conformance suite over providers. The memory provider always runs; a store branch registers its own setup behind its STREAMS_LIVE gate and declares the capabilities it lacks, which the fixture turns into skips with a reason. Cases read with a topic wherever they can, and two new cases prove colon-bearing addresses never share a store. --- tests/streams/conftest.py | 12 + tests/streams/test_streams_conformance.py | 309 +++++++++++++++++----- 2 files changed, 255 insertions(+), 66 deletions(-) create mode 100644 tests/streams/conftest.py diff --git a/tests/streams/conftest.py b/tests/streams/conftest.py new file mode 100644 index 000000000..1758f2598 --- /dev/null +++ b/tests/streams/conftest.py @@ -0,0 +1,12 @@ +import pytest + + +def pytest_configure(config: pytest.Config) -> None: + config.addinivalue_line( + "markers", + "inbound_stream: the case writes a workflow's inbound stream from outside", + ) + config.addinivalue_line( + "markers", + "unfiltered_read: the case reads the owner's stream without naming a topic", + ) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index b66756af9..0a50ce2cb 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -1,35 +1,79 @@ """Conformance tests for the stream contract's outside surface. -Written against the public surface plus the in-memory reference provider, so -they run with no server and no store. A storage provider reuses the same -expectations through its own fixtures; what this file pins down is the -contract: framing, producer identity, retry deduplication, supersession, -topic filtering, and cursor resumption. The workflow-side handles and the -two rules about workflow tasks live in ``test_streams_workflow``. +Written against the public surface, parametrised over the providers this +tree can stand up. The memory provider always runs, with no server and no +store. A storage provider adds itself to ``SETUPS`` behind its own +``STREAMS_LIVE`` gate: its setup configures the provider, hands back the +client the cases should use, and says which capabilities it lacks, so the +cases marked ``inbound_stream`` or ``unfiltered_read`` are skipped with a +reason on a provider that cannot do them. Every other case reads with a +topic, which is what a store that keys by topic needs. + +What this file pins down is the contract: framing, producer identity, retry +deduplication, supersession, topic filtering, cursor resumption, and store +keys that cannot collide. The workflow-side handles and the two rules about +workflow tasks live in ``test_streams_workflow``. """ from __future__ import annotations import asyncio +import uuid +from collections.abc import AsyncIterator, Callable +from dataclasses import dataclass from typing import Any import pytest from temporalio import streams -from temporalio.streams import _frame, _provider +from temporalio.streams import _frame, _ids, _provider from temporalio.streams._policy import AttemptTracker from temporalio.streams._record import Cursor, RecordKind from temporalio.streams.providers import memory -@pytest.fixture(autouse=True) -def _fresh_memory_provider(): # pyright: ignore[reportUnusedFunction] +@dataclass +class ProviderCase: + """One provider under test, and what the cases may ask of it.""" + + name: str + client: Any = None + inbound_streams: bool = True + """Outside producers may write a workflow's inbound stream.""" + unfiltered_reads: bool = True + """A consumer may read the owner's stream without naming a topic.""" + + +async def _memory_case() -> AsyncIterator[ProviderCase]: memory.reset() streams.configure(provider="memory") - yield + yield ProviderCase("memory") memory.reset() +SETUPS: dict[str, Callable[[], AsyncIterator[ProviderCase]]] = {"memory": _memory_case} + +_CAPABILITIES = { + "inbound_stream": lambda case: case.inbound_streams, + "unfiltered_read": lambda case: case.unfiltered_reads, +} + + +@pytest.fixture(params=sorted(SETUPS)) +async def provider(request: pytest.FixtureRequest) -> AsyncIterator[ProviderCase]: + async for case in SETUPS[request.param](): + for marker, supported in _CAPABILITIES.items(): + if request.node.get_closest_marker(marker) and not supported(case): + pytest.skip(f"the {case.name} provider does not support {marker}") + yield case + + +def new_workflow_id() -> str: + # Unique per case, because a storage provider keeps what earlier cases + # wrote and the memory provider only happens to forget. + return f"wf-{uuid.uuid4().hex}" + + async def take(records: Any, count: int, timeout: float = 5.0) -> list: out: list = [] @@ -75,15 +119,28 @@ def test_supersession_is_synthesized_from_observations(): assert attempts.note("model", 2, Cursor("2")) is None -async def test_append_read_roundtrip(): +def test_stream_keys_cannot_collide(): + # A colon in a workflow id must not make two addresses one key. + assert _ids.stream_key("a:b", "c") != _ids.stream_key("a", "b:c") + assert _ids.stream_key("a:b", "") != _ids.stream_key("a", "b") + assert _ids.stream_key("a%3Ab", "c") != _ids.stream_key("a:b", "c") + assert _ids.stream_key("wf", "inputs") == "wf:inputs" + + +async def test_append_read_roundtrip(provider: ProviderCase): + workflow_id = new_workflow_id() producer = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) await producer.append({"id": "r1"}, {"id": "r2"}) await producer.finish() - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - records = await take(consumer.read(type=dict), 3) + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + records = await take(consumer.read(type=dict, topic="out"), 3) assert [r.kind for r in records] == [ RecordKind.DATA, RecordKind.DATA, @@ -92,42 +149,84 @@ async def test_append_read_roundtrip(): assert [r.value for r in records[:2]] == [{"id": "r1"}, {"id": "r2"}] assert all(r.producer == "model" and r.attempt == 1 for r in records) assert [r.sequence for r in records] == [0, 1, 2] + assert all(r.topic == "out" for r in records) + + +@pytest.mark.inbound_stream +async def test_inbound_records_carry_no_topic(provider: ProviderCase): + workflow_id = new_workflow_id() + producer = await streams.producer( + provider.client, + workflow_id=workflow_id, + stream="inputs", + producer_id="model", + attempt=1, + ) + await producer.append({"id": "r1"}) + await producer.finish() + + consumer = await streams.consumer( + provider.client, workflow_id=workflow_id, stream="inputs" + ) + records = await take(consumer.read(type=dict), 2) + assert [r.kind for r in records] == [RecordKind.DATA, RecordKind.FINISH] + assert records[0].value == {"id": "r1"} # An inbound stream has no topics; its name is the whole address. assert all(r.topic == "" for r in records) + with pytest.raises(ValueError, match="inbound stream 'inputs' has no topics"): + await take(consumer.read(type=dict, topic="inputs"), 1) -async def test_retried_append_is_deduplicated(): +async def test_retried_append_is_deduplicated(provider: ProviderCase): + workflow_id = new_workflow_id() first = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) await first.append({"id": "r1"}) # The retry of the same attempt starts its sequence over and appends the # same record. The provider must not store it twice, and says so by # returning no position for what it dropped. retry = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) assert await retry.append({"id": "r1"}) is None - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - records = await take(consumer.read(type=dict), 1) + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + records = await take(consumer.read(type=dict, topic="out"), 1) assert records[0].value == {"id": "r1"} # The store holds exactly the one record: the newest position is its cursor. - assert await consumer.latest() == records[0].cursor + assert await consumer.latest(topic="out") == records[0].cursor -async def test_new_attempt_supersedes_the_old_one(): +async def test_new_attempt_supersedes_the_old_one(provider: ProviderCase): + workflow_id = new_workflow_id() first = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) await first.append({"text": "The capital of"}) second = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=2 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=2, ) await second.append({"text": "Paris is the capital"}) - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - records = await take(consumer.read(type=dict), 3) + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + records = await take(consumer.read(type=dict, topic="out"), 3) assert records[0].kind is RecordKind.DATA and records[0].attempt == 1 assert records[1].kind is RecordKind.SUPERSEDED assert isinstance(records[1].value, streams.Supersession) @@ -135,101 +234,175 @@ async def test_new_attempt_supersedes_the_old_one(): assert records[2].kind is RecordKind.DATA and records[2].attempt == 2 -async def test_topic_filter_on_the_owners_stream(): +async def test_topic_filter_on_the_owners_stream(provider: ProviderCase): # Two producers on two topics of the stream the workflow publishes. The # filter is only meaningful on a store that mixes topics, which is this # one; an inbound stream carries none. + workflow_id = new_workflow_id() on_a = await streams.producer( - None, workflow_id="wf", topic="a", producer_id="tool-a", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="a", + producer_id="tool-a", + attempt=1, ) await on_a.append({"n": 1}) on_b = await streams.producer( - None, workflow_id="wf", topic="b", producer_id="tool-b", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="b", + producer_id="tool-b", + attempt=1, ) await on_b.append({"n": 2}) - consumer = await streams.consumer(None, workflow_id="wf") + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) only_a = await take(consumer.read(type=dict, topic="a"), 1) - assert [r.value for r in only_a] == [{"n": 1}] + assert [(r.topic, r.value) for r in only_a] == [("a", {"n": 1})] + only_b = await take(consumer.read(type=dict, topic="b"), 1) + assert [(r.topic, r.value) for r in only_b] == [("b", {"n": 2})] - both = await take(consumer.read(type=dict), 2) - assert [(r.topic, r.value) for r in both] == [("a", {"n": 1}), ("b", {"n": 2})] +@pytest.mark.unfiltered_read +async def test_a_read_without_a_topic_sees_every_topic(provider: ProviderCase): + workflow_id = new_workflow_id() + on_a = await streams.producer( + provider.client, + workflow_id=workflow_id, + topic="a", + producer_id="tool-a", + attempt=1, + ) + await on_a.append({"n": 1}) + on_b = await streams.producer( + provider.client, + workflow_id=workflow_id, + topic="b", + producer_id="tool-b", + attempt=1, + ) + await on_b.append({"n": 2}) -async def test_inbound_streams_have_no_topics(): - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - with pytest.raises(ValueError, match="inbound stream 'inputs' has no topics"): - await take(consumer.read(type=dict, topic="inputs"), 1) + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + both = await take(consumer.read(type=dict), 2) + assert [(r.topic, r.value) for r in both] == [("a", {"n": 1}), ("b", {"n": 2})] -async def test_cursor_resumes_where_it_points(): +async def test_cursor_resumes_where_it_points(provider: ProviderCase): + workflow_id = new_workflow_id() producer = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) await producer.append({"n": 1}, {"n": 2}, {"n": 3}) - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - records = await take(consumer.read(type=dict), 3) + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + records = await take(consumer.read(type=dict, topic="out"), 3) checkpoint = records[0].cursor # Resuming after a record hands back everything past it and nothing # twice, without the reader ever advancing a cursor itself. - resumed = await streams.consumer(None, workflow_id="wf", stream="inputs") - again = await take(resumed.read(type=dict, after=checkpoint), 2) + resumed = await streams.consumer(provider.client, workflow_id=workflow_id) + again = await take(resumed.read(type=dict, topic="out", after=checkpoint), 2) assert [r.value for r in again] == [{"n": 2}, {"n": 3}] -async def test_append_cursor_names_the_last_record_of_the_batch(): +async def test_append_cursor_names_the_last_record_of_the_batch( + provider: ProviderCase, +): + workflow_id = new_workflow_id() producer = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) appended = await producer.append({"n": 1}, {"n": 2}, {"n": 3}) - assert appended is not None + if appended is None: + pytest.skip(f"the {provider.name} provider learns positions at read time") await producer.append({"n": 4}) # A producer that resumes a reader after its own append must see only # what came later, not the tail of the batch it just wrote. - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - records = await take(consumer.read(type=dict, after=appended), 1) + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + records = await take(consumer.read(type=dict, topic="out", after=appended), 1) assert [r.value for r in records] == [{"n": 4}] assert await producer.append() is None -async def test_latest_positions_a_reader_at_the_end(): +async def test_latest_positions_a_reader_at_the_end(provider: ProviderCase): + workflow_id = new_workflow_id() producer = await streams.producer( - None, workflow_id="wf", stream="inputs", producer_id="model", attempt=1 + provider.client, + workflow_id=workflow_id, + topic="out", + producer_id="model", + attempt=1, ) - consumer = await streams.consumer(None, workflow_id="wf", stream="inputs") - assert await consumer.latest() == streams.BEGINNING + consumer = await streams.consumer(provider.client, workflow_id=workflow_id) + assert await consumer.latest(topic="out") == streams.BEGINNING await producer.append({"n": 1}, {"n": 2}) - since = await consumer.latest() + since = await consumer.latest(topic="out") await producer.append({"n": 3}) # A reader that positioned itself before the last append sees only what # came after, which is how a client follows a turn it is about to start. - records = await take(consumer.read(type=dict, after=since), 1) + records = await take(consumer.read(type=dict, topic="out", after=since), 1) assert [r.value for r in records] == [{"n": 3}] -async def test_producer_appends_onto_the_owners_topic(): - # An activity's live output lands on the same topic the workflow - # publishes, so one outside reader follows both. - producer = await streams.producer( - None, workflow_id="wf", topic="events", producer_id="model", attempt=1 +@pytest.mark.inbound_stream +async def test_stream_addresses_with_colons_do_not_share_a_store( + provider: ProviderCase, +): + # ("wf:x", "y") and ("wf", "x:y") differ only in where the colon sits. + base = new_workflow_id() + left = await streams.producer( + provider.client, workflow_id=f"{base}:x", stream="y", producer_id="l", attempt=1 ) - await producer.append({"delta": "hel"}, {"delta": "lo"}) - - consumer = await streams.consumer(None, workflow_id="wf") - records = await take(consumer.read(type=dict, topic="events"), 2) - assert [r.value["delta"] for r in records] == ["hel", "lo"] - assert {r.producer for r in records} == {"model"} + right = await streams.producer( + provider.client, workflow_id=base, stream="x:y", producer_id="r", attempt=1 + ) + await left.append({"side": "left"}) + await right.append({"side": "right"}) + seen_left = await streams.consumer( + provider.client, workflow_id=f"{base}:x", stream="y" + ) + only_left = await take(seen_left.read(type=dict), 1) + assert [r.value for r in only_left] == [{"side": "left"}] + assert await seen_left.latest() == only_left[0].cursor + seen_right = await streams.consumer(provider.client, workflow_id=base, stream="x:y") + only_right = await take(seen_right.read(type=dict), 1) + assert [r.value for r in only_right] == [{"side": "right"}] + assert await seen_right.latest() == only_right[0].cursor + + +async def test_producer_needs_exactly_one_address_and_an_identity( + provider: ProviderCase, +): + workflow_id = new_workflow_id() + with pytest.raises(ValueError): + await streams.producer( + provider.client, workflow_id=workflow_id, producer_id="model", attempt=1 + ) with pytest.raises(ValueError): - await streams.producer(None, workflow_id="wf", producer_id="model", attempt=1) + await streams.producer( + provider.client, + workflow_id=workflow_id, + stream="inputs", + topic="out", + producer_id="model", + attempt=1, + ) # Outside an activity there is no identity to fall back on. with pytest.raises(ValueError, match="producer_id is required"): - await streams.producer(None, workflow_id="wf", stream="inputs") + await streams.producer(provider.client, workflow_id=workflow_id, topic="out") def test_unknown_provider_is_a_clear_error(): @@ -243,5 +416,9 @@ async def test_opening_a_stream_needs_a_configured_provider(): _provider._active = None with pytest.raises(RuntimeError, match="streams.configure"): await streams.consumer(None, workflow_id="wf") + # Closing with nothing configured is allowed, so a shutdown path can + # call it unconditionally. + await streams.close() streams.configure(provider="memory") assert await streams.consumer(None, workflow_id="wf") is not None + await streams.close() From 0972c50a7bea03c409c83fb03972cac4d35942ca Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 18 Sep 2026 17:12:44 -0700 Subject: [PATCH 22/51] Renamed the store key helper to inbound_stream_id for the provider branches. The native and Redis providers import it under that name, so the interface exports the name they were told to use. --- temporalio/streams/_ids.py | 11 +++++++---- temporalio/streams/providers/memory.py | 10 +++++----- tests/streams/test_streams_conformance.py | 10 +++++----- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/temporalio/streams/_ids.py b/temporalio/streams/_ids.py index 625522f75..5f4161053 100644 --- a/temporalio/streams/_ids.py +++ b/temporalio/streams/_ids.py @@ -3,12 +3,12 @@ A workflow id may contain any character, ``:`` included, so joining the pair with a bare ``:`` is ambiguous: ``("a:b", "c")`` and ``("a", "b:c")`` would land in one store. Every provider that keys a store by the pair goes through -:func:`stream_key`, so they all agree and none of them collides. +:func:`inbound_stream_id`, so they all agree and none of them collides. """ from __future__ import annotations -__all__ = ["stream_key"] +__all__ = ["inbound_stream_id"] def _escape(component: str) -> str: @@ -17,8 +17,11 @@ def _escape(component: str) -> str: return component.replace("%", "%25").replace(":", "%3A") -def stream_key(workflow_id: str, stream: str) -> str: - """The key for ``stream`` of ``workflow_id``, or for the owner's stream when empty. +def inbound_stream_id(workflow_id: str, stream: str) -> str: + """The store id for inbound ``stream`` of ``workflow_id``. + + With an empty ``stream`` it is the id of the stream the workflow itself + publishes, so one function keys both. Both components are percent-encoded before joining, so the only bare ``:`` in the result is the separator, and an owner-stream key has none. diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 390c10b9c..4a3cf3298 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -27,7 +27,7 @@ from temporalio.api.common.v1 import Payload from temporalio.streams import _frame, _provider from temporalio.streams._handles import ReadSource, WriteSink -from temporalio.streams._ids import stream_key +from temporalio.streams._ids import inbound_stream_id from temporalio.streams._policy import AttemptTracker from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord @@ -317,13 +317,13 @@ def open_read( # idle_timeout as the poll period would give the parameter a second # meaning that a port copying the reference would copy too. del idle_timeout - store = _stream(stream_key(workflow.info().workflow_id, stream)) + store = _stream(inbound_stream_id(workflow.info().workflow_id, stream)) return _MemReadSource( store, int(after.token) + 1 if after.token else 0, self._poll ) def open_write(self, topic: str) -> WriteSink: - store = _stream(stream_key(workflow.info().workflow_id, "")) + store = _stream(inbound_stream_id(workflow.info().workflow_id, "")) return _MemWriteSink(store, topic) async def producer( @@ -340,7 +340,7 @@ async def producer( # own writer appends to, and the frame carries the topic. An inbound # record carries none: the stream's name is its whole address. return MemoryProducer( - _stream(stream_key(workflow_id, stream)), + _stream(inbound_stream_id(workflow_id, stream)), _converter(client), topic, producer_id, @@ -351,7 +351,7 @@ async def consumer( self, client: Any, *, workflow_id: str, stream: str = "" ) -> MemoryConsumer: return MemoryConsumer( - _stream(stream_key(workflow_id, stream)), _converter(client), stream + _stream(inbound_stream_id(workflow_id, stream)), _converter(client), stream ) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 0a50ce2cb..7d76d85d6 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -119,12 +119,12 @@ def test_supersession_is_synthesized_from_observations(): assert attempts.note("model", 2, Cursor("2")) is None -def test_stream_keys_cannot_collide(): +def test_inbound_stream_ids_cannot_collide(): # A colon in a workflow id must not make two addresses one key. - assert _ids.stream_key("a:b", "c") != _ids.stream_key("a", "b:c") - assert _ids.stream_key("a:b", "") != _ids.stream_key("a", "b") - assert _ids.stream_key("a%3Ab", "c") != _ids.stream_key("a:b", "c") - assert _ids.stream_key("wf", "inputs") == "wf:inputs" + assert _ids.inbound_stream_id("a:b", "c") != _ids.inbound_stream_id("a", "b:c") + assert _ids.inbound_stream_id("a:b", "") != _ids.inbound_stream_id("a", "b") + assert _ids.inbound_stream_id("a%3Ab", "c") != _ids.inbound_stream_id("a:b", "c") + assert _ids.inbound_stream_id("wf", "inputs") == "wf:inputs" async def test_append_read_roundtrip(provider: ProviderCase): From 144580c872dcd7d227bb4a6afe9b80fc67386b65 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 01:32:40 -0700 Subject: [PATCH 23/51] Added the StreamError family for stream conditions. --- temporalio/streams/__init__.py | 12 ++++++++++ temporalio/streams/_errors.py | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 temporalio/streams/_errors.py diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index f564135fd..0b43830cb 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -64,6 +64,13 @@ from datetime import timedelta from typing import Any, TypeVar, overload +from temporalio.streams._errors import ( + StreamCursorError, + StreamError, + StreamNotFoundError, + StreamProducerError, + StreamUnsupportedError, +) from temporalio.streams._handles import ( ReadSource, StreamReader, @@ -101,10 +108,15 @@ "Producer", "ReadSource", "RecordKind", + "StreamCursorError", + "StreamError", + "StreamNotFoundError", + "StreamProducerError", "StreamProvider", "StreamProviderLifecycle", "StreamReader", "StreamRecord", + "StreamUnsupportedError", "StreamWriter", "Supersession", "WriteSink", diff --git a/temporalio/streams/_errors.py b/temporalio/streams/_errors.py new file mode 100644 index 000000000..f00bf1c3a --- /dev/null +++ b/temporalio/streams/_errors.py @@ -0,0 +1,40 @@ +"""The errors a stream call raises. + +Every stream condition is a :class:`StreamError`, so a caller can catch by +meaning the way it catches other :class:`temporalio.exceptions.TemporalError` +subclasses. Argument mistakes stay ``ValueError``. A provider's transport +failure surfaces as :class:`temporalio.service.RPCError`, never as the +transport's own exception type. +""" + +from __future__ import annotations + +import temporalio.exceptions + +__all__ = [ + "StreamCursorError", + "StreamError", + "StreamNotFoundError", + "StreamProducerError", + "StreamUnsupportedError", +] + + +class StreamError(temporalio.exceptions.TemporalError): + """Base for stream conditions.""" + + +class StreamNotFoundError(StreamError): + """The workflow, chain or topic does not exist or is past retention.""" + + +class StreamCursorError(StreamError): + """The cursor was minted by another provider or names a record no longer retained.""" + + +class StreamProducerError(StreamError): + """The producer attempt or sequence conflicts with what the store holds.""" + + +class StreamUnsupportedError(StreamError): + """This provider does not offer the requested capability.""" From 22d79ec125b59c0af905ba823b561e3a0f22e138 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 01:37:55 -0700 Subject: [PATCH 24/51] Vendored the stream additions to the public API protos. The Core submodule does not pin the api branch that carries them yet, so the generator stages the pinned API tree, applies the branch's diff and regenerates only the files it touches. --- scripts/gen_stream_api_protos.py | 101 ++ temporalio/api/command/v1/__init__.py | 4 + temporalio/api/command/v1/message_pb2.py | 117 +- temporalio/api/command/v1/message_pb2.pyi | 105 ++ temporalio/api/enums/v1/command_type_pb2.py | 6 +- temporalio/api/enums/v1/command_type_pb2.pyi | 4 + temporalio/api/enums/v1/event_type_pb2.py | 6 +- temporalio/api/enums/v1/event_type_pb2.pyi | 20 + temporalio/api/enums/v1/failed_cause_pb2.py | 27 +- temporalio/api/enums/v1/failed_cause_pb2.pyi | 30 + temporalio/api/history/v1/__init__.py | 4 + temporalio/api/history/v1/message_pb2.py | 301 +++-- temporalio/api/history/v1/message_pb2.pyi | 131 ++ temporalio/api/stream/__init__.py | 0 temporalio/api/stream/v1/__init__.py | 8 + temporalio/api/stream/v1/message_pb2.py | 95 ++ temporalio/api/stream/v1/message_pb2.pyi | 267 ++++ .../v1/request_response_pb2.py | 1125 +++++++++-------- .../v1/request_response_pb2.pyi | 17 + 19 files changed, 1617 insertions(+), 751 deletions(-) create mode 100644 scripts/gen_stream_api_protos.py create mode 100644 temporalio/api/stream/__init__.py create mode 100644 temporalio/api/stream/v1/__init__.py create mode 100644 temporalio/api/stream/v1/message_pb2.py create mode 100644 temporalio/api/stream/v1/message_pb2.pyi diff --git a/scripts/gen_stream_api_protos.py b/scripts/gen_stream_api_protos.py new file mode 100644 index 000000000..eeb7bb350 --- /dev/null +++ b/scripts/gen_stream_api_protos.py @@ -0,0 +1,101 @@ +"""Regenerate the stream additions to the vendored public API protos. + +The stream protos live on a branch of the api repo that the Core submodule +does not pin yet. Regenerating everything from that branch would also pull in +whatever else moved on the api main line since the pin, so this stages the +API protos the submodule pins, applies the branch's own diff on top, and +regenerates only the files that diff touches. Every other module under +``temporalio/api`` stays byte-identical. + + uv run --python 3.10 --no-project --with "grpcio-tools==1.48.2" \\ + --with "mypy-protobuf==3.3.0" --with "protobuf<4" \\ + scripts/gen_stream_api_protos.py /path/to/api origin/main..origin/ + +The toolchain pins match ``scripts/_proto/Dockerfile``. Generated code refuses +to load on a protobuf runtime older than the one it was built against, and +these modules end up in applications that pin protobuf themselves. Run +``uv run poe format`` afterwards, as the ``gen-protos`` task does. +""" + +from __future__ import annotations + +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +BASE = Path(__file__).parent.parent +sys.path.insert(0, str(BASE / "scripts")) + +import gen_protos # noqa: E402 + +API_OUT = BASE / "temporalio" / "api" + + +def main() -> None: + if len(sys.argv) != 3: + sys.exit("usage: gen_stream_api_protos.py /path/to/api-checkout ..") + api = Path(sys.argv[1]).resolve() + revisions = sys.argv[2] + diff = subprocess.run( + ["git", "-C", str(api), "diff", revisions, "--", "temporal/"], + check=True, + capture_output=True, + text=True, + ).stdout + touched = subprocess.run( + ["git", "-C", str(api), "diff", "--name-only", revisions, "--", "temporal/"], + check=True, + capture_output=True, + text=True, + ).stdout.split() + if not touched: + sys.exit(f"{revisions} touches no proto under temporal/") + + with tempfile.TemporaryDirectory() as tmp: + stage = Path(tmp) / "stage" + shutil.copytree(gen_protos.api_proto_dir / "temporal", stage / "temporal") + subprocess.run( + ["patch", "-p1", "--silent"], + check=True, + cwd=stage, + input=diff, + text=True, + ) + out = Path(tmp) / "out" + out.mkdir() + subprocess.check_call( + [ + sys.executable, + "-mgrpc_tools.protoc", + f"--proto_path={stage}", + f"--python_out={out}", + f"--mypy_out={out}", + *touched, + ] + ) + packages: set[Path] = set() + for proto in touched: + relative = Path(proto).relative_to("temporal/api").with_suffix("") + for suffix in ("_pb2.py", "_pb2.pyi"): + generated = ( + out + / "temporal" + / "api" + / relative.with_name(relative.name + suffix) + ) + target = API_OUT / relative.with_name(relative.name + suffix) + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(generated, target) + print(f"wrote {target.relative_to(BASE)}") + packages.add(target.parent) + + for package in sorted(packages): + (package.parent / "__init__.py").touch() + gen_protos.fix_generated_output(package) + print(f"rewrote {(package / '__init__.py').relative_to(BASE)}") + + +if __name__ == "__main__": + main() diff --git a/temporalio/api/command/v1/__init__.py b/temporalio/api/command/v1/__init__.py index e0ce8f712..d1b241274 100644 --- a/temporalio/api/command/v1/__init__.py +++ b/temporalio/api/command/v1/__init__.py @@ -1,4 +1,5 @@ from .message_pb2 import ( + AppendStreamRecordsCommandAttributes, CancelTimerCommandAttributes, CancelWorkflowExecutionCommandAttributes, Command, @@ -16,10 +17,12 @@ SignalExternalWorkflowExecutionCommandAttributes, StartChildWorkflowExecutionCommandAttributes, StartTimerCommandAttributes, + SubscribeStreamCommandAttributes, UpsertWorkflowSearchAttributesCommandAttributes, ) __all__ = [ + "AppendStreamRecordsCommandAttributes", "CancelTimerCommandAttributes", "CancelWorkflowExecutionCommandAttributes", "Command", @@ -37,5 +40,6 @@ "SignalExternalWorkflowExecutionCommandAttributes", "StartChildWorkflowExecutionCommandAttributes", "StartTimerCommandAttributes", + "SubscribeStreamCommandAttributes", "UpsertWorkflowSearchAttributesCommandAttributes", ] diff --git a/temporalio/api/command/v1/message_pb2.py b/temporalio/api/command/v1/message_pb2.py index ad004ae03..8c36c1f7b 100644 --- a/temporalio/api/command/v1/message_pb2.py +++ b/temporalio/api/command/v1/message_pb2.py @@ -34,6 +34,9 @@ from temporalio.api.sdk.v1 import ( user_metadata_pb2 as temporal_dot_api_dot_sdk_dot_v1_dot_user__metadata__pb2, ) +from temporalio.api.stream.v1 import ( + message_pb2 as temporal_dot_api_dot_stream_dot_v1_dot_message__pb2, +) from temporalio.api.taskqueue.v1 import ( message_pb2 as temporal_dot_api_dot_taskqueue_dot_v1_dot_message__pb2, ) @@ -42,7 +45,7 @@ ) DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n%temporal/api/command/v1/message.proto\x12\x17temporal.api.command.v1\x1a\x1egoogle/protobuf/duration.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a(temporal/api/enums/v1/command_type.proto\x1a$temporal/api/common/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a\'temporal/api/taskqueue/v1/message.proto\x1a&temporal/api/workflow/v1/message.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a,temporal/api/sdk/v1/event_group_marker.proto"\xb6\x05\n%ScheduleActivityTaskCommandAttributes\x12\x13\n\x0b\x61\x63tivity_id\x18\x01 \x01(\t\x12;\n\ractivity_type\x18\x02 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12.\n\x06header\x18\x05 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12/\n\x05input\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12<\n\x19schedule_to_close_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0b \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x1f\n\x17request_eager_execution\x18\x0c \x01(\x08\x12\x1d\n\x15use_workflow_build_id\x18\r \x01(\x08\x12\x32\n\x08priority\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.PriorityJ\x04\x08\x03\x10\x04"H\n*RequestCancelActivityTaskCommandAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03"i\n\x1bStartTimerCommandAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x38\n\x15start_to_fire_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"^\n*CompleteWorkflowExecutionCommandAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads"[\n&FailWorkflowExecutionCommandAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"0\n\x1c\x43\x61ncelTimerCommandAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t"]\n(CancelWorkflowExecutionCommandAttributes\x12\x31\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads"\xb7\x01\n7RequestCancelExternalWorkflowExecutionCommandAttributes\x12\x15\n\tnamespace\x18\x01 \x01(\tB\x02\x18\x01\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x07\x63ontrol\x18\x04 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x05 \x01(\x08\x12\x0e\n\x06reason\x18\x06 \x01(\t"\xaf\x02\n0SignalExternalWorkflowExecutionCommandAttributes\x12\x15\n\tnamespace\x18\x01 \x01(\tB\x02\x18\x01\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x0bsignal_name\x18\x03 \x01(\t\x12/\n\x05input\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x07\x63ontrol\x18\x05 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x06 \x01(\x08\x12.\n\x06header\x18\x07 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header"v\n/UpsertWorkflowSearchAttributesCommandAttributes\x12\x43\n\x11search_attributes\x18\x01 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes"`\n)ModifyWorkflowPropertiesCommandAttributes\x12\x33\n\rupserted_memo\x18\x01 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\xbf\x02\n\x1dRecordMarkerCommandAttributes\x12\x13\n\x0bmarker_name\x18\x01 \x01(\t\x12T\n\x07\x64\x65tails\x18\x02 \x03(\x0b\x32\x43.temporal.api.command.v1.RecordMarkerCommandAttributes.DetailsEntry\x12.\n\x06header\x18\x03 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x31\n\x07\x66\x61ilure\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x1aP\n\x0c\x44\x65tailsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12/\n\x05value\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads:\x02\x38\x01"\xac\x07\n/ContinueAsNewWorkflowExecutionCommandAttributes\x12;\n\rworkflow_type\x18\x01 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x03 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x37\n\x14workflow_run_timeout\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16\x62\x61\x63koff_start_interval\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x07 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12@\n\tinitiator\x18\x08 \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12\x31\n\x07\x66\x61ilure\x18\t \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\n \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x15\n\rcron_schedule\x18\x0b \x01(\t\x12.\n\x06header\x18\x0c \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\r \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x0e \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x0f \x01(\x08\x42\x02\x18\x01\x12[\n\x1binitial_versioning_behavior\x18\x10 \x01(\x0e\x32\x36.temporal.api.enums.v1.ContinueAsNewVersioningBehavior"\xec\x07\n,StartChildWorkflowExecutionCommandAttributes\x12\x15\n\tnamespace\x18\x01 \x01(\tB\x02\x18\x01\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x45\n\x13parent_close_policy\x18\t \x01(\x0e\x32(.temporal.api.enums.v1.ParentClosePolicy\x12\x0f\n\x07\x63ontrol\x18\n \x01(\t\x12N\n\x18workflow_id_reuse_policy\x18\x0b \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\r \x01(\t\x12.\n\x06header\x18\x0e \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\x0f \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x10 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x11 \x01(\x08\x42\x02\x18\x01\x12\x32\n\x08priority\x18\x12 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12I\n\x13versioning_override\x18\x13 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride"6\n ProtocolMessageCommandAttributes\x12\x12\n\nmessage_id\x18\x01 \x01(\t"\xe3\x03\n\'ScheduleNexusOperationCommandAttributes\x12\x10\n\x08\x65ndpoint\x18\x01 \x01(\t\x12\x0f\n\x07service\x18\x02 \x01(\t\x12\x11\n\toperation\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12g\n\x0cnexus_header\x18\x06 \x03(\x0b\x32Q.temporal.api.command.v1.ScheduleNexusOperationCommandAttributes.NexusHeaderEntry\x12<\n\x19schedule_to_start_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"J\n,RequestCancelNexusOperationCommandAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03"\x87\x12\n\x07\x43ommand\x12\x38\n\x0c\x63ommand_type\x18\x01 \x01(\x0e\x32".temporal.api.enums.v1.CommandType\x12\x39\n\ruser_metadata\x18\xad\x02 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12\x43\n\x13\x65vent_group_markers\x18\xae\x02 \x03(\x0b\x32%.temporal.api.sdk.v1.EventGroupMarker\x12s\n)schedule_activity_task_command_attributes\x18\x02 \x01(\x0b\x32>.temporal.api.command.v1.ScheduleActivityTaskCommandAttributesH\x00\x12^\n\x1estart_timer_command_attributes\x18\x03 \x01(\x0b\x32\x34.temporal.api.command.v1.StartTimerCommandAttributesH\x00\x12}\n.complete_workflow_execution_command_attributes\x18\x04 \x01(\x0b\x32\x43.temporal.api.command.v1.CompleteWorkflowExecutionCommandAttributesH\x00\x12u\n*fail_workflow_execution_command_attributes\x18\x05 \x01(\x0b\x32?.temporal.api.command.v1.FailWorkflowExecutionCommandAttributesH\x00\x12~\n/request_cancel_activity_task_command_attributes\x18\x06 \x01(\x0b\x32\x43.temporal.api.command.v1.RequestCancelActivityTaskCommandAttributesH\x00\x12`\n\x1f\x63\x61ncel_timer_command_attributes\x18\x07 \x01(\x0b\x32\x35.temporal.api.command.v1.CancelTimerCommandAttributesH\x00\x12y\n,cancel_workflow_execution_command_attributes\x18\x08 \x01(\x0b\x32\x41.temporal.api.command.v1.CancelWorkflowExecutionCommandAttributesH\x00\x12\x99\x01\n=request_cancel_external_workflow_execution_command_attributes\x18\t \x01(\x0b\x32P.temporal.api.command.v1.RequestCancelExternalWorkflowExecutionCommandAttributesH\x00\x12\x62\n record_marker_command_attributes\x18\n \x01(\x0b\x32\x36.temporal.api.command.v1.RecordMarkerCommandAttributesH\x00\x12\x89\x01\n5continue_as_new_workflow_execution_command_attributes\x18\x0b \x01(\x0b\x32H.temporal.api.command.v1.ContinueAsNewWorkflowExecutionCommandAttributesH\x00\x12\x82\x01\n1start_child_workflow_execution_command_attributes\x18\x0c \x01(\x0b\x32\x45.temporal.api.command.v1.StartChildWorkflowExecutionCommandAttributesH\x00\x12\x8a\x01\n5signal_external_workflow_execution_command_attributes\x18\r \x01(\x0b\x32I.temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributesH\x00\x12\x88\x01\n4upsert_workflow_search_attributes_command_attributes\x18\x0e \x01(\x0b\x32H.temporal.api.command.v1.UpsertWorkflowSearchAttributesCommandAttributesH\x00\x12h\n#protocol_message_command_attributes\x18\x0f \x01(\x0b\x32\x39.temporal.api.command.v1.ProtocolMessageCommandAttributesH\x00\x12{\n-modify_workflow_properties_command_attributes\x18\x11 \x01(\x0b\x32\x42.temporal.api.command.v1.ModifyWorkflowPropertiesCommandAttributesH\x00\x12w\n+schedule_nexus_operation_command_attributes\x18\x12 \x01(\x0b\x32@.temporal.api.command.v1.ScheduleNexusOperationCommandAttributesH\x00\x12\x82\x01\n1request_cancel_nexus_operation_command_attributes\x18\x13 \x01(\x0b\x32\x45.temporal.api.command.v1.RequestCancelNexusOperationCommandAttributesH\x00\x42\x0c\n\nattributesB\x8e\x01\n\x1aio.temporal.api.command.v1B\x0cMessageProtoP\x01Z%go.temporal.io/api/command/v1;command\xaa\x02\x19Temporalio.Api.Command.V1\xea\x02\x1cTemporalio::Api::Command::V1b\x06proto3' + b'\n%temporal/api/command/v1/message.proto\x12\x17temporal.api.command.v1\x1a\x1egoogle/protobuf/duration.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a(temporal/api/enums/v1/command_type.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/stream/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a\'temporal/api/taskqueue/v1/message.proto\x1a&temporal/api/workflow/v1/message.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a,temporal/api/sdk/v1/event_group_marker.proto"\xb6\x05\n%ScheduleActivityTaskCommandAttributes\x12\x13\n\x0b\x61\x63tivity_id\x18\x01 \x01(\t\x12;\n\ractivity_type\x18\x02 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12.\n\x06header\x18\x05 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12/\n\x05input\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12<\n\x19schedule_to_close_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0b \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x1f\n\x17request_eager_execution\x18\x0c \x01(\x08\x12\x1d\n\x15use_workflow_build_id\x18\r \x01(\x08\x12\x32\n\x08priority\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.PriorityJ\x04\x08\x03\x10\x04"H\n*RequestCancelActivityTaskCommandAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03"i\n\x1bStartTimerCommandAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x38\n\x15start_to_fire_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"^\n*CompleteWorkflowExecutionCommandAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads"[\n&FailWorkflowExecutionCommandAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"0\n\x1c\x43\x61ncelTimerCommandAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t"]\n(CancelWorkflowExecutionCommandAttributes\x12\x31\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads"\xb7\x01\n7RequestCancelExternalWorkflowExecutionCommandAttributes\x12\x15\n\tnamespace\x18\x01 \x01(\tB\x02\x18\x01\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x07\x63ontrol\x18\x04 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x05 \x01(\x08\x12\x0e\n\x06reason\x18\x06 \x01(\t"\xaf\x02\n0SignalExternalWorkflowExecutionCommandAttributes\x12\x15\n\tnamespace\x18\x01 \x01(\tB\x02\x18\x01\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x0bsignal_name\x18\x03 \x01(\t\x12/\n\x05input\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x07\x63ontrol\x18\x05 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x06 \x01(\x08\x12.\n\x06header\x18\x07 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header"v\n/UpsertWorkflowSearchAttributesCommandAttributes\x12\x43\n\x11search_attributes\x18\x01 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes"`\n)ModifyWorkflowPropertiesCommandAttributes\x12\x33\n\rupserted_memo\x18\x01 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\xbf\x02\n\x1dRecordMarkerCommandAttributes\x12\x13\n\x0bmarker_name\x18\x01 \x01(\t\x12T\n\x07\x64\x65tails\x18\x02 \x03(\x0b\x32\x43.temporal.api.command.v1.RecordMarkerCommandAttributes.DetailsEntry\x12.\n\x06header\x18\x03 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x31\n\x07\x66\x61ilure\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x1aP\n\x0c\x44\x65tailsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12/\n\x05value\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads:\x02\x38\x01"\xac\x07\n/ContinueAsNewWorkflowExecutionCommandAttributes\x12;\n\rworkflow_type\x18\x01 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x03 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x37\n\x14workflow_run_timeout\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16\x62\x61\x63koff_start_interval\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x07 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12@\n\tinitiator\x18\x08 \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12\x31\n\x07\x66\x61ilure\x18\t \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\n \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x15\n\rcron_schedule\x18\x0b \x01(\t\x12.\n\x06header\x18\x0c \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\r \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x0e \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x0f \x01(\x08\x42\x02\x18\x01\x12[\n\x1binitial_versioning_behavior\x18\x10 \x01(\x0e\x32\x36.temporal.api.enums.v1.ContinueAsNewVersioningBehavior"\xec\x07\n,StartChildWorkflowExecutionCommandAttributes\x12\x15\n\tnamespace\x18\x01 \x01(\tB\x02\x18\x01\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x45\n\x13parent_close_policy\x18\t \x01(\x0e\x32(.temporal.api.enums.v1.ParentClosePolicy\x12\x0f\n\x07\x63ontrol\x18\n \x01(\t\x12N\n\x18workflow_id_reuse_policy\x18\x0b \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\r \x01(\t\x12.\n\x06header\x18\x0e \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\x0f \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x10 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x11 \x01(\x08\x42\x02\x18\x01\x12\x32\n\x08priority\x18\x12 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12I\n\x13versioning_override\x18\x13 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride"6\n ProtocolMessageCommandAttributes\x12\x12\n\nmessage_id\x18\x01 \x01(\t"\xe3\x03\n\'ScheduleNexusOperationCommandAttributes\x12\x10\n\x08\x65ndpoint\x18\x01 \x01(\t\x12\x0f\n\x07service\x18\x02 \x01(\t\x12\x11\n\toperation\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12g\n\x0cnexus_header\x18\x06 \x03(\x0b\x32Q.temporal.api.command.v1.ScheduleNexusOperationCommandAttributes.NexusHeaderEntry\x12<\n\x19schedule_to_start_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"J\n,RequestCancelNexusOperationCommandAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03"\xe4\x13\n\x07\x43ommand\x12\x38\n\x0c\x63ommand_type\x18\x01 \x01(\x0e\x32".temporal.api.enums.v1.CommandType\x12\x39\n\ruser_metadata\x18\xad\x02 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12\x43\n\x13\x65vent_group_markers\x18\xae\x02 \x03(\x0b\x32%.temporal.api.sdk.v1.EventGroupMarker\x12s\n)schedule_activity_task_command_attributes\x18\x02 \x01(\x0b\x32>.temporal.api.command.v1.ScheduleActivityTaskCommandAttributesH\x00\x12^\n\x1estart_timer_command_attributes\x18\x03 \x01(\x0b\x32\x34.temporal.api.command.v1.StartTimerCommandAttributesH\x00\x12}\n.complete_workflow_execution_command_attributes\x18\x04 \x01(\x0b\x32\x43.temporal.api.command.v1.CompleteWorkflowExecutionCommandAttributesH\x00\x12u\n*fail_workflow_execution_command_attributes\x18\x05 \x01(\x0b\x32?.temporal.api.command.v1.FailWorkflowExecutionCommandAttributesH\x00\x12~\n/request_cancel_activity_task_command_attributes\x18\x06 \x01(\x0b\x32\x43.temporal.api.command.v1.RequestCancelActivityTaskCommandAttributesH\x00\x12`\n\x1f\x63\x61ncel_timer_command_attributes\x18\x07 \x01(\x0b\x32\x35.temporal.api.command.v1.CancelTimerCommandAttributesH\x00\x12y\n,cancel_workflow_execution_command_attributes\x18\x08 \x01(\x0b\x32\x41.temporal.api.command.v1.CancelWorkflowExecutionCommandAttributesH\x00\x12\x99\x01\n=request_cancel_external_workflow_execution_command_attributes\x18\t \x01(\x0b\x32P.temporal.api.command.v1.RequestCancelExternalWorkflowExecutionCommandAttributesH\x00\x12\x62\n record_marker_command_attributes\x18\n \x01(\x0b\x32\x36.temporal.api.command.v1.RecordMarkerCommandAttributesH\x00\x12\x89\x01\n5continue_as_new_workflow_execution_command_attributes\x18\x0b \x01(\x0b\x32H.temporal.api.command.v1.ContinueAsNewWorkflowExecutionCommandAttributesH\x00\x12\x82\x01\n1start_child_workflow_execution_command_attributes\x18\x0c \x01(\x0b\x32\x45.temporal.api.command.v1.StartChildWorkflowExecutionCommandAttributesH\x00\x12\x8a\x01\n5signal_external_workflow_execution_command_attributes\x18\r \x01(\x0b\x32I.temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributesH\x00\x12\x88\x01\n4upsert_workflow_search_attributes_command_attributes\x18\x0e \x01(\x0b\x32H.temporal.api.command.v1.UpsertWorkflowSearchAttributesCommandAttributesH\x00\x12h\n#protocol_message_command_attributes\x18\x0f \x01(\x0b\x32\x39.temporal.api.command.v1.ProtocolMessageCommandAttributesH\x00\x12{\n-modify_workflow_properties_command_attributes\x18\x11 \x01(\x0b\x32\x42.temporal.api.command.v1.ModifyWorkflowPropertiesCommandAttributesH\x00\x12w\n+schedule_nexus_operation_command_attributes\x18\x12 \x01(\x0b\x32@.temporal.api.command.v1.ScheduleNexusOperationCommandAttributesH\x00\x12\x82\x01\n1request_cancel_nexus_operation_command_attributes\x18\x13 \x01(\x0b\x32\x45.temporal.api.command.v1.RequestCancelNexusOperationCommandAttributesH\x00\x12q\n(append_stream_records_command_attributes\x18\x14 \x01(\x0b\x32=.temporal.api.command.v1.AppendStreamRecordsCommandAttributesH\x00\x12h\n#subscribe_stream_command_attributes\x18\x15 \x01(\x0b\x32\x39.temporal.api.command.v1.SubscribeStreamCommandAttributesH\x00\x42\x0c\n\nattributes"p\n$AppendStreamRecordsCommandAttributes\x12\x11\n\tstream_id\x18\x01 \x01(\t\x12\x35\n\x07records\x18\x02 \x03(\x0b\x32$.temporal.api.stream.v1.StreamRecord"K\n SubscribeStreamCommandAttributes\x12\x11\n\tstream_id\x18\x01 \x01(\t\x12\x14\n\x0cstart_offset\x18\x02 \x01(\x03\x42\x8e\x01\n\x1aio.temporal.api.command.v1B\x0cMessageProtoP\x01Z%go.temporal.io/api/command/v1;command\xaa\x02\x19Temporalio.Api.Command.V1\xea\x02\x1cTemporalio::Api::Command::V1b\x06proto3' ) @@ -106,6 +109,12 @@ "RequestCancelNexusOperationCommandAttributes" ] _COMMAND = DESCRIPTOR.message_types_by_name["Command"] +_APPENDSTREAMRECORDSCOMMANDATTRIBUTES = DESCRIPTOR.message_types_by_name[ + "AppendStreamRecordsCommandAttributes" +] +_SUBSCRIBESTREAMCOMMANDATTRIBUTES = DESCRIPTOR.message_types_by_name[ + "SubscribeStreamCommandAttributes" +] ScheduleActivityTaskCommandAttributes = _reflection.GeneratedProtocolMessageType( "ScheduleActivityTaskCommandAttributes", (_message.Message,), @@ -332,6 +341,28 @@ ) _sym_db.RegisterMessage(Command) +AppendStreamRecordsCommandAttributes = _reflection.GeneratedProtocolMessageType( + "AppendStreamRecordsCommandAttributes", + (_message.Message,), + { + "DESCRIPTOR": _APPENDSTREAMRECORDSCOMMANDATTRIBUTES, + "__module__": "temporalio.api.command.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.command.v1.AppendStreamRecordsCommandAttributes) + }, +) +_sym_db.RegisterMessage(AppendStreamRecordsCommandAttributes) + +SubscribeStreamCommandAttributes = _reflection.GeneratedProtocolMessageType( + "SubscribeStreamCommandAttributes", + (_message.Message,), + { + "DESCRIPTOR": _SUBSCRIBESTREAMCOMMANDATTRIBUTES, + "__module__": "temporalio.api.command.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.command.v1.SubscribeStreamCommandAttributes) + }, +) +_sym_db.RegisterMessage(SubscribeStreamCommandAttributes) + if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b"\n\032io.temporal.api.command.v1B\014MessageProtoP\001Z%go.temporal.io/api/command/v1;command\252\002\031Temporalio.Api.Command.V1\352\002\034Temporalio::Api::Command::V1" @@ -383,44 +414,48 @@ _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES_NEXUSHEADERENTRY._serialized_options = ( b"8\001" ) - _SCHEDULEACTIVITYTASKCOMMANDATTRIBUTES._serialized_start = 424 - _SCHEDULEACTIVITYTASKCOMMANDATTRIBUTES._serialized_end = 1118 - _REQUESTCANCELACTIVITYTASKCOMMANDATTRIBUTES._serialized_start = 1120 - _REQUESTCANCELACTIVITYTASKCOMMANDATTRIBUTES._serialized_end = 1192 - _STARTTIMERCOMMANDATTRIBUTES._serialized_start = 1194 - _STARTTIMERCOMMANDATTRIBUTES._serialized_end = 1299 - _COMPLETEWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1301 - _COMPLETEWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1395 - _FAILWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1397 - _FAILWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1488 - _CANCELTIMERCOMMANDATTRIBUTES._serialized_start = 1490 - _CANCELTIMERCOMMANDATTRIBUTES._serialized_end = 1538 - _CANCELWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1540 - _CANCELWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1633 - _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1636 - _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1819 - _SIGNALEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1822 - _SIGNALEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 2125 - _UPSERTWORKFLOWSEARCHATTRIBUTESCOMMANDATTRIBUTES._serialized_start = 2127 - _UPSERTWORKFLOWSEARCHATTRIBUTESCOMMANDATTRIBUTES._serialized_end = 2245 - _MODIFYWORKFLOWPROPERTIESCOMMANDATTRIBUTES._serialized_start = 2247 - _MODIFYWORKFLOWPROPERTIESCOMMANDATTRIBUTES._serialized_end = 2343 - _RECORDMARKERCOMMANDATTRIBUTES._serialized_start = 2346 - _RECORDMARKERCOMMANDATTRIBUTES._serialized_end = 2665 - _RECORDMARKERCOMMANDATTRIBUTES_DETAILSENTRY._serialized_start = 2585 - _RECORDMARKERCOMMANDATTRIBUTES_DETAILSENTRY._serialized_end = 2665 - _CONTINUEASNEWWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 2668 - _CONTINUEASNEWWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 3608 - _STARTCHILDWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 3611 - _STARTCHILDWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 4615 - _PROTOCOLMESSAGECOMMANDATTRIBUTES._serialized_start = 4617 - _PROTOCOLMESSAGECOMMANDATTRIBUTES._serialized_end = 4671 - _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES._serialized_start = 4674 - _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES._serialized_end = 5157 - _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES_NEXUSHEADERENTRY._serialized_start = 5107 - _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES_NEXUSHEADERENTRY._serialized_end = 5157 - _REQUESTCANCELNEXUSOPERATIONCOMMANDATTRIBUTES._serialized_start = 5159 - _REQUESTCANCELNEXUSOPERATIONCOMMANDATTRIBUTES._serialized_end = 5233 - _COMMAND._serialized_start = 5236 - _COMMAND._serialized_end = 7547 + _SCHEDULEACTIVITYTASKCOMMANDATTRIBUTES._serialized_start = 462 + _SCHEDULEACTIVITYTASKCOMMANDATTRIBUTES._serialized_end = 1156 + _REQUESTCANCELACTIVITYTASKCOMMANDATTRIBUTES._serialized_start = 1158 + _REQUESTCANCELACTIVITYTASKCOMMANDATTRIBUTES._serialized_end = 1230 + _STARTTIMERCOMMANDATTRIBUTES._serialized_start = 1232 + _STARTTIMERCOMMANDATTRIBUTES._serialized_end = 1337 + _COMPLETEWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1339 + _COMPLETEWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1433 + _FAILWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1435 + _FAILWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1526 + _CANCELTIMERCOMMANDATTRIBUTES._serialized_start = 1528 + _CANCELTIMERCOMMANDATTRIBUTES._serialized_end = 1576 + _CANCELWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1578 + _CANCELWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1671 + _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1674 + _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 1857 + _SIGNALEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 1860 + _SIGNALEXTERNALWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 2163 + _UPSERTWORKFLOWSEARCHATTRIBUTESCOMMANDATTRIBUTES._serialized_start = 2165 + _UPSERTWORKFLOWSEARCHATTRIBUTESCOMMANDATTRIBUTES._serialized_end = 2283 + _MODIFYWORKFLOWPROPERTIESCOMMANDATTRIBUTES._serialized_start = 2285 + _MODIFYWORKFLOWPROPERTIESCOMMANDATTRIBUTES._serialized_end = 2381 + _RECORDMARKERCOMMANDATTRIBUTES._serialized_start = 2384 + _RECORDMARKERCOMMANDATTRIBUTES._serialized_end = 2703 + _RECORDMARKERCOMMANDATTRIBUTES_DETAILSENTRY._serialized_start = 2623 + _RECORDMARKERCOMMANDATTRIBUTES_DETAILSENTRY._serialized_end = 2703 + _CONTINUEASNEWWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 2706 + _CONTINUEASNEWWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 3646 + _STARTCHILDWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_start = 3649 + _STARTCHILDWORKFLOWEXECUTIONCOMMANDATTRIBUTES._serialized_end = 4653 + _PROTOCOLMESSAGECOMMANDATTRIBUTES._serialized_start = 4655 + _PROTOCOLMESSAGECOMMANDATTRIBUTES._serialized_end = 4709 + _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES._serialized_start = 4712 + _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES._serialized_end = 5195 + _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES_NEXUSHEADERENTRY._serialized_start = 5145 + _SCHEDULENEXUSOPERATIONCOMMANDATTRIBUTES_NEXUSHEADERENTRY._serialized_end = 5195 + _REQUESTCANCELNEXUSOPERATIONCOMMANDATTRIBUTES._serialized_start = 5197 + _REQUESTCANCELNEXUSOPERATIONCOMMANDATTRIBUTES._serialized_end = 5271 + _COMMAND._serialized_start = 5274 + _COMMAND._serialized_end = 7806 + _APPENDSTREAMRECORDSCOMMANDATTRIBUTES._serialized_start = 7808 + _APPENDSTREAMRECORDSCOMMANDATTRIBUTES._serialized_end = 7920 + _SUBSCRIBESTREAMCOMMANDATTRIBUTES._serialized_start = 7922 + _SUBSCRIBESTREAMCOMMANDATTRIBUTES._serialized_end = 7997 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/command/v1/message_pb2.pyi b/temporalio/api/command/v1/message_pb2.pyi index 18d0abc8b..f623eecfd 100644 --- a/temporalio/api/command/v1/message_pb2.pyi +++ b/temporalio/api/command/v1/message_pb2.pyi @@ -18,6 +18,7 @@ import temporalio.api.enums.v1.workflow_pb2 import temporalio.api.failure.v1.message_pb2 import temporalio.api.sdk.v1.event_group_marker_pb2 import temporalio.api.sdk.v1.user_metadata_pb2 +import temporalio.api.stream.v1.message_pb2 import temporalio.api.taskqueue.v1.message_pb2 import temporalio.api.workflow.v1.message_pb2 @@ -1119,6 +1120,8 @@ class Command(google.protobuf.message.Message): MODIFY_WORKFLOW_PROPERTIES_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int SCHEDULE_NEXUS_OPERATION_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int REQUEST_CANCEL_NEXUS_OPERATION_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int + APPEND_STREAM_RECORDS_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int + SUBSCRIBE_STREAM_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int command_type: temporalio.api.enums.v1.command_type_pb2.CommandType.ValueType @property def user_metadata(self) -> temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata: @@ -1209,6 +1212,14 @@ class Command(google.protobuf.message.Message): def request_cancel_nexus_operation_command_attributes( self, ) -> global___RequestCancelNexusOperationCommandAttributes: ... + @property + def append_stream_records_command_attributes( + self, + ) -> global___AppendStreamRecordsCommandAttributes: ... + @property + def subscribe_stream_command_attributes( + self, + ) -> global___SubscribeStreamCommandAttributes: ... def __init__( self, *, @@ -1253,10 +1264,16 @@ class Command(google.protobuf.message.Message): | None = ..., request_cancel_nexus_operation_command_attributes: global___RequestCancelNexusOperationCommandAttributes | None = ..., + append_stream_records_command_attributes: global___AppendStreamRecordsCommandAttributes + | None = ..., + subscribe_stream_command_attributes: global___SubscribeStreamCommandAttributes + | None = ..., ) -> None: ... def HasField( self, field_name: typing_extensions.Literal[ + "append_stream_records_command_attributes", + b"append_stream_records_command_attributes", "attributes", b"attributes", "cancel_timer_command_attributes", @@ -1291,6 +1308,8 @@ class Command(google.protobuf.message.Message): b"start_child_workflow_execution_command_attributes", "start_timer_command_attributes", b"start_timer_command_attributes", + "subscribe_stream_command_attributes", + b"subscribe_stream_command_attributes", "upsert_workflow_search_attributes_command_attributes", b"upsert_workflow_search_attributes_command_attributes", "user_metadata", @@ -1300,6 +1319,8 @@ class Command(google.protobuf.message.Message): def ClearField( self, field_name: typing_extensions.Literal[ + "append_stream_records_command_attributes", + b"append_stream_records_command_attributes", "attributes", b"attributes", "cancel_timer_command_attributes", @@ -1338,6 +1359,8 @@ class Command(google.protobuf.message.Message): b"start_child_workflow_execution_command_attributes", "start_timer_command_attributes", b"start_timer_command_attributes", + "subscribe_stream_command_attributes", + b"subscribe_stream_command_attributes", "upsert_workflow_search_attributes_command_attributes", b"upsert_workflow_search_attributes_command_attributes", "user_metadata", @@ -1365,8 +1388,90 @@ class Command(google.protobuf.message.Message): "modify_workflow_properties_command_attributes", "schedule_nexus_operation_command_attributes", "request_cancel_nexus_operation_command_attributes", + "append_stream_records_command_attributes", + "subscribe_stream_command_attributes", ] | None ): ... global___Command = Command + +class AppendStreamRecordsCommandAttributes(google.protobuf.message.Message): + """Appends records to a stream the Workflow owns. Applied inside the Workflow + Task's own commit. Produces one `WorkflowStreamRecordsAppended` event + carrying the offset range and none of the payload; it schedules no further + work. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + STREAM_ID_FIELD_NUMBER: builtins.int + RECORDS_FIELD_NUMBER: builtins.int + stream_id: builtins.str + """Empty means the Workflow's default output stream.""" + @property + def records( + self, + ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[ + temporalio.api.stream.v1.message_pb2.StreamRecord + ]: + """Stored in order. The server sets `producer_id` to empty on each record, + because the owning Workflow is the producer here. + """ + def __init__( + self, + *, + stream_id: builtins.str = ..., + records: collections.abc.Iterable[ + temporalio.api.stream.v1.message_pb2.StreamRecord + ] + | None = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "records", b"records", "stream_id", b"stream_id" + ], + ) -> None: ... + +global___AppendStreamRecordsCommandAttributes = AppendStreamRecordsCommandAttributes + +class SubscribeStreamCommandAttributes(google.protobuf.message.Message): + """Subscribe this Workflow to a stream, so later Workflow Tasks carry the ranges + it has not consumed yet. + + The stream's addressing is resolved by the server rather than supplied here. + A Workflow cannot look it up without doing I/O, and a value it carried would + be a reading rather than a fact, so it could differ on replay. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + STREAM_ID_FIELD_NUMBER: builtins.int + START_OFFSET_FIELD_NUMBER: builtins.int + stream_id: builtins.str + """Stream to consume. A stream in another execution is addressed by its id; + one this Workflow owns is addressed by the name it was published under. + The server resolves an owned name first and falls back to a standalone + id, so a Workflow that owns a stream under this name cannot reach a + standalone stream with the same id. + """ + start_offset: builtins.int + """Where to start. Negative means from wherever the stream is when the + subscription is registered, which the server resolves and records so + replay does not resolve it again. + """ + def __init__( + self, + *, + stream_id: builtins.str = ..., + start_offset: builtins.int = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "start_offset", b"start_offset", "stream_id", b"stream_id" + ], + ) -> None: ... + +global___SubscribeStreamCommandAttributes = SubscribeStreamCommandAttributes diff --git a/temporalio/api/enums/v1/command_type_pb2.py b/temporalio/api/enums/v1/command_type_pb2.py index 6d1c3b6e5..17f70d8a6 100644 --- a/temporalio/api/enums/v1/command_type_pb2.py +++ b/temporalio/api/enums/v1/command_type_pb2.py @@ -16,7 +16,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n(temporal/api/enums/v1/command_type.proto\x12\x15temporal.api.enums.v1*\x9c\x06\n\x0b\x43ommandType\x12\x1c\n\x18\x43OMMAND_TYPE_UNSPECIFIED\x10\x00\x12'\n#COMMAND_TYPE_SCHEDULE_ACTIVITY_TASK\x10\x01\x12-\n)COMMAND_TYPE_REQUEST_CANCEL_ACTIVITY_TASK\x10\x02\x12\x1c\n\x18\x43OMMAND_TYPE_START_TIMER\x10\x03\x12,\n(COMMAND_TYPE_COMPLETE_WORKFLOW_EXECUTION\x10\x04\x12(\n$COMMAND_TYPE_FAIL_WORKFLOW_EXECUTION\x10\x05\x12\x1d\n\x19\x43OMMAND_TYPE_CANCEL_TIMER\x10\x06\x12*\n&COMMAND_TYPE_CANCEL_WORKFLOW_EXECUTION\x10\x07\x12;\n7COMMAND_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION\x10\x08\x12\x1e\n\x1a\x43OMMAND_TYPE_RECORD_MARKER\x10\t\x12\x33\n/COMMAND_TYPE_CONTINUE_AS_NEW_WORKFLOW_EXECUTION\x10\n\x12/\n+COMMAND_TYPE_START_CHILD_WORKFLOW_EXECUTION\x10\x0b\x12\x33\n/COMMAND_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION\x10\x0c\x12\x32\n.COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES\x10\r\x12!\n\x1d\x43OMMAND_TYPE_PROTOCOL_MESSAGE\x10\x0e\x12+\n'COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES\x10\x10\x12)\n%COMMAND_TYPE_SCHEDULE_NEXUS_OPERATION\x10\x11\x12/\n+COMMAND_TYPE_REQUEST_CANCEL_NEXUS_OPERATION\x10\x12\x42\x88\x01\n\x18io.temporal.api.enums.v1B\x10\x43ommandTypeProtoP\x01Z!go.temporal.io/api/enums/v1;enums\xaa\x02\x17Temporalio.Api.Enums.V1\xea\x02\x1aTemporalio::Api::Enums::V1b\x06proto3" + b"\n(temporal/api/enums/v1/command_type.proto\x12\x15temporal.api.enums.v1*\xe7\x06\n\x0b\x43ommandType\x12\x1c\n\x18\x43OMMAND_TYPE_UNSPECIFIED\x10\x00\x12'\n#COMMAND_TYPE_SCHEDULE_ACTIVITY_TASK\x10\x01\x12-\n)COMMAND_TYPE_REQUEST_CANCEL_ACTIVITY_TASK\x10\x02\x12\x1c\n\x18\x43OMMAND_TYPE_START_TIMER\x10\x03\x12,\n(COMMAND_TYPE_COMPLETE_WORKFLOW_EXECUTION\x10\x04\x12(\n$COMMAND_TYPE_FAIL_WORKFLOW_EXECUTION\x10\x05\x12\x1d\n\x19\x43OMMAND_TYPE_CANCEL_TIMER\x10\x06\x12*\n&COMMAND_TYPE_CANCEL_WORKFLOW_EXECUTION\x10\x07\x12;\n7COMMAND_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION\x10\x08\x12\x1e\n\x1a\x43OMMAND_TYPE_RECORD_MARKER\x10\t\x12\x33\n/COMMAND_TYPE_CONTINUE_AS_NEW_WORKFLOW_EXECUTION\x10\n\x12/\n+COMMAND_TYPE_START_CHILD_WORKFLOW_EXECUTION\x10\x0b\x12\x33\n/COMMAND_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION\x10\x0c\x12\x32\n.COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES\x10\r\x12!\n\x1d\x43OMMAND_TYPE_PROTOCOL_MESSAGE\x10\x0e\x12+\n'COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES\x10\x10\x12)\n%COMMAND_TYPE_SCHEDULE_NEXUS_OPERATION\x10\x11\x12/\n+COMMAND_TYPE_REQUEST_CANCEL_NEXUS_OPERATION\x10\x12\x12&\n\"COMMAND_TYPE_APPEND_STREAM_RECORDS\x10\x13\x12!\n\x1d\x43OMMAND_TYPE_SUBSCRIBE_STREAM\x10\x14\x42\x88\x01\n\x18io.temporal.api.enums.v1B\x10\x43ommandTypeProtoP\x01Z!go.temporal.io/api/enums/v1;enums\xaa\x02\x17Temporalio.Api.Enums.V1\xea\x02\x1aTemporalio::Api::Enums::V1b\x06proto3" ) _COMMANDTYPE = DESCRIPTOR.enum_types_by_name["CommandType"] @@ -39,11 +39,13 @@ COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES = 16 COMMAND_TYPE_SCHEDULE_NEXUS_OPERATION = 17 COMMAND_TYPE_REQUEST_CANCEL_NEXUS_OPERATION = 18 +COMMAND_TYPE_APPEND_STREAM_RECORDS = 19 +COMMAND_TYPE_SUBSCRIBE_STREAM = 20 if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b"\n\030io.temporal.api.enums.v1B\020CommandTypeProtoP\001Z!go.temporal.io/api/enums/v1;enums\252\002\027Temporalio.Api.Enums.V1\352\002\032Temporalio::Api::Enums::V1" _COMMANDTYPE._serialized_start = 68 - _COMMANDTYPE._serialized_end = 864 + _COMMANDTYPE._serialized_end = 939 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/enums/v1/command_type_pb2.pyi b/temporalio/api/enums/v1/command_type_pb2.pyi index 9f1bfd240..c6f21ab4b 100644 --- a/temporalio/api/enums/v1/command_type_pb2.pyi +++ b/temporalio/api/enums/v1/command_type_pb2.pyi @@ -44,6 +44,8 @@ class _CommandTypeEnumTypeWrapper( COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES: _CommandType.ValueType # 16 COMMAND_TYPE_SCHEDULE_NEXUS_OPERATION: _CommandType.ValueType # 17 COMMAND_TYPE_REQUEST_CANCEL_NEXUS_OPERATION: _CommandType.ValueType # 18 + COMMAND_TYPE_APPEND_STREAM_RECORDS: _CommandType.ValueType # 19 + COMMAND_TYPE_SUBSCRIBE_STREAM: _CommandType.ValueType # 20 class CommandType(_CommandType, metaclass=_CommandTypeEnumTypeWrapper): """Whenever this list of command types is changed do change the function shouldBufferEvent in mutableStateBuilder.go to make sure to do the correct event ordering.""" @@ -66,4 +68,6 @@ COMMAND_TYPE_PROTOCOL_MESSAGE: CommandType.ValueType # 14 COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES: CommandType.ValueType # 16 COMMAND_TYPE_SCHEDULE_NEXUS_OPERATION: CommandType.ValueType # 17 COMMAND_TYPE_REQUEST_CANCEL_NEXUS_OPERATION: CommandType.ValueType # 18 +COMMAND_TYPE_APPEND_STREAM_RECORDS: CommandType.ValueType # 19 +COMMAND_TYPE_SUBSCRIBE_STREAM: CommandType.ValueType # 20 global___CommandType = CommandType diff --git a/temporalio/api/enums/v1/event_type_pb2.py b/temporalio/api/enums/v1/event_type_pb2.py index 14ff7984d..a41b486ee 100644 --- a/temporalio/api/enums/v1/event_type_pb2.py +++ b/temporalio/api/enums/v1/event_type_pb2.py @@ -16,7 +16,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n&temporal/api/enums/v1/event_type.proto\x12\x15temporal.api.enums.v1*\x9e\x16\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12)\n%EVENT_TYPE_WORKFLOW_EXECUTION_STARTED\x10\x01\x12+\n\'EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED\x10\x02\x12(\n$EVENT_TYPE_WORKFLOW_EXECUTION_FAILED\x10\x03\x12+\n\'EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT\x10\x04\x12&\n"EVENT_TYPE_WORKFLOW_TASK_SCHEDULED\x10\x05\x12$\n EVENT_TYPE_WORKFLOW_TASK_STARTED\x10\x06\x12&\n"EVENT_TYPE_WORKFLOW_TASK_COMPLETED\x10\x07\x12&\n"EVENT_TYPE_WORKFLOW_TASK_TIMED_OUT\x10\x08\x12#\n\x1f\x45VENT_TYPE_WORKFLOW_TASK_FAILED\x10\t\x12&\n"EVENT_TYPE_ACTIVITY_TASK_SCHEDULED\x10\n\x12$\n EVENT_TYPE_ACTIVITY_TASK_STARTED\x10\x0b\x12&\n"EVENT_TYPE_ACTIVITY_TASK_COMPLETED\x10\x0c\x12#\n\x1f\x45VENT_TYPE_ACTIVITY_TASK_FAILED\x10\r\x12&\n"EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT\x10\x0e\x12-\n)EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED\x10\x0f\x12%\n!EVENT_TYPE_ACTIVITY_TASK_CANCELED\x10\x10\x12\x1c\n\x18\x45VENT_TYPE_TIMER_STARTED\x10\x11\x12\x1a\n\x16\x45VENT_TYPE_TIMER_FIRED\x10\x12\x12\x1d\n\x19\x45VENT_TYPE_TIMER_CANCELED\x10\x13\x12\x32\n.EVENT_TYPE_WORKFLOW_EXECUTION_CANCEL_REQUESTED\x10\x14\x12*\n&EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED\x10\x15\x12\x43\n?EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED\x10\x16\x12@\nB\x86\x01\n\x18io.temporal.api.enums.v1B\x0e\x45ventTypeProtoP\x01Z!go.temporal.io/api/enums/v1;enums\xaa\x02\x17Temporalio.Api.Enums.V1\xea\x02\x1aTemporalio::Api::Enums::V1b\x06proto3' ) _EVENTTYPE = DESCRIPTOR.enum_types_by_name["EventType"] @@ -82,11 +82,13 @@ EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED = 58 EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED = 59 EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPING_TRANSITIONED = 60 +EVENT_TYPE_WORKFLOW_STREAM_SUBSCRIBED = 61 +EVENT_TYPE_WORKFLOW_STREAM_RECORDS_APPENDED = 62 if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b"\n\030io.temporal.api.enums.v1B\016EventTypeProtoP\001Z!go.temporal.io/api/enums/v1;enums\252\002\027Temporalio.Api.Enums.V1\352\002\032Temporalio::Api::Enums::V1" _EVENTTYPE._serialized_start = 66 - _EVENTTYPE._serialized_end = 2912 + _EVENTTYPE._serialized_end = 3004 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/enums/v1/event_type_pb2.pyi b/temporalio/api/enums/v1/event_type_pb2.pyi index 16a23b137..84db38b61 100644 --- a/temporalio/api/enums/v1/event_type_pb2.pyi +++ b/temporalio/api/enums/v1/event_type_pb2.pyi @@ -216,6 +216,16 @@ class _EventTypeEnumTypeWrapper( """An event that indicates that the previously paused workflow execution has been unpaused.""" EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPING_TRANSITIONED: _EventType.ValueType # 60 """An event that indicates time skipping advanced time or was disabled automatically after a bound was reached.""" + EVENT_TYPE_WORKFLOW_STREAM_SUBSCRIBED: _EventType.ValueType # 61 + """A Workflow subscribed to a stream. Recorded once per subscription, not + per record: the offsets a task consumed ride WorkflowTaskCompleted and + the payloads never enter History at all. + """ + EVENT_TYPE_WORKFLOW_STREAM_RECORDS_APPENDED: _EventType.ValueType # 62 + """A Workflow appended a batch of records to a stream. Recorded per + batch, and carrying only the offset range it landed at: the bodies go to + the stream's own log, never into History. + """ class EventType(_EventType, metaclass=_EventTypeEnumTypeWrapper): """Whenever this list of events is changed do change the function shouldBufferEvent in mutableStateBuilder.go to make sure to do the correct event ordering""" @@ -408,4 +418,14 @@ EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED: EventType.ValueType # 59 """An event that indicates that the previously paused workflow execution has been unpaused.""" EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPING_TRANSITIONED: EventType.ValueType # 60 """An event that indicates time skipping advanced time or was disabled automatically after a bound was reached.""" +EVENT_TYPE_WORKFLOW_STREAM_SUBSCRIBED: EventType.ValueType # 61 +"""A Workflow subscribed to a stream. Recorded once per subscription, not +per record: the offsets a task consumed ride WorkflowTaskCompleted and +the payloads never enter History at all. +""" +EVENT_TYPE_WORKFLOW_STREAM_RECORDS_APPENDED: EventType.ValueType # 62 +"""A Workflow appended a batch of records to a stream. Recorded per +batch, and carrying only the offset range it landed at: the bodies go to +the stream's own log, never into History. +""" global___EventType = EventType diff --git a/temporalio/api/enums/v1/failed_cause_pb2.py b/temporalio/api/enums/v1/failed_cause_pb2.py index 03eb094f9..70229ee81 100644 --- a/temporalio/api/enums/v1/failed_cause_pb2.py +++ b/temporalio/api/enums/v1/failed_cause_pb2.py @@ -16,7 +16,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n(temporal/api/enums/v1/failed_cause.proto\x12\x15temporal.api.enums.v1*\x90\x14\n\x17WorkflowTaskFailedCause\x12*\n&WORKFLOW_TASK_FAILED_CAUSE_UNSPECIFIED\x10\x00\x12\x30\n,WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND\x10\x01\x12?\n;WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES\x10\x02\x12\x45\nAWORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES\x10\x03\x12\x39\n5WORKFLOW_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES\x10\x04\x12:\n6WORKFLOW_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES\x10\x05\x12;\n7WORKFLOW_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES\x10\x06\x12I\nEWORKFLOW_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES\x10\x07\x12\x45\nAWORKFLOW_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES\x10\x08\x12G\nCWORKFLOW_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES\x10\t\x12X\nTWORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES\x10\n\x12=\n9WORKFLOW_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES\x10\x0b\x12\x37\n3WORKFLOW_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID\x10\x0c\x12\x36\n2WORKFLOW_TASK_FAILED_CAUSE_RESET_STICKY_TASK_QUEUE\x10\r\x12@\n\n:WORKFLOW_TASK_FAILED_CAUSE_BAD_SUBSCRIBE_STREAM_ATTRIBUTES\x10*\x12\x37\n3WORKFLOW_TASK_FAILED_CAUSE_STREAM_RANGE_UNAVAILABLE\x10+*\xc0\x02\n&StartChildWorkflowExecutionFailedCause\x12;\n7START_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_UNSPECIFIED\x10\x00\x12G\nCSTART_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_EXISTS\x10\x01\x12\x43\n?START_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_NAMESPACE_NOT_FOUND\x10\x02\x12K\nGSTART_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID_VERSIONING_OVERRIDE\x10\x03*\x91\x02\n*CancelExternalWorkflowExecutionFailedCause\x12?\n;CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNSPECIFIED\x10\x00\x12Y\nUCANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_EXTERNAL_WORKFLOW_EXECUTION_NOT_FOUND\x10\x01\x12G\nCCANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_NAMESPACE_NOT_FOUND\x10\x02*\xe2\x02\n*SignalExternalWorkflowExecutionFailedCause\x12?\n;SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNSPECIFIED\x10\x00\x12Y\nUSIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_EXTERNAL_WORKFLOW_EXECUTION_NOT_FOUND\x10\x01\x12G\nCSIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_NAMESPACE_NOT_FOUND\x10\x02\x12O\nKSIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_SIGNAL_COUNT_LIMIT_EXCEEDED\x10\x03*\x97\x04\n\x16ResourceExhaustedCause\x12(\n$RESOURCE_EXHAUSTED_CAUSE_UNSPECIFIED\x10\x00\x12&\n"RESOURCE_EXHAUSTED_CAUSE_RPS_LIMIT\x10\x01\x12-\n)RESOURCE_EXHAUSTED_CAUSE_CONCURRENT_LIMIT\x10\x02\x12.\n*RESOURCE_EXHAUSTED_CAUSE_SYSTEM_OVERLOADED\x10\x03\x12.\n*RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_LIMIT\x10\x04\x12*\n&RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW\x10\x05\x12&\n"RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT\x10\x06\x12\x36\n2RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT\x10\x07\x12\x31\n-RESOURCE_EXHAUSTED_CAUSE_CIRCUIT_BREAKER_OPEN\x10\x08\x12&\n"RESOURCE_EXHAUSTED_CAUSE_OPS_LIMIT\x10\t\x12\x35\n1RESOURCE_EXHAUSTED_CAUSE_WORKER_DEPLOYMENT_LIMITS\x10\n*\x8f\x01\n\x16ResourceExhaustedScope\x12(\n$RESOURCE_EXHAUSTED_SCOPE_UNSPECIFIED\x10\x00\x12&\n"RESOURCE_EXHAUSTED_SCOPE_NAMESPACE\x10\x01\x12#\n\x1fRESOURCE_EXHAUSTED_SCOPE_SYSTEM\x10\x02\x42\x88\x01\n\x18io.temporal.api.enums.v1B\x10\x46\x61iledCauseProtoP\x01Z!go.temporal.io/api/enums/v1;enums\xaa\x02\x17Temporalio.Api.Enums.V1\xea\x02\x1aTemporalio::Api::Enums::V1b\x06proto3' ) _WORKFLOWTASKFAILEDCAUSE = DESCRIPTOR.enum_types_by_name["WorkflowTaskFailedCause"] @@ -86,6 +86,9 @@ WORKFLOW_TASK_FAILED_CAUSE_EXTERNAL_STORAGE_FAILURE = 38 WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED = 39 WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE = 40 +WORKFLOW_TASK_FAILED_CAUSE_BAD_APPEND_STREAM_RECORDS_ATTRIBUTES = 41 +WORKFLOW_TASK_FAILED_CAUSE_BAD_SUBSCRIBE_STREAM_ATTRIBUTES = 42 +WORKFLOW_TASK_FAILED_CAUSE_STREAM_RANGE_UNAVAILABLE = 43 START_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_UNSPECIFIED = 0 START_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_EXISTS = 1 START_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_NAMESPACE_NOT_FOUND = 2 @@ -117,15 +120,15 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b"\n\030io.temporal.api.enums.v1B\020FailedCauseProtoP\001Z!go.temporal.io/api/enums/v1;enums\252\002\027Temporalio.Api.Enums.V1\352\002\032Temporalio::Api::Enums::V1" _WORKFLOWTASKFAILEDCAUSE._serialized_start = 68 - _WORKFLOWTASKFAILEDCAUSE._serialized_end = 2644 - _STARTCHILDWORKFLOWEXECUTIONFAILEDCAUSE._serialized_start = 2647 - _STARTCHILDWORKFLOWEXECUTIONFAILEDCAUSE._serialized_end = 2967 - _CANCELEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_start = 2970 - _CANCELEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_end = 3243 - _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_start = 3246 - _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_end = 3600 - _RESOURCEEXHAUSTEDCAUSE._serialized_start = 3603 - _RESOURCEEXHAUSTEDCAUSE._serialized_end = 4138 - _RESOURCEEXHAUSTEDSCOPE._serialized_start = 4141 - _RESOURCEEXHAUSTEDSCOPE._serialized_end = 4284 + _WORKFLOWTASKFAILEDCAUSE._serialized_end = 2834 + _STARTCHILDWORKFLOWEXECUTIONFAILEDCAUSE._serialized_start = 2837 + _STARTCHILDWORKFLOWEXECUTIONFAILEDCAUSE._serialized_end = 3157 + _CANCELEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_start = 3160 + _CANCELEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_end = 3433 + _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_start = 3436 + _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDCAUSE._serialized_end = 3790 + _RESOURCEEXHAUSTEDCAUSE._serialized_start = 3793 + _RESOURCEEXHAUSTEDCAUSE._serialized_end = 4328 + _RESOURCEEXHAUSTEDSCOPE._serialized_start = 4331 + _RESOURCEEXHAUSTEDSCOPE._serialized_end = 4474 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/enums/v1/failed_cause_pb2.pyi b/temporalio/api/enums/v1/failed_cause_pb2.pyi index 7e034978f..50124d1a9 100644 --- a/temporalio/api/enums/v1/failed_cause_pb2.pyi +++ b/temporalio/api/enums/v1/failed_cause_pb2.pyi @@ -188,6 +188,21 @@ class _WorkflowTaskFailedCauseEnumTypeWrapper( _WorkflowTaskFailedCause.ValueType ) # 40 """A workflow task failed because the request exceeded a size limit.""" + WORKFLOW_TASK_FAILED_CAUSE_BAD_APPEND_STREAM_RECORDS_ATTRIBUTES: ( + _WorkflowTaskFailedCause.ValueType + ) # 41 + """A workflow task completed with an invalid AppendStreamRecords command.""" + WORKFLOW_TASK_FAILED_CAUSE_BAD_SUBSCRIBE_STREAM_ATTRIBUTES: ( + _WorkflowTaskFailedCause.ValueType + ) # 42 + """A workflow task completed with an invalid SubscribeStream command.""" + WORKFLOW_TASK_FAILED_CAUSE_STREAM_RANGE_UNAVAILABLE: ( + _WorkflowTaskFailedCause.ValueType + ) # 43 + """A workflow task could not be started because a stream range it consumed and recorded in + History can no longer be served, for example after truncation or because it exceeds the + replay bound. Check the workflow task failure message for more information. + """ class WorkflowTaskFailedCause( _WorkflowTaskFailedCause, metaclass=_WorkflowTaskFailedCauseEnumTypeWrapper @@ -346,6 +361,21 @@ WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED: ( """A workflow task is failed because the workflow is paused before the task is started.""" WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE: WorkflowTaskFailedCause.ValueType # 40 """A workflow task failed because the request exceeded a size limit.""" +WORKFLOW_TASK_FAILED_CAUSE_BAD_APPEND_STREAM_RECORDS_ATTRIBUTES: ( + WorkflowTaskFailedCause.ValueType +) # 41 +"""A workflow task completed with an invalid AppendStreamRecords command.""" +WORKFLOW_TASK_FAILED_CAUSE_BAD_SUBSCRIBE_STREAM_ATTRIBUTES: ( + WorkflowTaskFailedCause.ValueType +) # 42 +"""A workflow task completed with an invalid SubscribeStream command.""" +WORKFLOW_TASK_FAILED_CAUSE_STREAM_RANGE_UNAVAILABLE: ( + WorkflowTaskFailedCause.ValueType +) # 43 +"""A workflow task could not be started because a stream range it consumed and recorded in +History can no longer be served, for example after truncation or because it exceeds the +replay bound. Check the workflow task failure message for more information. +""" global___WorkflowTaskFailedCause = WorkflowTaskFailedCause class _StartChildWorkflowExecutionFailedCause: diff --git a/temporalio/api/history/v1/__init__.py b/temporalio/api/history/v1/__init__.py index ec7f65962..13d56f93a 100644 --- a/temporalio/api/history/v1/__init__.py +++ b/temporalio/api/history/v1/__init__.py @@ -57,6 +57,8 @@ WorkflowExecutionUpdateRejectedEventAttributes, WorkflowPropertiesModifiedEventAttributes, WorkflowPropertiesModifiedExternallyEventAttributes, + WorkflowStreamRecordsAppendedEventAttributes, + WorkflowStreamSubscribedEventAttributes, WorkflowTaskCompletedEventAttributes, WorkflowTaskFailedEventAttributes, WorkflowTaskScheduledEventAttributes, @@ -123,6 +125,8 @@ "WorkflowExecutionUpdateRejectedEventAttributes", "WorkflowPropertiesModifiedEventAttributes", "WorkflowPropertiesModifiedExternallyEventAttributes", + "WorkflowStreamRecordsAppendedEventAttributes", + "WorkflowStreamSubscribedEventAttributes", "WorkflowTaskCompletedEventAttributes", "WorkflowTaskFailedEventAttributes", "WorkflowTaskScheduledEventAttributes", diff --git a/temporalio/api/history/v1/message_pb2.py b/temporalio/api/history/v1/message_pb2.py index ac337b708..14b3cbfb9 100644 --- a/temporalio/api/history/v1/message_pb2.py +++ b/temporalio/api/history/v1/message_pb2.py @@ -47,6 +47,9 @@ from temporalio.api.sdk.v1 import ( user_metadata_pb2 as temporal_dot_api_dot_sdk_dot_v1_dot_user__metadata__pb2, ) +from temporalio.api.stream.v1 import ( + message_pb2 as temporal_dot_api_dot_stream_dot_v1_dot_message__pb2, +) from temporalio.api.taskqueue.v1 import ( message_pb2 as temporal_dot_api_dot_taskqueue_dot_v1_dot_message__pb2, ) @@ -58,7 +61,7 @@ ) DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n%temporal/api/history/v1/message.proto\x12\x17temporal.api.history.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a&temporal/api/enums/v1/event_type.proto\x1a(temporal/api/enums/v1/failed_cause.proto\x1a"temporal/api/enums/v1/update.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a$temporal/api/common/v1/message.proto\x1a(temporal/api/deployment/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a\'temporal/api/taskqueue/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a&temporal/api/workflow/v1/message.proto\x1a\x30temporal/api/sdk/v1/task_complete_metadata.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a,temporal/api/sdk/v1/event_group_marker.proto"\xda\x12\n\'WorkflowExecutionStartedEventAttributes\x12;\n\rworkflow_type\x18\x01 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12!\n\x19parent_workflow_namespace\x18\x02 \x01(\t\x12$\n\x1cparent_workflow_namespace_id\x18\x1b \x01(\t\x12L\n\x19parent_workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12!\n\x19parent_initiated_event_id\x18\x04 \x01(\x03\x12\x38\n\ntask_queue\x18\x05 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12"\n\x1a\x63ontinued_execution_run_id\x18\n \x01(\t\x12@\n\tinitiator\x18\x0b \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\x0c \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\r \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12!\n\x19original_execution_run_id\x18\x0e \x01(\t\x12\x10\n\x08identity\x18\x0f \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x10 \x01(\t\x12\x39\n\x0cretry_policy\x18\x11 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x12 \x01(\x05\x12\x46\n"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rcron_schedule\x18\x14 \x01(\t\x12>\n\x1b\x66irst_workflow_task_backoff\x18\x15 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x16 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x17 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x45\n\x16prev_auto_reset_points\x18\x18 \x01(\x0b\x32%.temporal.api.workflow.v1.ResetPoints\x12.\n\x06header\x18\x19 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12&\n\x1eparent_initiated_event_version\x18\x1a \x01(\x03\x12\x13\n\x0bworkflow_id\x18\x1c \x01(\t\x12L\n\x14source_version_stamp\x18\x1d \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\x14\x63ompletion_callbacks\x18\x1e \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12J\n\x17root_workflow_execution\x18\x1f \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1e\n\x12inherited_build_id\x18 \x01(\tB\x02\x18\x01\x12I\n\x13versioning_override\x18! \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12\x33\n\'parent_pinned_worker_deployment_version\x18" \x01(\tB\x02\x18\x01\x12\x32\n\x08priority\x18# \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12U\n\x18inherited_pinned_version\x18% \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12Y\n\x1binherited_auto_upgrade_info\x18\' \x01(\x0b\x32\x34.temporal.api.deployment.v1.InheritedAutoUpgradeInfo\x12 \n\x18\x65\x61ger_execution_accepted\x18& \x01(\x08\x12^\n\x1f\x64\x65\x63lined_target_version_upgrade\x18( \x01(\x0b\x32\x35.temporal.api.history.v1.DeclinedTargetVersionUpgrade\x12H\n\x14time_skipping_config\x18) \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig\x12]\n\x1ftime_skipping_state_propagation\x18+ \x01(\x0b\x32\x34.temporal.api.common.v1.TimeSkippingStatePropagationJ\x04\x08$\x10%J\x04\x08*\x10+R parent_pinned_deployment_versionR\x18initial_skipped_duration"\x88\x01\n\x1c\x44\x65\x63linedTargetVersionUpgrade\x12O\n\x12\x64\x65ployment_version\x18\x01 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x17\n\x0frevision_number\x18\x02 \x01(\x03"\xa5\x01\n)WorkflowExecutionCompletedEventAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x1c\n\x14new_execution_run_id\x18\x03 \x01(\t"\xdb\x01\n&WorkflowExecutionFailedEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x36\n\x0bretry_state\x18\x02 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03\x12\x1c\n\x14new_execution_run_id\x18\x04 \x01(\t"\x80\x01\n(WorkflowExecutionTimedOutEventAttributes\x12\x36\n\x0bretry_state\x18\x01 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState\x12\x1c\n\x14new_execution_run_id\x18\x02 \x01(\t"\xa5\x07\n.WorkflowExecutionContinuedAsNewEventAttributes\x12\x1c\n\x14new_execution_run_id\x18\x01 \x01(\t\x12;\n\rworkflow_type\x18\x02 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x03 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x37\n\x14workflow_run_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12(\n workflow_task_completed_event_id\x18\x07 \x01(\x03\x12\x39\n\x16\x62\x61\x63koff_start_interval\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12@\n\tinitiator\x18\t \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12\x35\n\x07\x66\x61ilure\x18\n \x01(\x0b\x32 .temporal.api.failure.v1.FailureB\x02\x18\x01\x12@\n\x16last_completion_result\x18\x0b \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12.\n\x06header\x18\x0c \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\r \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x0e \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x0f \x01(\x08\x42\x02\x18\x01\x12[\n\x1binitial_versioning_behavior\x18\x10 \x01(\x0e\x32\x36.temporal.api.enums.v1.ContinueAsNewVersioningBehavior"\xac\x01\n$WorkflowTaskScheduledEventAttributes\x12\x38\n\ntask_queue\x18\x01 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x39\n\x16start_to_close_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0f\n\x07\x61ttempt\x18\x03 \x01(\x05"\xa0\x03\n"WorkflowTaskStartedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x1f\n\x17suggest_continue_as_new\x18\x04 \x01(\x08\x12Z\n\x1fsuggest_continue_as_new_reasons\x18\x08 \x03(\x0e\x32\x31.temporal.api.enums.v1.SuggestContinueAsNewReason\x12\x30\n(target_worker_deployment_version_changed\x18\t \x01(\x08\x12\x1a\n\x12history_size_bytes\x18\x05 \x01(\x03\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12%\n\x19\x62uild_id_redirect_counter\x18\x07 \x01(\x03\x42\x02\x18\x01"\x82\x05\n$WorkflowTaskCompletedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x1b\n\x0f\x62inary_checksum\x18\x04 \x01(\tB\x02\x18\x01\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12H\n\x0csdk_metadata\x18\x06 \x01(\x0b\x32\x32.temporal.api.sdk.v1.WorkflowTaskCompletedMetadata\x12\x43\n\x11metering_metadata\x18\r \x01(\x0b\x32(.temporal.api.common.v1.MeteringMetadata\x12>\n\ndeployment\x18\x07 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12\x46\n\x13versioning_behavior\x18\x08 \x01(\x0e\x32).temporal.api.enums.v1.VersioningBehavior\x12%\n\x19worker_deployment_version\x18\t \x01(\tB\x02\x18\x01\x12\x1e\n\x16worker_deployment_name\x18\n \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x0b \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion"\x95\x01\n#WorkflowTaskTimedOutEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12\x38\n\x0ctimeout_type\x18\x03 \x01(\x0e\x32".temporal.api.enums.v1.TimeoutType"\x87\x03\n!WorkflowTaskFailedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12=\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowTaskFailedCause\x12\x31\n\x07\x66\x61ilure\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x13\n\x0b\x62\x61se_run_id\x18\x06 \x01(\t\x12\x12\n\nnew_run_id\x18\x07 \x01(\t\x12\x1a\n\x12\x66ork_event_version\x18\x08 \x01(\x03\x12\x1b\n\x0f\x62inary_checksum\x18\t \x01(\tB\x02\x18\x01\x12\x46\n\x0eworker_version\x18\n \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\xc2\x05\n$ActivityTaskScheduledEventAttributes\x12\x13\n\x0b\x61\x63tivity_id\x18\x01 \x01(\t\x12;\n\ractivity_type\x18\x02 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12.\n\x06header\x18\x05 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12/\n\x05input\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12<\n\x19schedule_to_close_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12(\n workflow_task_completed_event_id\x18\x0b \x01(\x03\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12!\n\x15use_workflow_build_id\x18\r \x01(\x08\x42\x02\x18\x01\x12\x32\n\x08priority\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.PriorityJ\x04\x08\x03\x10\x04"\x9e\x02\n"ActivityTaskStartedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x0f\n\x07\x61ttempt\x18\x04 \x01(\x05\x12\x36\n\x0clast_failure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12%\n\x19\x62uild_id_redirect_counter\x18\x07 \x01(\x03\x42\x02\x18\x01"\xe8\x01\n$ActivityTaskCompletedEventAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1a\n\x12scheduled_event_id\x18\x02 \x01(\x03\x12\x18\n\x10started_event_id\x18\x03 \x01(\x03\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\x9e\x02\n!ActivityTaskFailedEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x1a\n\x12scheduled_event_id\x18\x02 \x01(\x03\x12\x18\n\x10started_event_id\x18\x03 \x01(\x03\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x36\n\x0bretry_state\x18\x05 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\xc6\x01\n#ActivityTaskTimedOutEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x1a\n\x12scheduled_event_id\x18\x02 \x01(\x03\x12\x18\n\x10started_event_id\x18\x03 \x01(\x03\x12\x36\n\x0bretry_state\x18\x04 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState"r\n*ActivityTaskCancelRequestedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03"\x92\x02\n#ActivityTaskCanceledEventAttributes\x12\x31\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12(\n latest_cancel_requested_event_id\x18\x02 \x01(\x03\x12\x1a\n\x12scheduled_event_id\x18\x03 \x01(\x03\x12\x18\n\x10started_event_id\x18\x04 \x01(\x03\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\x93\x01\n\x1bTimerStartedEventAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x38\n\x15start_to_fire_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03"G\n\x19TimerFiredEventAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03"\x86\x01\n\x1cTimerCanceledEventAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03\x12\x10\n\x08identity\x18\x04 \x01(\t"\xc7\x01\n/WorkflowExecutionCancelRequestedEventAttributes\x12\r\n\x05\x63\x61use\x18\x01 \x01(\t\x12#\n\x1b\x65xternal_initiated_event_id\x18\x02 \x01(\x03\x12N\n\x1b\x65xternal_workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x04 \x01(\t"\x87\x01\n(WorkflowExecutionCanceledEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads"\xe9\x02\n\x1dMarkerRecordedEventAttributes\x12\x13\n\x0bmarker_name\x18\x01 \x01(\t\x12T\n\x07\x64\x65tails\x18\x02 \x03(\x0b\x32\x43.temporal.api.history.v1.MarkerRecordedEventAttributes.DetailsEntry\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03\x12.\n\x06header\x18\x04 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x1aP\n\x0c\x44\x65tailsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12/\n\x05value\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads:\x02\x38\x01"\xbf\x02\n(WorkflowExecutionSignaledEventAttributes\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12/\n\x05input\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12.\n\x06header\x18\x04 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\'\n\x1bskip_generate_workflow_task\x18\x05 \x01(\x08\x42\x02\x18\x01\x12N\n\x1b\x65xternal_workflow_execution\x18\x06 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x12\n\nrequest_id\x18\x07 \x01(\t"\x81\x01\n*WorkflowExecutionTerminatedEventAttributes\x12\x0e\n\x06reason\x18\x01 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t"\x9c\x02\n>RequestCancelExternalWorkflowExecutionInitiatedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x07\x63ontrol\x18\x04 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x05 \x01(\x08\x12\x0e\n\x06reason\x18\x06 \x01(\t"\xda\x02\n;RequestCancelExternalWorkflowExecutionFailedEventAttributes\x12P\n\x05\x63\x61use\x18\x01 \x01(\x0e\x32\x41.temporal.api.enums.v1.CancelExternalWorkflowExecutionFailedCause\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x11\n\tnamespace\x18\x03 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x04 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x13\n\x07\x63ontrol\x18\x06 \x01(\tB\x02\x18\x01"\xc5\x01\n7ExternalWorkflowExecutionCancelRequestedEventAttributes\x12\x1a\n\x12initiated_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x04 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"\xfb\x02\n7SignalExternalWorkflowExecutionInitiatedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\t \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x0bsignal_name\x18\x04 \x01(\t\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x07\x63ontrol\x18\x06 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x07 \x01(\x08\x12.\n\x06header\x18\x08 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header"\xd3\x02\n4SignalExternalWorkflowExecutionFailedEventAttributes\x12P\n\x05\x63\x61use\x18\x01 \x01(\x0e\x32\x41.temporal.api.enums.v1.SignalExternalWorkflowExecutionFailedCause\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x11\n\tnamespace\x18\x03 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x04 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x13\n\x07\x63ontrol\x18\x06 \x01(\tB\x02\x18\x01"\xd3\x01\n0ExternalWorkflowExecutionSignaledEventAttributes\x12\x1a\n\x12initiated_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x05 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x07\x63ontrol\x18\x04 \x01(\tB\x02\x18\x01"\x9e\x01\n-UpsertWorkflowSearchAttributesEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x43\n\x11search_attributes\x18\x02 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes"\x8a\x01\n)WorkflowPropertiesModifiedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x33\n\rupserted_memo\x18\x02 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\xfc\t\n3StartChildWorkflowExecutionInitiatedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x12 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x45\n\x13parent_close_policy\x18\t \x01(\x0e\x32(.temporal.api.enums.v1.ParentClosePolicy\x12\x13\n\x07\x63ontrol\x18\n \x01(\tB\x02\x18\x01\x12(\n workflow_task_completed_event_id\x18\x0b \x01(\x03\x12N\n\x18workflow_id_reuse_policy\x18\x0c \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12\x39\n\x0cretry_policy\x18\r \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\x0e \x01(\t\x12.\n\x06header\x18\x0f \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\x10 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x11 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x13 \x01(\x08\x42\x02\x18\x01\x12\x32\n\x08priority\x18\x14 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12H\n\x14time_skipping_config\x18\x15 \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig\x12]\n\x1ftime_skipping_state_propagation\x18\x17 \x01(\x0b\x32\x34.temporal.api.common.v1.TimeSkippingStatePropagation\x12I\n\x13versioning_override\x18\x18 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverrideJ\x04\x08\x16\x10\x17R\x18initial_skipped_duration"\xd6\x02\n0StartChildWorkflowExecutionFailedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x08 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12L\n\x05\x63\x61use\x18\x04 \x01(\x0e\x32=.temporal.api.enums.v1.StartChildWorkflowExecutionFailedCause\x12\x13\n\x07\x63ontrol\x18\x05 \x01(\tB\x02\x18\x01\x12\x1a\n\x12initiated_event_id\x18\x06 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x07 \x01(\x03"\xa7\x02\n,ChildWorkflowExecutionStartedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x06 \x01(\t\x12\x1a\n\x12initiated_event_id\x18\x02 \x01(\x03\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12.\n\x06header\x18\x05 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header"\xc5\x02\n.ChildWorkflowExecutionCompletedEventAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x18\n\x10started_event_id\x18\x06 \x01(\x03"\xfb\x02\n+ChildWorkflowExecutionFailedEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x08 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x18\n\x10started_event_id\x18\x06 \x01(\x03\x12\x36\n\x0bretry_state\x18\x07 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState"\xc5\x02\n-ChildWorkflowExecutionCanceledEventAttributes\x12\x31\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x18\n\x10started_event_id\x18\x06 \x01(\x03"\xca\x02\n-ChildWorkflowExecutionTimedOutEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x04 \x01(\x03\x12\x18\n\x10started_event_id\x18\x05 \x01(\x03\x12\x36\n\x0bretry_state\x18\x06 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState"\x94\x02\n/ChildWorkflowExecutionTerminatedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x06 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x04 \x01(\x03\x12\x18\n\x10started_event_id\x18\x05 \x01(\x03"\xda\x05\n.WorkflowExecutionOptionsUpdatedEventAttributes\x12I\n\x13versioning_override\x18\x01 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12!\n\x19unset_versioning_override\x18\x02 \x01(\x08\x12\x1b\n\x13\x61ttached_request_id\x18\x03 \x01(\t\x12G\n\x1d\x61ttached_completion_callbacks\x18\x04 \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x32\n\x08priority\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12H\n\x14time_skipping_config\x18\x07 \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig\x12$\n\x1ctime_skipping_config_updated\x18\t \x01(\x08\x12\x84\x01\n\x17workflow_update_options\x18\x08 \x03(\x0b\x32\x63.temporal.api.history.v1.WorkflowExecutionOptionsUpdatedEventAttributes.WorkflowUpdateOptionsUpdate\x1a\x96\x01\n\x1bWorkflowUpdateOptionsUpdate\x12\x11\n\tupdate_id\x18\x01 \x01(\t\x12\x1b\n\x13\x61ttached_request_id\x18\x02 \x01(\t\x12G\n\x1d\x61ttached_completion_callbacks\x18\x03 \x03(\x0b\x32 .temporal.api.common.v1.Callback"\xc0\x02\n3WorkflowPropertiesModifiedExternallyEventAttributes\x12\x16\n\x0enew_task_queue\x18\x01 \x01(\t\x12<\n\x19new_workflow_task_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12;\n\x18new_workflow_run_timeout\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x41\n\x1enew_workflow_execution_timeout\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x33\n\rupserted_memo\x18\x05 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\x90\x01\n3ActivityPropertiesModifiedExternallyEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12=\n\x10new_retry_policy\x18\x02 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy"\xdc\x01\n.WorkflowExecutionUpdateAcceptedEventAttributes\x12\x1c\n\x14protocol_instance_id\x18\x01 \x01(\t\x12#\n\x1b\x61\x63\x63\x65pted_request_message_id\x18\x02 \x01(\t\x12,\n$accepted_request_sequencing_event_id\x18\x03 \x01(\x03\x12\x39\n\x10\x61\x63\x63\x65pted_request\x18\x04 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request"\xaa\x01\n/WorkflowExecutionUpdateCompletedEventAttributes\x12*\n\x04meta\x18\x01 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x19\n\x11\x61\x63\x63\x65pted_event_id\x18\x03 \x01(\x03\x12\x30\n\x07outcome\x18\x02 \x01(\x0b\x32\x1f.temporal.api.update.v1.Outcome"\x8f\x02\n.WorkflowExecutionUpdateRejectedEventAttributes\x12\x1c\n\x14protocol_instance_id\x18\x01 \x01(\t\x12#\n\x1brejected_request_message_id\x18\x02 \x01(\t\x12,\n$rejected_request_sequencing_event_id\x18\x03 \x01(\x03\x12\x39\n\x10rejected_request\x18\x04 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"\xa4\x01\n.WorkflowExecutionUpdateAdmittedEventAttributes\x12\x30\n\x07request\x18\x01 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request\x12@\n\x06origin\x18\x02 \x01(\x0e\x32\x30.temporal.api.enums.v1.UpdateAdmittedEventOrigin"^\n&WorkflowExecutionPausedEventAttributes\x12\x10\n\x08identity\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t"`\n(WorkflowExecutionUnpausedEventAttributes\x12\x10\n\x08identity\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\xc5\x01\n8WorkflowExecutionTimeSkippingTransitionedEventAttributes\x12/\n\x0btarget_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12#\n\x1b\x64isabled_after_fast_forward\x18\x02 \x01(\x08\x12\x33\n\x0fwall_clock_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb4\x04\n&NexusOperationScheduledEventAttributes\x12\x10\n\x08\x65ndpoint\x18\x01 \x01(\t\x12\x0f\n\x07service\x18\x02 \x01(\t\x12\x11\n\toperation\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x66\n\x0cnexus_header\x18\x06 \x03(\x0b\x32P.temporal.api.history.v1.NexusOperationScheduledEventAttributes.NexusHeaderEntry\x12(\n workflow_task_completed_event_id\x18\x07 \x01(\x03\x12\x12\n\nrequest_id\x18\x08 \x01(\t\x12\x13\n\x0b\x65ndpoint_id\x18\t \x01(\t\x12<\n\x19schedule_to_start_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x89\x01\n$NexusOperationStartedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x0coperation_id\x18\x03 \x01(\tB\x02\x18\x01\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x12\x17\n\x0foperation_token\x18\x05 \x01(\t"\x89\x01\n&NexusOperationCompletedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12/\n\x06result\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\x88\x01\n#NexusOperationFailedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\x8a\x01\n%NexusOperationTimedOutEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\x8a\x01\n%NexusOperationCanceledEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x12\n\nrequest_id\x18\x03 \x01(\t"t\n,NexusOperationCancelRequestedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03"\x97\x01\n3NexusOperationCancelRequestCompletedEventAttributes\x12\x1a\n\x12requested_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x1a\n\x12scheduled_event_id\x18\x03 \x01(\x03"\xc7\x01\n0NexusOperationCancelRequestFailedEventAttributes\x12\x1a\n\x12requested_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x1a\n\x12scheduled_event_id\x18\x04 \x01(\x03"\xca?\n\x0cHistoryEvent\x12\x10\n\x08\x65vent_id\x18\x01 \x01(\x03\x12.\n\nevent_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\nevent_type\x18\x03 \x01(\x0e\x32 .temporal.api.enums.v1.EventType\x12\x0f\n\x07version\x18\x04 \x01(\x03\x12\x0f\n\x07task_id\x18\x05 \x01(\x03\x12\x1a\n\x11worker_may_ignore\x18\xac\x02 \x01(\x08\x12\x39\n\ruser_metadata\x18\xad\x02 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12,\n\x05links\x18\xae\x02 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12\x35\n\tprincipal\x18\xaf\x02 \x01(\x0b\x32!.temporal.api.common.v1.Principal\x12\x43\n\x13\x65vent_group_markers\x18\xb0\x02 \x03(\x0b\x32%.temporal.api.sdk.v1.EventGroupMarker\x12w\n+workflow_execution_started_event_attributes\x18\x06 \x01(\x0b\x32@.temporal.api.history.v1.WorkflowExecutionStartedEventAttributesH\x00\x12{\n-workflow_execution_completed_event_attributes\x18\x07 \x01(\x0b\x32\x42.temporal.api.history.v1.WorkflowExecutionCompletedEventAttributesH\x00\x12u\n*workflow_execution_failed_event_attributes\x18\x08 \x01(\x0b\x32?.temporal.api.history.v1.WorkflowExecutionFailedEventAttributesH\x00\x12z\n-workflow_execution_timed_out_event_attributes\x18\t \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionTimedOutEventAttributesH\x00\x12q\n(workflow_task_scheduled_event_attributes\x18\n \x01(\x0b\x32=.temporal.api.history.v1.WorkflowTaskScheduledEventAttributesH\x00\x12m\n&workflow_task_started_event_attributes\x18\x0b \x01(\x0b\x32;.temporal.api.history.v1.WorkflowTaskStartedEventAttributesH\x00\x12q\n(workflow_task_completed_event_attributes\x18\x0c \x01(\x0b\x32=.temporal.api.history.v1.WorkflowTaskCompletedEventAttributesH\x00\x12p\n(workflow_task_timed_out_event_attributes\x18\r \x01(\x0b\x32<.temporal.api.history.v1.WorkflowTaskTimedOutEventAttributesH\x00\x12k\n%workflow_task_failed_event_attributes\x18\x0e \x01(\x0b\x32:.temporal.api.history.v1.WorkflowTaskFailedEventAttributesH\x00\x12q\n(activity_task_scheduled_event_attributes\x18\x0f \x01(\x0b\x32=.temporal.api.history.v1.ActivityTaskScheduledEventAttributesH\x00\x12m\n&activity_task_started_event_attributes\x18\x10 \x01(\x0b\x32;.temporal.api.history.v1.ActivityTaskStartedEventAttributesH\x00\x12q\n(activity_task_completed_event_attributes\x18\x11 \x01(\x0b\x32=.temporal.api.history.v1.ActivityTaskCompletedEventAttributesH\x00\x12k\n%activity_task_failed_event_attributes\x18\x12 \x01(\x0b\x32:.temporal.api.history.v1.ActivityTaskFailedEventAttributesH\x00\x12p\n(activity_task_timed_out_event_attributes\x18\x13 \x01(\x0b\x32<.temporal.api.history.v1.ActivityTaskTimedOutEventAttributesH\x00\x12^\n\x1etimer_started_event_attributes\x18\x14 \x01(\x0b\x32\x34.temporal.api.history.v1.TimerStartedEventAttributesH\x00\x12Z\n\x1ctimer_fired_event_attributes\x18\x15 \x01(\x0b\x32\x32.temporal.api.history.v1.TimerFiredEventAttributesH\x00\x12~\n/activity_task_cancel_requested_event_attributes\x18\x16 \x01(\x0b\x32\x43.temporal.api.history.v1.ActivityTaskCancelRequestedEventAttributesH\x00\x12o\n\'activity_task_canceled_event_attributes\x18\x17 \x01(\x0b\x32<.temporal.api.history.v1.ActivityTaskCanceledEventAttributesH\x00\x12`\n\x1ftimer_canceled_event_attributes\x18\x18 \x01(\x0b\x32\x35.temporal.api.history.v1.TimerCanceledEventAttributesH\x00\x12\x62\n marker_recorded_event_attributes\x18\x19 \x01(\x0b\x32\x36.temporal.api.history.v1.MarkerRecordedEventAttributesH\x00\x12y\n,workflow_execution_signaled_event_attributes\x18\x1a \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionSignaledEventAttributesH\x00\x12}\n.workflow_execution_terminated_event_attributes\x18\x1b \x01(\x0b\x32\x43.temporal.api.history.v1.WorkflowExecutionTerminatedEventAttributesH\x00\x12\x88\x01\n4workflow_execution_cancel_requested_event_attributes\x18\x1c \x01(\x0b\x32H.temporal.api.history.v1.WorkflowExecutionCancelRequestedEventAttributesH\x00\x12y\n,workflow_execution_canceled_event_attributes\x18\x1d \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionCanceledEventAttributesH\x00\x12\xa8\x01\nErequest_cancel_external_workflow_execution_initiated_event_attributes\x18\x1e \x01(\x0b\x32W.temporal.api.history.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributesH\x00\x12\xa2\x01\nBrequest_cancel_external_workflow_execution_failed_event_attributes\x18\x1f \x01(\x0b\x32T.temporal.api.history.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributesH\x00\x12\x99\x01\n=external_workflow_execution_cancel_requested_event_attributes\x18 \x01(\x0b\x32P.temporal.api.history.v1.ExternalWorkflowExecutionCancelRequestedEventAttributesH\x00\x12\x87\x01\n4workflow_execution_continued_as_new_event_attributes\x18! \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionContinuedAsNewEventAttributesH\x00\x12\x91\x01\n9start_child_workflow_execution_initiated_event_attributes\x18" \x01(\x0b\x32L.temporal.api.history.v1.StartChildWorkflowExecutionInitiatedEventAttributesH\x00\x12\x8b\x01\n6start_child_workflow_execution_failed_event_attributes\x18# \x01(\x0b\x32I.temporal.api.history.v1.StartChildWorkflowExecutionFailedEventAttributesH\x00\x12\x82\x01\n1child_workflow_execution_started_event_attributes\x18$ \x01(\x0b\x32\x45.temporal.api.history.v1.ChildWorkflowExecutionStartedEventAttributesH\x00\x12\x86\x01\n3child_workflow_execution_completed_event_attributes\x18% \x01(\x0b\x32G.temporal.api.history.v1.ChildWorkflowExecutionCompletedEventAttributesH\x00\x12\x80\x01\n0child_workflow_execution_failed_event_attributes\x18& \x01(\x0b\x32\x44.temporal.api.history.v1.ChildWorkflowExecutionFailedEventAttributesH\x00\x12\x84\x01\n2child_workflow_execution_canceled_event_attributes\x18\' \x01(\x0b\x32\x46.temporal.api.history.v1.ChildWorkflowExecutionCanceledEventAttributesH\x00\x12\x85\x01\n3child_workflow_execution_timed_out_event_attributes\x18( \x01(\x0b\x32\x46.temporal.api.history.v1.ChildWorkflowExecutionTimedOutEventAttributesH\x00\x12\x88\x01\n4child_workflow_execution_terminated_event_attributes\x18) \x01(\x0b\x32H.temporal.api.history.v1.ChildWorkflowExecutionTerminatedEventAttributesH\x00\x12\x99\x01\n=signal_external_workflow_execution_initiated_event_attributes\x18* \x01(\x0b\x32P.temporal.api.history.v1.SignalExternalWorkflowExecutionInitiatedEventAttributesH\x00\x12\x93\x01\n:signal_external_workflow_execution_failed_event_attributes\x18+ \x01(\x0b\x32M.temporal.api.history.v1.SignalExternalWorkflowExecutionFailedEventAttributesH\x00\x12\x8a\x01\n5external_workflow_execution_signaled_event_attributes\x18, \x01(\x0b\x32I.temporal.api.history.v1.ExternalWorkflowExecutionSignaledEventAttributesH\x00\x12\x84\x01\n2upsert_workflow_search_attributes_event_attributes\x18- \x01(\x0b\x32\x46.temporal.api.history.v1.UpsertWorkflowSearchAttributesEventAttributesH\x00\x12\x86\x01\n3workflow_execution_update_accepted_event_attributes\x18. \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionUpdateAcceptedEventAttributesH\x00\x12\x86\x01\n3workflow_execution_update_rejected_event_attributes\x18/ \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionUpdateRejectedEventAttributesH\x00\x12\x88\x01\n4workflow_execution_update_completed_event_attributes\x18\x30 \x01(\x0b\x32H.temporal.api.history.v1.WorkflowExecutionUpdateCompletedEventAttributesH\x00\x12\x90\x01\n8workflow_properties_modified_externally_event_attributes\x18\x31 \x01(\x0b\x32L.temporal.api.history.v1.WorkflowPropertiesModifiedExternallyEventAttributesH\x00\x12\x90\x01\n8activity_properties_modified_externally_event_attributes\x18\x32 \x01(\x0b\x32L.temporal.api.history.v1.ActivityPropertiesModifiedExternallyEventAttributesH\x00\x12{\n-workflow_properties_modified_event_attributes\x18\x33 \x01(\x0b\x32\x42.temporal.api.history.v1.WorkflowPropertiesModifiedEventAttributesH\x00\x12\x86\x01\n3workflow_execution_update_admitted_event_attributes\x18\x34 \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionUpdateAdmittedEventAttributesH\x00\x12u\n*nexus_operation_scheduled_event_attributes\x18\x35 \x01(\x0b\x32?.temporal.api.history.v1.NexusOperationScheduledEventAttributesH\x00\x12q\n(nexus_operation_started_event_attributes\x18\x36 \x01(\x0b\x32=.temporal.api.history.v1.NexusOperationStartedEventAttributesH\x00\x12u\n*nexus_operation_completed_event_attributes\x18\x37 \x01(\x0b\x32?.temporal.api.history.v1.NexusOperationCompletedEventAttributesH\x00\x12o\n\'nexus_operation_failed_event_attributes\x18\x38 \x01(\x0b\x32<.temporal.api.history.v1.NexusOperationFailedEventAttributesH\x00\x12s\n)nexus_operation_canceled_event_attributes\x18\x39 \x01(\x0b\x32>.temporal.api.history.v1.NexusOperationCanceledEventAttributesH\x00\x12t\n*nexus_operation_timed_out_event_attributes\x18: \x01(\x0b\x32>.temporal.api.history.v1.NexusOperationTimedOutEventAttributesH\x00\x12\x82\x01\n1nexus_operation_cancel_requested_event_attributes\x18; \x01(\x0b\x32\x45.temporal.api.history.v1.NexusOperationCancelRequestedEventAttributesH\x00\x12\x86\x01\n3workflow_execution_options_updated_event_attributes\x18< \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionOptionsUpdatedEventAttributesH\x00\x12\x91\x01\n9nexus_operation_cancel_request_completed_event_attributes\x18= \x01(\x0b\x32L.temporal.api.history.v1.NexusOperationCancelRequestCompletedEventAttributesH\x00\x12\x8b\x01\n6nexus_operation_cancel_request_failed_event_attributes\x18> \x01(\x0b\x32I.temporal.api.history.v1.NexusOperationCancelRequestFailedEventAttributesH\x00\x12u\n*workflow_execution_paused_event_attributes\x18? \x01(\x0b\x32?.temporal.api.history.v1.WorkflowExecutionPausedEventAttributesH\x00\x12y\n,workflow_execution_unpaused_event_attributes\x18@ \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionUnpausedEventAttributesH\x00\x12\x9b\x01\n>workflow_execution_time_skipping_transitioned_event_attributes\x18\x41 \x01(\x0b\x32Q.temporal.api.history.v1.WorkflowExecutionTimeSkippingTransitionedEventAttributesH\x00\x42\x0c\n\nattributes"@\n\x07History\x12\x35\n\x06\x65vents\x18\x01 \x03(\x0b\x32%.temporal.api.history.v1.HistoryEventB\x8e\x01\n\x1aio.temporal.api.history.v1B\x0cMessageProtoP\x01Z%go.temporal.io/api/history/v1;history\xaa\x02\x19Temporalio.Api.History.V1\xea\x02\x1cTemporalio::Api::History::V1b\x06proto3' + b'\n%temporal/api/history/v1/message.proto\x12\x17temporal.api.history.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a&temporal/api/enums/v1/event_type.proto\x1a(temporal/api/enums/v1/failed_cause.proto\x1a"temporal/api/enums/v1/update.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/stream/v1/message.proto\x1a(temporal/api/deployment/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a\'temporal/api/taskqueue/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a&temporal/api/workflow/v1/message.proto\x1a\x30temporal/api/sdk/v1/task_complete_metadata.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a,temporal/api/sdk/v1/event_group_marker.proto"\xda\x12\n\'WorkflowExecutionStartedEventAttributes\x12;\n\rworkflow_type\x18\x01 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12!\n\x19parent_workflow_namespace\x18\x02 \x01(\t\x12$\n\x1cparent_workflow_namespace_id\x18\x1b \x01(\t\x12L\n\x19parent_workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12!\n\x19parent_initiated_event_id\x18\x04 \x01(\x03\x12\x38\n\ntask_queue\x18\x05 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12"\n\x1a\x63ontinued_execution_run_id\x18\n \x01(\t\x12@\n\tinitiator\x18\x0b \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\x0c \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\r \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12!\n\x19original_execution_run_id\x18\x0e \x01(\t\x12\x10\n\x08identity\x18\x0f \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x10 \x01(\t\x12\x39\n\x0cretry_policy\x18\x11 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x12 \x01(\x05\x12\x46\n"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rcron_schedule\x18\x14 \x01(\t\x12>\n\x1b\x66irst_workflow_task_backoff\x18\x15 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x16 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x17 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x45\n\x16prev_auto_reset_points\x18\x18 \x01(\x0b\x32%.temporal.api.workflow.v1.ResetPoints\x12.\n\x06header\x18\x19 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12&\n\x1eparent_initiated_event_version\x18\x1a \x01(\x03\x12\x13\n\x0bworkflow_id\x18\x1c \x01(\t\x12L\n\x14source_version_stamp\x18\x1d \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\x14\x63ompletion_callbacks\x18\x1e \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12J\n\x17root_workflow_execution\x18\x1f \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1e\n\x12inherited_build_id\x18 \x01(\tB\x02\x18\x01\x12I\n\x13versioning_override\x18! \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12\x33\n\'parent_pinned_worker_deployment_version\x18" \x01(\tB\x02\x18\x01\x12\x32\n\x08priority\x18# \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12U\n\x18inherited_pinned_version\x18% \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12Y\n\x1binherited_auto_upgrade_info\x18\' \x01(\x0b\x32\x34.temporal.api.deployment.v1.InheritedAutoUpgradeInfo\x12 \n\x18\x65\x61ger_execution_accepted\x18& \x01(\x08\x12^\n\x1f\x64\x65\x63lined_target_version_upgrade\x18( \x01(\x0b\x32\x35.temporal.api.history.v1.DeclinedTargetVersionUpgrade\x12H\n\x14time_skipping_config\x18) \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig\x12]\n\x1ftime_skipping_state_propagation\x18+ \x01(\x0b\x32\x34.temporal.api.common.v1.TimeSkippingStatePropagationJ\x04\x08$\x10%J\x04\x08*\x10+R parent_pinned_deployment_versionR\x18initial_skipped_duration"\x88\x01\n\x1c\x44\x65\x63linedTargetVersionUpgrade\x12O\n\x12\x64\x65ployment_version\x18\x01 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x17\n\x0frevision_number\x18\x02 \x01(\x03"\xa5\x01\n)WorkflowExecutionCompletedEventAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x1c\n\x14new_execution_run_id\x18\x03 \x01(\t"\xdb\x01\n&WorkflowExecutionFailedEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x36\n\x0bretry_state\x18\x02 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03\x12\x1c\n\x14new_execution_run_id\x18\x04 \x01(\t"\x80\x01\n(WorkflowExecutionTimedOutEventAttributes\x12\x36\n\x0bretry_state\x18\x01 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState\x12\x1c\n\x14new_execution_run_id\x18\x02 \x01(\t"\xa5\x07\n.WorkflowExecutionContinuedAsNewEventAttributes\x12\x1c\n\x14new_execution_run_id\x18\x01 \x01(\t\x12;\n\rworkflow_type\x18\x02 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x03 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x37\n\x14workflow_run_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12(\n workflow_task_completed_event_id\x18\x07 \x01(\x03\x12\x39\n\x16\x62\x61\x63koff_start_interval\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12@\n\tinitiator\x18\t \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12\x35\n\x07\x66\x61ilure\x18\n \x01(\x0b\x32 .temporal.api.failure.v1.FailureB\x02\x18\x01\x12@\n\x16last_completion_result\x18\x0b \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12.\n\x06header\x18\x0c \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\r \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x0e \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x0f \x01(\x08\x42\x02\x18\x01\x12[\n\x1binitial_versioning_behavior\x18\x10 \x01(\x0e\x32\x36.temporal.api.enums.v1.ContinueAsNewVersioningBehavior"\xac\x01\n$WorkflowTaskScheduledEventAttributes\x12\x38\n\ntask_queue\x18\x01 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x39\n\x16start_to_close_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0f\n\x07\x61ttempt\x18\x03 \x01(\x05"\xa0\x03\n"WorkflowTaskStartedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x1f\n\x17suggest_continue_as_new\x18\x04 \x01(\x08\x12Z\n\x1fsuggest_continue_as_new_reasons\x18\x08 \x03(\x0e\x32\x31.temporal.api.enums.v1.SuggestContinueAsNewReason\x12\x30\n(target_worker_deployment_version_changed\x18\t \x01(\x08\x12\x1a\n\x12history_size_bytes\x18\x05 \x01(\x03\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12%\n\x19\x62uild_id_redirect_counter\x18\x07 \x01(\x03\x42\x02\x18\x01"\xc7\x05\n$WorkflowTaskCompletedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x1b\n\x0f\x62inary_checksum\x18\x04 \x01(\tB\x02\x18\x01\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12H\n\x0csdk_metadata\x18\x06 \x01(\x0b\x32\x32.temporal.api.sdk.v1.WorkflowTaskCompletedMetadata\x12\x43\n\x11metering_metadata\x18\r \x01(\x0b\x32(.temporal.api.common.v1.MeteringMetadata\x12>\n\ndeployment\x18\x07 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12\x46\n\x13versioning_behavior\x18\x08 \x01(\x0e\x32).temporal.api.enums.v1.VersioningBehavior\x12%\n\x19worker_deployment_version\x18\t \x01(\tB\x02\x18\x01\x12\x1e\n\x16worker_deployment_name\x18\n \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x0b \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x43\n\x16\x63onsumed_stream_ranges\x18\x14 \x03(\x0b\x32#.temporal.api.stream.v1.StreamRange"\x95\x01\n#WorkflowTaskTimedOutEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12\x38\n\x0ctimeout_type\x18\x03 \x01(\x0e\x32".temporal.api.enums.v1.TimeoutType"\x87\x03\n!WorkflowTaskFailedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12=\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowTaskFailedCause\x12\x31\n\x07\x66\x61ilure\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x13\n\x0b\x62\x61se_run_id\x18\x06 \x01(\t\x12\x12\n\nnew_run_id\x18\x07 \x01(\t\x12\x1a\n\x12\x66ork_event_version\x18\x08 \x01(\x03\x12\x1b\n\x0f\x62inary_checksum\x18\t \x01(\tB\x02\x18\x01\x12\x46\n\x0eworker_version\x18\n \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\xc2\x05\n$ActivityTaskScheduledEventAttributes\x12\x13\n\x0b\x61\x63tivity_id\x18\x01 \x01(\t\x12;\n\ractivity_type\x18\x02 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12.\n\x06header\x18\x05 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12/\n\x05input\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12<\n\x19schedule_to_close_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12(\n workflow_task_completed_event_id\x18\x0b \x01(\x03\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12!\n\x15use_workflow_build_id\x18\r \x01(\x08\x42\x02\x18\x01\x12\x32\n\x08priority\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.PriorityJ\x04\x08\x03\x10\x04"\x9e\x02\n"ActivityTaskStartedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x0f\n\x07\x61ttempt\x18\x04 \x01(\x05\x12\x36\n\x0clast_failure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12%\n\x19\x62uild_id_redirect_counter\x18\x07 \x01(\x03\x42\x02\x18\x01"\xe8\x01\n$ActivityTaskCompletedEventAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1a\n\x12scheduled_event_id\x18\x02 \x01(\x03\x12\x18\n\x10started_event_id\x18\x03 \x01(\x03\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\x9e\x02\n!ActivityTaskFailedEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x1a\n\x12scheduled_event_id\x18\x02 \x01(\x03\x12\x18\n\x10started_event_id\x18\x03 \x01(\x03\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x36\n\x0bretry_state\x18\x05 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\xc6\x01\n#ActivityTaskTimedOutEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x1a\n\x12scheduled_event_id\x18\x02 \x01(\x03\x12\x18\n\x10started_event_id\x18\x03 \x01(\x03\x12\x36\n\x0bretry_state\x18\x04 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState"r\n*ActivityTaskCancelRequestedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03"\x92\x02\n#ActivityTaskCanceledEventAttributes\x12\x31\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12(\n latest_cancel_requested_event_id\x18\x02 \x01(\x03\x12\x1a\n\x12scheduled_event_id\x18\x03 \x01(\x03\x12\x18\n\x10started_event_id\x18\x04 \x01(\x03\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01"\x93\x01\n\x1bTimerStartedEventAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x38\n\x15start_to_fire_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03"G\n\x19TimerFiredEventAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03"\x86\x01\n\x1cTimerCanceledEventAttributes\x12\x10\n\x08timer_id\x18\x01 \x01(\t\x12\x18\n\x10started_event_id\x18\x02 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03\x12\x10\n\x08identity\x18\x04 \x01(\t"\xc7\x01\n/WorkflowExecutionCancelRequestedEventAttributes\x12\r\n\x05\x63\x61use\x18\x01 \x01(\t\x12#\n\x1b\x65xternal_initiated_event_id\x18\x02 \x01(\x03\x12N\n\x1b\x65xternal_workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x04 \x01(\t"\x87\x01\n(WorkflowExecutionCanceledEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads"\xe9\x02\n\x1dMarkerRecordedEventAttributes\x12\x13\n\x0bmarker_name\x18\x01 \x01(\t\x12T\n\x07\x64\x65tails\x18\x02 \x03(\x0b\x32\x43.temporal.api.history.v1.MarkerRecordedEventAttributes.DetailsEntry\x12(\n workflow_task_completed_event_id\x18\x03 \x01(\x03\x12.\n\x06header\x18\x04 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x1aP\n\x0c\x44\x65tailsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12/\n\x05value\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads:\x02\x38\x01"\xbf\x02\n(WorkflowExecutionSignaledEventAttributes\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12/\n\x05input\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12.\n\x06header\x18\x04 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\'\n\x1bskip_generate_workflow_task\x18\x05 \x01(\x08\x42\x02\x18\x01\x12N\n\x1b\x65xternal_workflow_execution\x18\x06 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x12\n\nrequest_id\x18\x07 \x01(\t"\x81\x01\n*WorkflowExecutionTerminatedEventAttributes\x12\x0e\n\x06reason\x18\x01 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t"\x9c\x02\n>RequestCancelExternalWorkflowExecutionInitiatedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x07\x63ontrol\x18\x04 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x05 \x01(\x08\x12\x0e\n\x06reason\x18\x06 \x01(\t"\xda\x02\n;RequestCancelExternalWorkflowExecutionFailedEventAttributes\x12P\n\x05\x63\x61use\x18\x01 \x01(\x0e\x32\x41.temporal.api.enums.v1.CancelExternalWorkflowExecutionFailedCause\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x11\n\tnamespace\x18\x03 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x04 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x13\n\x07\x63ontrol\x18\x06 \x01(\tB\x02\x18\x01"\xc5\x01\n7ExternalWorkflowExecutionCancelRequestedEventAttributes\x12\x1a\n\x12initiated_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x04 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"\xfb\x02\n7SignalExternalWorkflowExecutionInitiatedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\t \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x0bsignal_name\x18\x04 \x01(\t\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x07\x63ontrol\x18\x06 \x01(\tB\x02\x18\x01\x12\x1b\n\x13\x63hild_workflow_only\x18\x07 \x01(\x08\x12.\n\x06header\x18\x08 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header"\xd3\x02\n4SignalExternalWorkflowExecutionFailedEventAttributes\x12P\n\x05\x63\x61use\x18\x01 \x01(\x0e\x32\x41.temporal.api.enums.v1.SignalExternalWorkflowExecutionFailedCause\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x11\n\tnamespace\x18\x03 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x04 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x13\n\x07\x63ontrol\x18\x06 \x01(\tB\x02\x18\x01"\xd3\x01\n0ExternalWorkflowExecutionSignaledEventAttributes\x12\x1a\n\x12initiated_event_id\x18\x01 \x01(\x03\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x05 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x07\x63ontrol\x18\x04 \x01(\tB\x02\x18\x01"\x9e\x01\n-UpsertWorkflowSearchAttributesEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x43\n\x11search_attributes\x18\x02 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes"\x8a\x01\n)WorkflowPropertiesModifiedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x33\n\rupserted_memo\x18\x02 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\xfc\t\n3StartChildWorkflowExecutionInitiatedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x12 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x45\n\x13parent_close_policy\x18\t \x01(\x0e\x32(.temporal.api.enums.v1.ParentClosePolicy\x12\x13\n\x07\x63ontrol\x18\n \x01(\tB\x02\x18\x01\x12(\n workflow_task_completed_event_id\x18\x0b \x01(\x03\x12N\n\x18workflow_id_reuse_policy\x18\x0c \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12\x39\n\x0cretry_policy\x18\r \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\x0e \x01(\t\x12.\n\x06header\x18\x0f \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12*\n\x04memo\x18\x10 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x11 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x1c\n\x10inherit_build_id\x18\x13 \x01(\x08\x42\x02\x18\x01\x12\x32\n\x08priority\x18\x14 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12H\n\x14time_skipping_config\x18\x15 \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig\x12]\n\x1ftime_skipping_state_propagation\x18\x17 \x01(\x0b\x32\x34.temporal.api.common.v1.TimeSkippingStatePropagation\x12I\n\x13versioning_override\x18\x18 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverrideJ\x04\x08\x16\x10\x17R\x18initial_skipped_duration"\xd6\x02\n0StartChildWorkflowExecutionFailedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x08 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12L\n\x05\x63\x61use\x18\x04 \x01(\x0e\x32=.temporal.api.enums.v1.StartChildWorkflowExecutionFailedCause\x12\x13\n\x07\x63ontrol\x18\x05 \x01(\tB\x02\x18\x01\x12\x1a\n\x12initiated_event_id\x18\x06 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x07 \x01(\x03"\xa7\x02\n,ChildWorkflowExecutionStartedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x06 \x01(\t\x12\x1a\n\x12initiated_event_id\x18\x02 \x01(\x03\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12.\n\x06header\x18\x05 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header"\xc5\x02\n.ChildWorkflowExecutionCompletedEventAttributes\x12\x30\n\x06result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x18\n\x10started_event_id\x18\x06 \x01(\x03"\xfb\x02\n+ChildWorkflowExecutionFailedEventAttributes\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x08 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x18\n\x10started_event_id\x18\x06 \x01(\x03\x12\x36\n\x0bretry_state\x18\x07 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState"\xc5\x02\n-ChildWorkflowExecutionCanceledEventAttributes\x12\x31\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x03 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x04 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x05 \x01(\x03\x12\x18\n\x10started_event_id\x18\x06 \x01(\x03"\xca\x02\n-ChildWorkflowExecutionTimedOutEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x07 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x04 \x01(\x03\x12\x18\n\x10started_event_id\x18\x05 \x01(\x03\x12\x36\n\x0bretry_state\x18\x06 \x01(\x0e\x32!.temporal.api.enums.v1.RetryState"\x94\x02\n/ChildWorkflowExecutionTerminatedEventAttributes\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0cnamespace_id\x18\x06 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x1a\n\x12initiated_event_id\x18\x04 \x01(\x03\x12\x18\n\x10started_event_id\x18\x05 \x01(\x03"\xda\x05\n.WorkflowExecutionOptionsUpdatedEventAttributes\x12I\n\x13versioning_override\x18\x01 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12!\n\x19unset_versioning_override\x18\x02 \x01(\x08\x12\x1b\n\x13\x61ttached_request_id\x18\x03 \x01(\t\x12G\n\x1d\x61ttached_completion_callbacks\x18\x04 \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x32\n\x08priority\x18\x06 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12H\n\x14time_skipping_config\x18\x07 \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig\x12$\n\x1ctime_skipping_config_updated\x18\t \x01(\x08\x12\x84\x01\n\x17workflow_update_options\x18\x08 \x03(\x0b\x32\x63.temporal.api.history.v1.WorkflowExecutionOptionsUpdatedEventAttributes.WorkflowUpdateOptionsUpdate\x1a\x96\x01\n\x1bWorkflowUpdateOptionsUpdate\x12\x11\n\tupdate_id\x18\x01 \x01(\t\x12\x1b\n\x13\x61ttached_request_id\x18\x02 \x01(\t\x12G\n\x1d\x61ttached_completion_callbacks\x18\x03 \x03(\x0b\x32 .temporal.api.common.v1.Callback"\xc0\x02\n3WorkflowPropertiesModifiedExternallyEventAttributes\x12\x16\n\x0enew_task_queue\x18\x01 \x01(\t\x12<\n\x19new_workflow_task_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12;\n\x18new_workflow_run_timeout\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x41\n\x1enew_workflow_execution_timeout\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x33\n\rupserted_memo\x18\x05 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\x90\x01\n3ActivityPropertiesModifiedExternallyEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12=\n\x10new_retry_policy\x18\x02 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy"|\n\'WorkflowStreamSubscribedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x11\n\tstream_id\x18\x02 \x01(\t\x12\x14\n\x0cstart_offset\x18\x03 \x01(\x03"\x97\x01\n,WorkflowStreamRecordsAppendedEventAttributes\x12(\n workflow_task_completed_event_id\x18\x01 \x01(\x03\x12\x11\n\tstream_id\x18\x02 \x01(\t\x12\x14\n\x0c\x66irst_offset\x18\x03 \x01(\x03\x12\x14\n\x0crecord_count\x18\x04 \x01(\x03"\xdc\x01\n.WorkflowExecutionUpdateAcceptedEventAttributes\x12\x1c\n\x14protocol_instance_id\x18\x01 \x01(\t\x12#\n\x1b\x61\x63\x63\x65pted_request_message_id\x18\x02 \x01(\t\x12,\n$accepted_request_sequencing_event_id\x18\x03 \x01(\x03\x12\x39\n\x10\x61\x63\x63\x65pted_request\x18\x04 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request"\xaa\x01\n/WorkflowExecutionUpdateCompletedEventAttributes\x12*\n\x04meta\x18\x01 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x19\n\x11\x61\x63\x63\x65pted_event_id\x18\x03 \x01(\x03\x12\x30\n\x07outcome\x18\x02 \x01(\x0b\x32\x1f.temporal.api.update.v1.Outcome"\x8f\x02\n.WorkflowExecutionUpdateRejectedEventAttributes\x12\x1c\n\x14protocol_instance_id\x18\x01 \x01(\t\x12#\n\x1brejected_request_message_id\x18\x02 \x01(\t\x12,\n$rejected_request_sequencing_event_id\x18\x03 \x01(\x03\x12\x39\n\x10rejected_request\x18\x04 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"\xa4\x01\n.WorkflowExecutionUpdateAdmittedEventAttributes\x12\x30\n\x07request\x18\x01 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request\x12@\n\x06origin\x18\x02 \x01(\x0e\x32\x30.temporal.api.enums.v1.UpdateAdmittedEventOrigin"^\n&WorkflowExecutionPausedEventAttributes\x12\x10\n\x08identity\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t"`\n(WorkflowExecutionUnpausedEventAttributes\x12\x10\n\x08identity\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\xc5\x01\n8WorkflowExecutionTimeSkippingTransitionedEventAttributes\x12/\n\x0btarget_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12#\n\x1b\x64isabled_after_fast_forward\x18\x02 \x01(\x08\x12\x33\n\x0fwall_clock_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb4\x04\n&NexusOperationScheduledEventAttributes\x12\x10\n\x08\x65ndpoint\x18\x01 \x01(\t\x12\x0f\n\x07service\x18\x02 \x01(\t\x12\x11\n\toperation\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x66\n\x0cnexus_header\x18\x06 \x03(\x0b\x32P.temporal.api.history.v1.NexusOperationScheduledEventAttributes.NexusHeaderEntry\x12(\n workflow_task_completed_event_id\x18\x07 \x01(\x03\x12\x12\n\nrequest_id\x18\x08 \x01(\t\x12\x13\n\x0b\x65ndpoint_id\x18\t \x01(\t\x12<\n\x19schedule_to_start_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x89\x01\n$NexusOperationStartedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x18\n\x0coperation_id\x18\x03 \x01(\tB\x02\x18\x01\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x12\x17\n\x0foperation_token\x18\x05 \x01(\t"\x89\x01\n&NexusOperationCompletedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12/\n\x06result\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\x88\x01\n#NexusOperationFailedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\x8a\x01\n%NexusOperationTimedOutEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x12\n\nrequest_id\x18\x03 \x01(\t"\x8a\x01\n%NexusOperationCanceledEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x12\n\nrequest_id\x18\x03 \x01(\t"t\n,NexusOperationCancelRequestedEventAttributes\x12\x1a\n\x12scheduled_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03"\x97\x01\n3NexusOperationCancelRequestCompletedEventAttributes\x12\x1a\n\x12requested_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x1a\n\x12scheduled_event_id\x18\x03 \x01(\x03"\xc7\x01\n0NexusOperationCancelRequestFailedEventAttributes\x12\x1a\n\x12requested_event_id\x18\x01 \x01(\x03\x12(\n workflow_task_completed_event_id\x18\x02 \x01(\x03\x12\x31\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x1a\n\x12scheduled_event_id\x18\x04 \x01(\x03"\xc8\x41\n\x0cHistoryEvent\x12\x10\n\x08\x65vent_id\x18\x01 \x01(\x03\x12.\n\nevent_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\nevent_type\x18\x03 \x01(\x0e\x32 .temporal.api.enums.v1.EventType\x12\x0f\n\x07version\x18\x04 \x01(\x03\x12\x0f\n\x07task_id\x18\x05 \x01(\x03\x12\x1a\n\x11worker_may_ignore\x18\xac\x02 \x01(\x08\x12\x39\n\ruser_metadata\x18\xad\x02 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12,\n\x05links\x18\xae\x02 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12\x35\n\tprincipal\x18\xaf\x02 \x01(\x0b\x32!.temporal.api.common.v1.Principal\x12\x43\n\x13\x65vent_group_markers\x18\xb0\x02 \x03(\x0b\x32%.temporal.api.sdk.v1.EventGroupMarker\x12w\n+workflow_execution_started_event_attributes\x18\x06 \x01(\x0b\x32@.temporal.api.history.v1.WorkflowExecutionStartedEventAttributesH\x00\x12{\n-workflow_execution_completed_event_attributes\x18\x07 \x01(\x0b\x32\x42.temporal.api.history.v1.WorkflowExecutionCompletedEventAttributesH\x00\x12u\n*workflow_execution_failed_event_attributes\x18\x08 \x01(\x0b\x32?.temporal.api.history.v1.WorkflowExecutionFailedEventAttributesH\x00\x12z\n-workflow_execution_timed_out_event_attributes\x18\t \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionTimedOutEventAttributesH\x00\x12q\n(workflow_task_scheduled_event_attributes\x18\n \x01(\x0b\x32=.temporal.api.history.v1.WorkflowTaskScheduledEventAttributesH\x00\x12m\n&workflow_task_started_event_attributes\x18\x0b \x01(\x0b\x32;.temporal.api.history.v1.WorkflowTaskStartedEventAttributesH\x00\x12q\n(workflow_task_completed_event_attributes\x18\x0c \x01(\x0b\x32=.temporal.api.history.v1.WorkflowTaskCompletedEventAttributesH\x00\x12p\n(workflow_task_timed_out_event_attributes\x18\r \x01(\x0b\x32<.temporal.api.history.v1.WorkflowTaskTimedOutEventAttributesH\x00\x12k\n%workflow_task_failed_event_attributes\x18\x0e \x01(\x0b\x32:.temporal.api.history.v1.WorkflowTaskFailedEventAttributesH\x00\x12q\n(activity_task_scheduled_event_attributes\x18\x0f \x01(\x0b\x32=.temporal.api.history.v1.ActivityTaskScheduledEventAttributesH\x00\x12m\n&activity_task_started_event_attributes\x18\x10 \x01(\x0b\x32;.temporal.api.history.v1.ActivityTaskStartedEventAttributesH\x00\x12q\n(activity_task_completed_event_attributes\x18\x11 \x01(\x0b\x32=.temporal.api.history.v1.ActivityTaskCompletedEventAttributesH\x00\x12k\n%activity_task_failed_event_attributes\x18\x12 \x01(\x0b\x32:.temporal.api.history.v1.ActivityTaskFailedEventAttributesH\x00\x12p\n(activity_task_timed_out_event_attributes\x18\x13 \x01(\x0b\x32<.temporal.api.history.v1.ActivityTaskTimedOutEventAttributesH\x00\x12^\n\x1etimer_started_event_attributes\x18\x14 \x01(\x0b\x32\x34.temporal.api.history.v1.TimerStartedEventAttributesH\x00\x12Z\n\x1ctimer_fired_event_attributes\x18\x15 \x01(\x0b\x32\x32.temporal.api.history.v1.TimerFiredEventAttributesH\x00\x12~\n/activity_task_cancel_requested_event_attributes\x18\x16 \x01(\x0b\x32\x43.temporal.api.history.v1.ActivityTaskCancelRequestedEventAttributesH\x00\x12o\n\'activity_task_canceled_event_attributes\x18\x17 \x01(\x0b\x32<.temporal.api.history.v1.ActivityTaskCanceledEventAttributesH\x00\x12`\n\x1ftimer_canceled_event_attributes\x18\x18 \x01(\x0b\x32\x35.temporal.api.history.v1.TimerCanceledEventAttributesH\x00\x12\x62\n marker_recorded_event_attributes\x18\x19 \x01(\x0b\x32\x36.temporal.api.history.v1.MarkerRecordedEventAttributesH\x00\x12y\n,workflow_execution_signaled_event_attributes\x18\x1a \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionSignaledEventAttributesH\x00\x12}\n.workflow_execution_terminated_event_attributes\x18\x1b \x01(\x0b\x32\x43.temporal.api.history.v1.WorkflowExecutionTerminatedEventAttributesH\x00\x12\x88\x01\n4workflow_execution_cancel_requested_event_attributes\x18\x1c \x01(\x0b\x32H.temporal.api.history.v1.WorkflowExecutionCancelRequestedEventAttributesH\x00\x12y\n,workflow_execution_canceled_event_attributes\x18\x1d \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionCanceledEventAttributesH\x00\x12\xa8\x01\nErequest_cancel_external_workflow_execution_initiated_event_attributes\x18\x1e \x01(\x0b\x32W.temporal.api.history.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributesH\x00\x12\xa2\x01\nBrequest_cancel_external_workflow_execution_failed_event_attributes\x18\x1f \x01(\x0b\x32T.temporal.api.history.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributesH\x00\x12\x99\x01\n=external_workflow_execution_cancel_requested_event_attributes\x18 \x01(\x0b\x32P.temporal.api.history.v1.ExternalWorkflowExecutionCancelRequestedEventAttributesH\x00\x12\x87\x01\n4workflow_execution_continued_as_new_event_attributes\x18! \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionContinuedAsNewEventAttributesH\x00\x12\x91\x01\n9start_child_workflow_execution_initiated_event_attributes\x18" \x01(\x0b\x32L.temporal.api.history.v1.StartChildWorkflowExecutionInitiatedEventAttributesH\x00\x12\x8b\x01\n6start_child_workflow_execution_failed_event_attributes\x18# \x01(\x0b\x32I.temporal.api.history.v1.StartChildWorkflowExecutionFailedEventAttributesH\x00\x12\x82\x01\n1child_workflow_execution_started_event_attributes\x18$ \x01(\x0b\x32\x45.temporal.api.history.v1.ChildWorkflowExecutionStartedEventAttributesH\x00\x12\x86\x01\n3child_workflow_execution_completed_event_attributes\x18% \x01(\x0b\x32G.temporal.api.history.v1.ChildWorkflowExecutionCompletedEventAttributesH\x00\x12\x80\x01\n0child_workflow_execution_failed_event_attributes\x18& \x01(\x0b\x32\x44.temporal.api.history.v1.ChildWorkflowExecutionFailedEventAttributesH\x00\x12\x84\x01\n2child_workflow_execution_canceled_event_attributes\x18\' \x01(\x0b\x32\x46.temporal.api.history.v1.ChildWorkflowExecutionCanceledEventAttributesH\x00\x12\x85\x01\n3child_workflow_execution_timed_out_event_attributes\x18( \x01(\x0b\x32\x46.temporal.api.history.v1.ChildWorkflowExecutionTimedOutEventAttributesH\x00\x12\x88\x01\n4child_workflow_execution_terminated_event_attributes\x18) \x01(\x0b\x32H.temporal.api.history.v1.ChildWorkflowExecutionTerminatedEventAttributesH\x00\x12\x99\x01\n=signal_external_workflow_execution_initiated_event_attributes\x18* \x01(\x0b\x32P.temporal.api.history.v1.SignalExternalWorkflowExecutionInitiatedEventAttributesH\x00\x12\x93\x01\n:signal_external_workflow_execution_failed_event_attributes\x18+ \x01(\x0b\x32M.temporal.api.history.v1.SignalExternalWorkflowExecutionFailedEventAttributesH\x00\x12\x8a\x01\n5external_workflow_execution_signaled_event_attributes\x18, \x01(\x0b\x32I.temporal.api.history.v1.ExternalWorkflowExecutionSignaledEventAttributesH\x00\x12\x84\x01\n2upsert_workflow_search_attributes_event_attributes\x18- \x01(\x0b\x32\x46.temporal.api.history.v1.UpsertWorkflowSearchAttributesEventAttributesH\x00\x12\x86\x01\n3workflow_execution_update_accepted_event_attributes\x18. \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionUpdateAcceptedEventAttributesH\x00\x12\x86\x01\n3workflow_execution_update_rejected_event_attributes\x18/ \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionUpdateRejectedEventAttributesH\x00\x12\x88\x01\n4workflow_execution_update_completed_event_attributes\x18\x30 \x01(\x0b\x32H.temporal.api.history.v1.WorkflowExecutionUpdateCompletedEventAttributesH\x00\x12\x90\x01\n8workflow_properties_modified_externally_event_attributes\x18\x31 \x01(\x0b\x32L.temporal.api.history.v1.WorkflowPropertiesModifiedExternallyEventAttributesH\x00\x12\x90\x01\n8activity_properties_modified_externally_event_attributes\x18\x32 \x01(\x0b\x32L.temporal.api.history.v1.ActivityPropertiesModifiedExternallyEventAttributesH\x00\x12{\n-workflow_properties_modified_event_attributes\x18\x33 \x01(\x0b\x32\x42.temporal.api.history.v1.WorkflowPropertiesModifiedEventAttributesH\x00\x12\x86\x01\n3workflow_execution_update_admitted_event_attributes\x18\x34 \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionUpdateAdmittedEventAttributesH\x00\x12u\n*nexus_operation_scheduled_event_attributes\x18\x35 \x01(\x0b\x32?.temporal.api.history.v1.NexusOperationScheduledEventAttributesH\x00\x12q\n(nexus_operation_started_event_attributes\x18\x36 \x01(\x0b\x32=.temporal.api.history.v1.NexusOperationStartedEventAttributesH\x00\x12u\n*nexus_operation_completed_event_attributes\x18\x37 \x01(\x0b\x32?.temporal.api.history.v1.NexusOperationCompletedEventAttributesH\x00\x12o\n\'nexus_operation_failed_event_attributes\x18\x38 \x01(\x0b\x32<.temporal.api.history.v1.NexusOperationFailedEventAttributesH\x00\x12s\n)nexus_operation_canceled_event_attributes\x18\x39 \x01(\x0b\x32>.temporal.api.history.v1.NexusOperationCanceledEventAttributesH\x00\x12t\n*nexus_operation_timed_out_event_attributes\x18: \x01(\x0b\x32>.temporal.api.history.v1.NexusOperationTimedOutEventAttributesH\x00\x12\x82\x01\n1nexus_operation_cancel_requested_event_attributes\x18; \x01(\x0b\x32\x45.temporal.api.history.v1.NexusOperationCancelRequestedEventAttributesH\x00\x12\x86\x01\n3workflow_execution_options_updated_event_attributes\x18< \x01(\x0b\x32G.temporal.api.history.v1.WorkflowExecutionOptionsUpdatedEventAttributesH\x00\x12\x91\x01\n9nexus_operation_cancel_request_completed_event_attributes\x18= \x01(\x0b\x32L.temporal.api.history.v1.NexusOperationCancelRequestCompletedEventAttributesH\x00\x12\x8b\x01\n6nexus_operation_cancel_request_failed_event_attributes\x18> \x01(\x0b\x32I.temporal.api.history.v1.NexusOperationCancelRequestFailedEventAttributesH\x00\x12u\n*workflow_execution_paused_event_attributes\x18? \x01(\x0b\x32?.temporal.api.history.v1.WorkflowExecutionPausedEventAttributesH\x00\x12y\n,workflow_execution_unpaused_event_attributes\x18@ \x01(\x0b\x32\x41.temporal.api.history.v1.WorkflowExecutionUnpausedEventAttributesH\x00\x12\x9b\x01\n>workflow_execution_time_skipping_transitioned_event_attributes\x18\x41 \x01(\x0b\x32Q.temporal.api.history.v1.WorkflowExecutionTimeSkippingTransitionedEventAttributesH\x00\x12w\n+workflow_stream_subscribed_event_attributes\x18\x42 \x01(\x0b\x32@.temporal.api.history.v1.WorkflowStreamSubscribedEventAttributesH\x00\x12\x82\x01\n1workflow_stream_records_appended_event_attributes\x18\x43 \x01(\x0b\x32\x45.temporal.api.history.v1.WorkflowStreamRecordsAppendedEventAttributesH\x00\x42\x0c\n\nattributes"@\n\x07History\x12\x35\n\x06\x65vents\x18\x01 \x03(\x0b\x32%.temporal.api.history.v1.HistoryEventB\x8e\x01\n\x1aio.temporal.api.history.v1B\x0cMessageProtoP\x01Z%go.temporal.io/api/history/v1;history\xaa\x02\x19Temporalio.Api.History.V1\xea\x02\x1cTemporalio::Api::History::V1b\x06proto3' ) @@ -215,6 +218,12 @@ _ACTIVITYPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES = DESCRIPTOR.message_types_by_name[ "ActivityPropertiesModifiedExternallyEventAttributes" ] +_WORKFLOWSTREAMSUBSCRIBEDEVENTATTRIBUTES = DESCRIPTOR.message_types_by_name[ + "WorkflowStreamSubscribedEventAttributes" +] +_WORKFLOWSTREAMRECORDSAPPENDEDEVENTATTRIBUTES = DESCRIPTOR.message_types_by_name[ + "WorkflowStreamRecordsAppendedEventAttributes" +] _WORKFLOWEXECUTIONUPDATEACCEPTEDEVENTATTRIBUTES = DESCRIPTOR.message_types_by_name[ "WorkflowExecutionUpdateAcceptedEventAttributes" ] @@ -819,6 +828,28 @@ ) _sym_db.RegisterMessage(ActivityPropertiesModifiedExternallyEventAttributes) +WorkflowStreamSubscribedEventAttributes = _reflection.GeneratedProtocolMessageType( + "WorkflowStreamSubscribedEventAttributes", + (_message.Message,), + { + "DESCRIPTOR": _WORKFLOWSTREAMSUBSCRIBEDEVENTATTRIBUTES, + "__module__": "temporalio.api.history.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.history.v1.WorkflowStreamSubscribedEventAttributes) + }, +) +_sym_db.RegisterMessage(WorkflowStreamSubscribedEventAttributes) + +WorkflowStreamRecordsAppendedEventAttributes = _reflection.GeneratedProtocolMessageType( + "WorkflowStreamRecordsAppendedEventAttributes", + (_message.Message,), + { + "DESCRIPTOR": _WORKFLOWSTREAMRECORDSAPPENDEDEVENTATTRIBUTES, + "__module__": "temporalio.api.history.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.history.v1.WorkflowStreamRecordsAppendedEventAttributes) + }, +) +_sym_db.RegisterMessage(WorkflowStreamRecordsAppendedEventAttributes) + WorkflowExecutionUpdateAcceptedEventAttributes = ( _reflection.GeneratedProtocolMessageType( "WorkflowExecutionUpdateAcceptedEventAttributes", @@ -1210,140 +1241,144 @@ _NEXUSOPERATIONSTARTEDEVENTATTRIBUTES.fields_by_name[ "operation_id" ]._serialized_options = b"\030\001" - _WORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_start = 663 - _WORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_end = 3057 - _DECLINEDTARGETVERSIONUPGRADE._serialized_start = 3060 - _DECLINEDTARGETVERSIONUPGRADE._serialized_end = 3196 - _WORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_start = 3199 - _WORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_end = 3364 - _WORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 3367 - _WORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 3586 - _WORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_start = 3589 - _WORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_end = 3717 - _WORKFLOWEXECUTIONCONTINUEDASNEWEVENTATTRIBUTES._serialized_start = 3720 - _WORKFLOWEXECUTIONCONTINUEDASNEWEVENTATTRIBUTES._serialized_end = 4653 - _WORKFLOWTASKSCHEDULEDEVENTATTRIBUTES._serialized_start = 4656 - _WORKFLOWTASKSCHEDULEDEVENTATTRIBUTES._serialized_end = 4828 - _WORKFLOWTASKSTARTEDEVENTATTRIBUTES._serialized_start = 4831 - _WORKFLOWTASKSTARTEDEVENTATTRIBUTES._serialized_end = 5247 - _WORKFLOWTASKCOMPLETEDEVENTATTRIBUTES._serialized_start = 5250 - _WORKFLOWTASKCOMPLETEDEVENTATTRIBUTES._serialized_end = 5892 - _WORKFLOWTASKTIMEDOUTEVENTATTRIBUTES._serialized_start = 5895 - _WORKFLOWTASKTIMEDOUTEVENTATTRIBUTES._serialized_end = 6044 - _WORKFLOWTASKFAILEDEVENTATTRIBUTES._serialized_start = 6047 - _WORKFLOWTASKFAILEDEVENTATTRIBUTES._serialized_end = 6438 - _ACTIVITYTASKSCHEDULEDEVENTATTRIBUTES._serialized_start = 6441 - _ACTIVITYTASKSCHEDULEDEVENTATTRIBUTES._serialized_end = 7147 - _ACTIVITYTASKSTARTEDEVENTATTRIBUTES._serialized_start = 7150 - _ACTIVITYTASKSTARTEDEVENTATTRIBUTES._serialized_end = 7436 - _ACTIVITYTASKCOMPLETEDEVENTATTRIBUTES._serialized_start = 7439 - _ACTIVITYTASKCOMPLETEDEVENTATTRIBUTES._serialized_end = 7671 - _ACTIVITYTASKFAILEDEVENTATTRIBUTES._serialized_start = 7674 - _ACTIVITYTASKFAILEDEVENTATTRIBUTES._serialized_end = 7960 - _ACTIVITYTASKTIMEDOUTEVENTATTRIBUTES._serialized_start = 7963 - _ACTIVITYTASKTIMEDOUTEVENTATTRIBUTES._serialized_end = 8161 - _ACTIVITYTASKCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 8163 - _ACTIVITYTASKCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 8277 - _ACTIVITYTASKCANCELEDEVENTATTRIBUTES._serialized_start = 8280 - _ACTIVITYTASKCANCELEDEVENTATTRIBUTES._serialized_end = 8554 - _TIMERSTARTEDEVENTATTRIBUTES._serialized_start = 8557 - _TIMERSTARTEDEVENTATTRIBUTES._serialized_end = 8704 - _TIMERFIREDEVENTATTRIBUTES._serialized_start = 8706 - _TIMERFIREDEVENTATTRIBUTES._serialized_end = 8777 - _TIMERCANCELEDEVENTATTRIBUTES._serialized_start = 8780 - _TIMERCANCELEDEVENTATTRIBUTES._serialized_end = 8914 - _WORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 8917 - _WORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 9116 - _WORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_start = 9119 - _WORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_end = 9254 - _MARKERRECORDEDEVENTATTRIBUTES._serialized_start = 9257 - _MARKERRECORDEDEVENTATTRIBUTES._serialized_end = 9618 - _MARKERRECORDEDEVENTATTRIBUTES_DETAILSENTRY._serialized_start = 9538 - _MARKERRECORDEDEVENTATTRIBUTES_DETAILSENTRY._serialized_end = 9618 - _WORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_start = 9621 - _WORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_end = 9940 - _WORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_start = 9943 - _WORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_end = 10072 - _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_start = 10075 + _WORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_start = 701 + _WORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_end = 3095 + _DECLINEDTARGETVERSIONUPGRADE._serialized_start = 3098 + _DECLINEDTARGETVERSIONUPGRADE._serialized_end = 3234 + _WORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_start = 3237 + _WORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_end = 3402 + _WORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 3405 + _WORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 3624 + _WORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_start = 3627 + _WORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_end = 3755 + _WORKFLOWEXECUTIONCONTINUEDASNEWEVENTATTRIBUTES._serialized_start = 3758 + _WORKFLOWEXECUTIONCONTINUEDASNEWEVENTATTRIBUTES._serialized_end = 4691 + _WORKFLOWTASKSCHEDULEDEVENTATTRIBUTES._serialized_start = 4694 + _WORKFLOWTASKSCHEDULEDEVENTATTRIBUTES._serialized_end = 4866 + _WORKFLOWTASKSTARTEDEVENTATTRIBUTES._serialized_start = 4869 + _WORKFLOWTASKSTARTEDEVENTATTRIBUTES._serialized_end = 5285 + _WORKFLOWTASKCOMPLETEDEVENTATTRIBUTES._serialized_start = 5288 + _WORKFLOWTASKCOMPLETEDEVENTATTRIBUTES._serialized_end = 5999 + _WORKFLOWTASKTIMEDOUTEVENTATTRIBUTES._serialized_start = 6002 + _WORKFLOWTASKTIMEDOUTEVENTATTRIBUTES._serialized_end = 6151 + _WORKFLOWTASKFAILEDEVENTATTRIBUTES._serialized_start = 6154 + _WORKFLOWTASKFAILEDEVENTATTRIBUTES._serialized_end = 6545 + _ACTIVITYTASKSCHEDULEDEVENTATTRIBUTES._serialized_start = 6548 + _ACTIVITYTASKSCHEDULEDEVENTATTRIBUTES._serialized_end = 7254 + _ACTIVITYTASKSTARTEDEVENTATTRIBUTES._serialized_start = 7257 + _ACTIVITYTASKSTARTEDEVENTATTRIBUTES._serialized_end = 7543 + _ACTIVITYTASKCOMPLETEDEVENTATTRIBUTES._serialized_start = 7546 + _ACTIVITYTASKCOMPLETEDEVENTATTRIBUTES._serialized_end = 7778 + _ACTIVITYTASKFAILEDEVENTATTRIBUTES._serialized_start = 7781 + _ACTIVITYTASKFAILEDEVENTATTRIBUTES._serialized_end = 8067 + _ACTIVITYTASKTIMEDOUTEVENTATTRIBUTES._serialized_start = 8070 + _ACTIVITYTASKTIMEDOUTEVENTATTRIBUTES._serialized_end = 8268 + _ACTIVITYTASKCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 8270 + _ACTIVITYTASKCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 8384 + _ACTIVITYTASKCANCELEDEVENTATTRIBUTES._serialized_start = 8387 + _ACTIVITYTASKCANCELEDEVENTATTRIBUTES._serialized_end = 8661 + _TIMERSTARTEDEVENTATTRIBUTES._serialized_start = 8664 + _TIMERSTARTEDEVENTATTRIBUTES._serialized_end = 8811 + _TIMERFIREDEVENTATTRIBUTES._serialized_start = 8813 + _TIMERFIREDEVENTATTRIBUTES._serialized_end = 8884 + _TIMERCANCELEDEVENTATTRIBUTES._serialized_start = 8887 + _TIMERCANCELEDEVENTATTRIBUTES._serialized_end = 9021 + _WORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 9024 + _WORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 9223 + _WORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_start = 9226 + _WORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_end = 9361 + _MARKERRECORDEDEVENTATTRIBUTES._serialized_start = 9364 + _MARKERRECORDEDEVENTATTRIBUTES._serialized_end = 9725 + _MARKERRECORDEDEVENTATTRIBUTES_DETAILSENTRY._serialized_start = 9645 + _MARKERRECORDEDEVENTATTRIBUTES_DETAILSENTRY._serialized_end = 9725 + _WORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_start = 9728 + _WORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_end = 10047 + _WORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_start = 10050 + _WORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_end = 10179 + _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_start = 10182 _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_end = ( - 10359 + 10466 ) _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = ( - 10362 + 10469 ) - _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 10708 - _EXTERNALWORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 10711 - _EXTERNALWORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 10908 - _SIGNALEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_start = 10911 - _SIGNALEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_end = 11290 - _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 11293 - _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 11632 - _EXTERNALWORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_start = 11635 - _EXTERNALWORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_end = 11846 - _UPSERTWORKFLOWSEARCHATTRIBUTESEVENTATTRIBUTES._serialized_start = 11849 - _UPSERTWORKFLOWSEARCHATTRIBUTESEVENTATTRIBUTES._serialized_end = 12007 - _WORKFLOWPROPERTIESMODIFIEDEVENTATTRIBUTES._serialized_start = 12010 - _WORKFLOWPROPERTIESMODIFIEDEVENTATTRIBUTES._serialized_end = 12148 - _STARTCHILDWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_start = 12151 - _STARTCHILDWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_end = 13427 - _STARTCHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 13430 - _STARTCHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 13772 - _CHILDWORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_start = 13775 - _CHILDWORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_end = 14070 - _CHILDWORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_start = 14073 - _CHILDWORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_end = 14398 - _CHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 14401 - _CHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 14780 - _CHILDWORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_start = 14783 - _CHILDWORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_end = 15108 - _CHILDWORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_start = 15111 - _CHILDWORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_end = 15441 - _CHILDWORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_start = 15444 - _CHILDWORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_end = 15720 - _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES._serialized_start = 15723 - _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES._serialized_end = 16453 - _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES_WORKFLOWUPDATEOPTIONSUPDATE._serialized_start = 16303 - _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES_WORKFLOWUPDATEOPTIONSUPDATE._serialized_end = 16453 - _WORKFLOWPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_start = 16456 - _WORKFLOWPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_end = 16776 - _ACTIVITYPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_start = 16779 - _ACTIVITYPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_end = 16923 - _WORKFLOWEXECUTIONUPDATEACCEPTEDEVENTATTRIBUTES._serialized_start = 16926 - _WORKFLOWEXECUTIONUPDATEACCEPTEDEVENTATTRIBUTES._serialized_end = 17146 - _WORKFLOWEXECUTIONUPDATECOMPLETEDEVENTATTRIBUTES._serialized_start = 17149 - _WORKFLOWEXECUTIONUPDATECOMPLETEDEVENTATTRIBUTES._serialized_end = 17319 - _WORKFLOWEXECUTIONUPDATEREJECTEDEVENTATTRIBUTES._serialized_start = 17322 - _WORKFLOWEXECUTIONUPDATEREJECTEDEVENTATTRIBUTES._serialized_end = 17593 - _WORKFLOWEXECUTIONUPDATEADMITTEDEVENTATTRIBUTES._serialized_start = 17596 - _WORKFLOWEXECUTIONUPDATEADMITTEDEVENTATTRIBUTES._serialized_end = 17760 - _WORKFLOWEXECUTIONPAUSEDEVENTATTRIBUTES._serialized_start = 17762 - _WORKFLOWEXECUTIONPAUSEDEVENTATTRIBUTES._serialized_end = 17856 - _WORKFLOWEXECUTIONUNPAUSEDEVENTATTRIBUTES._serialized_start = 17858 - _WORKFLOWEXECUTIONUNPAUSEDEVENTATTRIBUTES._serialized_end = 17954 - _WORKFLOWEXECUTIONTIMESKIPPINGTRANSITIONEDEVENTATTRIBUTES._serialized_start = 17957 - _WORKFLOWEXECUTIONTIMESKIPPINGTRANSITIONEDEVENTATTRIBUTES._serialized_end = 18154 - _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES._serialized_start = 18157 - _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES._serialized_end = 18721 - _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES_NEXUSHEADERENTRY._serialized_start = 18671 - _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES_NEXUSHEADERENTRY._serialized_end = 18721 - _NEXUSOPERATIONSTARTEDEVENTATTRIBUTES._serialized_start = 18724 - _NEXUSOPERATIONSTARTEDEVENTATTRIBUTES._serialized_end = 18861 - _NEXUSOPERATIONCOMPLETEDEVENTATTRIBUTES._serialized_start = 18864 - _NEXUSOPERATIONCOMPLETEDEVENTATTRIBUTES._serialized_end = 19001 - _NEXUSOPERATIONFAILEDEVENTATTRIBUTES._serialized_start = 19004 - _NEXUSOPERATIONFAILEDEVENTATTRIBUTES._serialized_end = 19140 - _NEXUSOPERATIONTIMEDOUTEVENTATTRIBUTES._serialized_start = 19143 - _NEXUSOPERATIONTIMEDOUTEVENTATTRIBUTES._serialized_end = 19281 - _NEXUSOPERATIONCANCELEDEVENTATTRIBUTES._serialized_start = 19284 - _NEXUSOPERATIONCANCELEDEVENTATTRIBUTES._serialized_end = 19422 - _NEXUSOPERATIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 19424 - _NEXUSOPERATIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 19540 - _NEXUSOPERATIONCANCELREQUESTCOMPLETEDEVENTATTRIBUTES._serialized_start = 19543 - _NEXUSOPERATIONCANCELREQUESTCOMPLETEDEVENTATTRIBUTES._serialized_end = 19694 - _NEXUSOPERATIONCANCELREQUESTFAILEDEVENTATTRIBUTES._serialized_start = 19697 - _NEXUSOPERATIONCANCELREQUESTFAILEDEVENTATTRIBUTES._serialized_end = 19896 - _HISTORYEVENT._serialized_start = 19899 - _HISTORYEVENT._serialized_end = 28037 - _HISTORY._serialized_start = 28039 - _HISTORY._serialized_end = 28103 + _REQUESTCANCELEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 10815 + _EXTERNALWORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 10818 + _EXTERNALWORKFLOWEXECUTIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 11015 + _SIGNALEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_start = 11018 + _SIGNALEXTERNALWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_end = 11397 + _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 11400 + _SIGNALEXTERNALWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 11739 + _EXTERNALWORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_start = 11742 + _EXTERNALWORKFLOWEXECUTIONSIGNALEDEVENTATTRIBUTES._serialized_end = 11953 + _UPSERTWORKFLOWSEARCHATTRIBUTESEVENTATTRIBUTES._serialized_start = 11956 + _UPSERTWORKFLOWSEARCHATTRIBUTESEVENTATTRIBUTES._serialized_end = 12114 + _WORKFLOWPROPERTIESMODIFIEDEVENTATTRIBUTES._serialized_start = 12117 + _WORKFLOWPROPERTIESMODIFIEDEVENTATTRIBUTES._serialized_end = 12255 + _STARTCHILDWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_start = 12258 + _STARTCHILDWORKFLOWEXECUTIONINITIATEDEVENTATTRIBUTES._serialized_end = 13534 + _STARTCHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 13537 + _STARTCHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 13879 + _CHILDWORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_start = 13882 + _CHILDWORKFLOWEXECUTIONSTARTEDEVENTATTRIBUTES._serialized_end = 14177 + _CHILDWORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_start = 14180 + _CHILDWORKFLOWEXECUTIONCOMPLETEDEVENTATTRIBUTES._serialized_end = 14505 + _CHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_start = 14508 + _CHILDWORKFLOWEXECUTIONFAILEDEVENTATTRIBUTES._serialized_end = 14887 + _CHILDWORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_start = 14890 + _CHILDWORKFLOWEXECUTIONCANCELEDEVENTATTRIBUTES._serialized_end = 15215 + _CHILDWORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_start = 15218 + _CHILDWORKFLOWEXECUTIONTIMEDOUTEVENTATTRIBUTES._serialized_end = 15548 + _CHILDWORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_start = 15551 + _CHILDWORKFLOWEXECUTIONTERMINATEDEVENTATTRIBUTES._serialized_end = 15827 + _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES._serialized_start = 15830 + _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES._serialized_end = 16560 + _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES_WORKFLOWUPDATEOPTIONSUPDATE._serialized_start = 16410 + _WORKFLOWEXECUTIONOPTIONSUPDATEDEVENTATTRIBUTES_WORKFLOWUPDATEOPTIONSUPDATE._serialized_end = 16560 + _WORKFLOWPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_start = 16563 + _WORKFLOWPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_end = 16883 + _ACTIVITYPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_start = 16886 + _ACTIVITYPROPERTIESMODIFIEDEXTERNALLYEVENTATTRIBUTES._serialized_end = 17030 + _WORKFLOWSTREAMSUBSCRIBEDEVENTATTRIBUTES._serialized_start = 17032 + _WORKFLOWSTREAMSUBSCRIBEDEVENTATTRIBUTES._serialized_end = 17156 + _WORKFLOWSTREAMRECORDSAPPENDEDEVENTATTRIBUTES._serialized_start = 17159 + _WORKFLOWSTREAMRECORDSAPPENDEDEVENTATTRIBUTES._serialized_end = 17310 + _WORKFLOWEXECUTIONUPDATEACCEPTEDEVENTATTRIBUTES._serialized_start = 17313 + _WORKFLOWEXECUTIONUPDATEACCEPTEDEVENTATTRIBUTES._serialized_end = 17533 + _WORKFLOWEXECUTIONUPDATECOMPLETEDEVENTATTRIBUTES._serialized_start = 17536 + _WORKFLOWEXECUTIONUPDATECOMPLETEDEVENTATTRIBUTES._serialized_end = 17706 + _WORKFLOWEXECUTIONUPDATEREJECTEDEVENTATTRIBUTES._serialized_start = 17709 + _WORKFLOWEXECUTIONUPDATEREJECTEDEVENTATTRIBUTES._serialized_end = 17980 + _WORKFLOWEXECUTIONUPDATEADMITTEDEVENTATTRIBUTES._serialized_start = 17983 + _WORKFLOWEXECUTIONUPDATEADMITTEDEVENTATTRIBUTES._serialized_end = 18147 + _WORKFLOWEXECUTIONPAUSEDEVENTATTRIBUTES._serialized_start = 18149 + _WORKFLOWEXECUTIONPAUSEDEVENTATTRIBUTES._serialized_end = 18243 + _WORKFLOWEXECUTIONUNPAUSEDEVENTATTRIBUTES._serialized_start = 18245 + _WORKFLOWEXECUTIONUNPAUSEDEVENTATTRIBUTES._serialized_end = 18341 + _WORKFLOWEXECUTIONTIMESKIPPINGTRANSITIONEDEVENTATTRIBUTES._serialized_start = 18344 + _WORKFLOWEXECUTIONTIMESKIPPINGTRANSITIONEDEVENTATTRIBUTES._serialized_end = 18541 + _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES._serialized_start = 18544 + _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES._serialized_end = 19108 + _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES_NEXUSHEADERENTRY._serialized_start = 19058 + _NEXUSOPERATIONSCHEDULEDEVENTATTRIBUTES_NEXUSHEADERENTRY._serialized_end = 19108 + _NEXUSOPERATIONSTARTEDEVENTATTRIBUTES._serialized_start = 19111 + _NEXUSOPERATIONSTARTEDEVENTATTRIBUTES._serialized_end = 19248 + _NEXUSOPERATIONCOMPLETEDEVENTATTRIBUTES._serialized_start = 19251 + _NEXUSOPERATIONCOMPLETEDEVENTATTRIBUTES._serialized_end = 19388 + _NEXUSOPERATIONFAILEDEVENTATTRIBUTES._serialized_start = 19391 + _NEXUSOPERATIONFAILEDEVENTATTRIBUTES._serialized_end = 19527 + _NEXUSOPERATIONTIMEDOUTEVENTATTRIBUTES._serialized_start = 19530 + _NEXUSOPERATIONTIMEDOUTEVENTATTRIBUTES._serialized_end = 19668 + _NEXUSOPERATIONCANCELEDEVENTATTRIBUTES._serialized_start = 19671 + _NEXUSOPERATIONCANCELEDEVENTATTRIBUTES._serialized_end = 19809 + _NEXUSOPERATIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_start = 19811 + _NEXUSOPERATIONCANCELREQUESTEDEVENTATTRIBUTES._serialized_end = 19927 + _NEXUSOPERATIONCANCELREQUESTCOMPLETEDEVENTATTRIBUTES._serialized_start = 19930 + _NEXUSOPERATIONCANCELREQUESTCOMPLETEDEVENTATTRIBUTES._serialized_end = 20081 + _NEXUSOPERATIONCANCELREQUESTFAILEDEVENTATTRIBUTES._serialized_start = 20084 + _NEXUSOPERATIONCANCELREQUESTFAILEDEVENTATTRIBUTES._serialized_end = 20283 + _HISTORYEVENT._serialized_start = 20286 + _HISTORYEVENT._serialized_end = 28678 + _HISTORY._serialized_start = 28680 + _HISTORY._serialized_end = 28744 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/history/v1/message_pb2.pyi b/temporalio/api/history/v1/message_pb2.pyi index 783e9d3b6..bc708a6cb 100644 --- a/temporalio/api/history/v1/message_pb2.pyi +++ b/temporalio/api/history/v1/message_pb2.pyi @@ -23,6 +23,7 @@ import temporalio.api.failure.v1.message_pb2 import temporalio.api.sdk.v1.event_group_marker_pb2 import temporalio.api.sdk.v1.task_complete_metadata_pb2 import temporalio.api.sdk.v1.user_metadata_pb2 +import temporalio.api.stream.v1.message_pb2 import temporalio.api.taskqueue.v1.message_pb2 import temporalio.api.update.v1.message_pb2 import temporalio.api.workflow.v1.message_pb2 @@ -1010,6 +1011,7 @@ class WorkflowTaskCompletedEventAttributes(google.protobuf.message.Message): WORKER_DEPLOYMENT_VERSION_FIELD_NUMBER: builtins.int WORKER_DEPLOYMENT_NAME_FIELD_NUMBER: builtins.int DEPLOYMENT_VERSION_FIELD_NUMBER: builtins.int + CONSUMED_STREAM_RANGES_FIELD_NUMBER: builtins.int scheduled_event_id: builtins.int """The id of the `WORKFLOW_TASK_SCHEDULED` event this task corresponds to""" started_event_id: builtins.int @@ -1069,6 +1071,18 @@ class WorkflowTaskCompletedEventAttributes(google.protobuf.message.Message): """The Worker Deployment Version that completed this task. Must be set if `versioning_behavior` is set. This value updates workflow execution's `versioning_info.deployment_version`. """ + @property + def consumed_stream_ranges( + self, + ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[ + temporalio.api.stream.v1.message_pb2.StreamRange + ]: + """Offset ranges this Workflow Task consumed from streams it subscribes to. + Recorded on every task where a subscription is active, including when it + observed nothing: an empty range is a fact replay must reproduce, and + omitting it would let replay deliver records the Workflow did not have. + Numbered 20 to leave 14 through 19 free for fields added on the main line. + """ def __init__( self, *, @@ -1088,6 +1102,10 @@ class WorkflowTaskCompletedEventAttributes(google.protobuf.message.Message): worker_deployment_name: builtins.str = ..., deployment_version: temporalio.api.deployment.v1.message_pb2.WorkerDeploymentVersion | None = ..., + consumed_stream_ranges: collections.abc.Iterable[ + temporalio.api.stream.v1.message_pb2.StreamRange + ] + | None = ..., ) -> None: ... def HasField( self, @@ -1109,6 +1127,8 @@ class WorkflowTaskCompletedEventAttributes(google.protobuf.message.Message): field_name: typing_extensions.Literal[ "binary_checksum", b"binary_checksum", + "consumed_stream_ranges", + b"consumed_stream_ranges", "deployment", b"deployment", "deployment_version", @@ -3603,6 +3623,93 @@ global___ActivityPropertiesModifiedExternallyEventAttributes = ( ActivityPropertiesModifiedExternallyEventAttributes ) +class WorkflowStreamSubscribedEventAttributes(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + WORKFLOW_TASK_COMPLETED_EVENT_ID_FIELD_NUMBER: builtins.int + STREAM_ID_FIELD_NUMBER: builtins.int + START_OFFSET_FIELD_NUMBER: builtins.int + workflow_task_completed_event_id: builtins.int + """The WorkflowTaskCompleted event of the task whose command created this + subscription. + """ + stream_id: builtins.str + """Stream the Workflow subscribed to.""" + start_offset: builtins.int + """The offset the subscription actually starts from. Resolved by the server + when the subscription is registered and recorded here, so replay reads + the resolved value rather than resolving it again against a stream that + has since moved. + """ + def __init__( + self, + *, + workflow_task_completed_event_id: builtins.int = ..., + stream_id: builtins.str = ..., + start_offset: builtins.int = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "start_offset", + b"start_offset", + "stream_id", + b"stream_id", + "workflow_task_completed_event_id", + b"workflow_task_completed_event_id", + ], + ) -> None: ... + +global___WorkflowStreamSubscribedEventAttributes = ( + WorkflowStreamSubscribedEventAttributes +) + +class WorkflowStreamRecordsAppendedEventAttributes(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + WORKFLOW_TASK_COMPLETED_EVENT_ID_FIELD_NUMBER: builtins.int + STREAM_ID_FIELD_NUMBER: builtins.int + FIRST_OFFSET_FIELD_NUMBER: builtins.int + RECORD_COUNT_FIELD_NUMBER: builtins.int + workflow_task_completed_event_id: builtins.int + """The WorkflowTaskCompleted event of the task whose command appended this + batch. + """ + stream_id: builtins.str + """Stream the Workflow appended to.""" + first_offset: builtins.int + """Offset the first record of the batch landed at.""" + record_count: builtins.int + """How many records the batch held. With first_offset this names the range + without carrying any of it, which is what keeps this event a fixed size + no matter how large the batch or its payloads are. + """ + def __init__( + self, + *, + workflow_task_completed_event_id: builtins.int = ..., + stream_id: builtins.str = ..., + first_offset: builtins.int = ..., + record_count: builtins.int = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "first_offset", + b"first_offset", + "record_count", + b"record_count", + "stream_id", + b"stream_id", + "workflow_task_completed_event_id", + b"workflow_task_completed_event_id", + ], + ) -> None: ... + +global___WorkflowStreamRecordsAppendedEventAttributes = ( + WorkflowStreamRecordsAppendedEventAttributes +) + class WorkflowExecutionUpdateAcceptedEventAttributes(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -4460,6 +4567,8 @@ class HistoryEvent(google.protobuf.message.Message): WORKFLOW_EXECUTION_TIME_SKIPPING_TRANSITIONED_EVENT_ATTRIBUTES_FIELD_NUMBER: ( builtins.int ) + WORKFLOW_STREAM_SUBSCRIBED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int + WORKFLOW_STREAM_RECORDS_APPENDED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int event_id: builtins.int """Monotonically increasing event number, starts at 1.""" @property @@ -4745,6 +4854,14 @@ class HistoryEvent(google.protobuf.message.Message): def workflow_execution_time_skipping_transitioned_event_attributes( self, ) -> global___WorkflowExecutionTimeSkippingTransitionedEventAttributes: ... + @property + def workflow_stream_subscribed_event_attributes( + self, + ) -> global___WorkflowStreamSubscribedEventAttributes: ... + @property + def workflow_stream_records_appended_event_attributes( + self, + ) -> global___WorkflowStreamRecordsAppendedEventAttributes: ... def __init__( self, *, @@ -4882,6 +4999,10 @@ class HistoryEvent(google.protobuf.message.Message): | None = ..., workflow_execution_time_skipping_transitioned_event_attributes: global___WorkflowExecutionTimeSkippingTransitionedEventAttributes | None = ..., + workflow_stream_subscribed_event_attributes: global___WorkflowStreamSubscribedEventAttributes + | None = ..., + workflow_stream_records_appended_event_attributes: global___WorkflowStreamRecordsAppendedEventAttributes + | None = ..., ) -> None: ... def HasField( self, @@ -5004,6 +5125,10 @@ class HistoryEvent(google.protobuf.message.Message): b"workflow_properties_modified_event_attributes", "workflow_properties_modified_externally_event_attributes", b"workflow_properties_modified_externally_event_attributes", + "workflow_stream_records_appended_event_attributes", + b"workflow_stream_records_appended_event_attributes", + "workflow_stream_subscribed_event_attributes", + b"workflow_stream_subscribed_event_attributes", "workflow_task_completed_event_attributes", b"workflow_task_completed_event_attributes", "workflow_task_failed_event_attributes", @@ -5151,6 +5276,10 @@ class HistoryEvent(google.protobuf.message.Message): b"workflow_properties_modified_event_attributes", "workflow_properties_modified_externally_event_attributes", b"workflow_properties_modified_externally_event_attributes", + "workflow_stream_records_appended_event_attributes", + b"workflow_stream_records_appended_event_attributes", + "workflow_stream_subscribed_event_attributes", + b"workflow_stream_subscribed_event_attributes", "workflow_task_completed_event_attributes", b"workflow_task_completed_event_attributes", "workflow_task_failed_event_attributes", @@ -5227,6 +5356,8 @@ class HistoryEvent(google.protobuf.message.Message): "workflow_execution_paused_event_attributes", "workflow_execution_unpaused_event_attributes", "workflow_execution_time_skipping_transitioned_event_attributes", + "workflow_stream_subscribed_event_attributes", + "workflow_stream_records_appended_event_attributes", ] | None ): ... diff --git a/temporalio/api/stream/__init__.py b/temporalio/api/stream/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/temporalio/api/stream/v1/__init__.py b/temporalio/api/stream/v1/__init__.py new file mode 100644 index 000000000..9d54188ec --- /dev/null +++ b/temporalio/api/stream/v1/__init__.py @@ -0,0 +1,8 @@ +from .message_pb2 import StreamRange, StreamRecord, StreamRecordKind, StreamSlice + +__all__ = [ + "StreamRange", + "StreamRecord", + "StreamRecordKind", + "StreamSlice", +] diff --git a/temporalio/api/stream/v1/message_pb2.py b/temporalio/api/stream/v1/message_pb2.py new file mode 100644 index 000000000..c28393a50 --- /dev/null +++ b/temporalio/api/stream/v1/message_pb2.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: temporal/api/stream/v1/message.proto +"""Generated protocol buffer code.""" + +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import enum_type_wrapper + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from temporalio.api.common.v1 import ( + message_pb2 as temporal_dot_api_dot_common_dot_v1_dot_message__pb2, +) + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n$temporal/api/stream/v1/message.proto\x12\x16temporal.api.stream.v1\x1a$temporal/api/common/v1/message.proto"\xd4\x02\n\x0cStreamRecord\x12-\n\x04\x62ody\x18\x01 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x44\n\x08metadata\x18\x02 \x03(\x0b\x32\x32.temporal.api.stream.v1.StreamRecord.MetadataEntry\x12\r\n\x05topic\x18\x03 \x01(\t\x12\x36\n\x04kind\x18\x04 \x01(\x0e\x32(.temporal.api.stream.v1.StreamRecordKind\x12\x13\n\x0bproducer_id\x18\x05 \x01(\t\x12\x0f\n\x07\x61ttempt\x18\x06 \x01(\x03\x12\x10\n\x08sequence\x18\x07 \x01(\x03\x1aP\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\xb9\x01\n\x0bStreamSlice\x12\x11\n\tstream_id\x18\x01 \x01(\t\x12\x0e\n\x06run_id\x18\x02 \x01(\t\x12\x13\n\x0b\x66rom_offset\x18\x03 \x01(\x03\x12\x11\n\tto_offset\x18\x04 \x01(\x03\x12\x35\n\x07records\x18\x05 \x03(\x0b\x32$.temporal.api.stream.v1.StreamRecord\x12(\n workflow_task_completed_event_id\x18\x06 \x01(\x03"H\n\x0bStreamRange\x12\x11\n\tstream_id\x18\x01 \x01(\t\x12\x13\n\x0b\x66rom_offset\x18\x02 \x01(\x03\x12\x11\n\tto_offset\x18\x03 \x01(\x03*r\n\x10StreamRecordKind\x12"\n\x1eSTREAM_RECORD_KIND_UNSPECIFIED\x10\x00\x12\x1b\n\x17STREAM_RECORD_KIND_DATA\x10\x01\x12\x1d\n\x19STREAM_RECORD_KIND_FINISH\x10\x02\x42\x89\x01\n\x19io.temporal.api.stream.v1B\x0cMessageProtoP\x01Z#go.temporal.io/api/stream/v1;stream\xaa\x02\x18Temporalio.Api.Stream.V1\xea\x02\x1bTemporalio::Api::Stream::V1b\x06proto3' +) + +_STREAMRECORDKIND = DESCRIPTOR.enum_types_by_name["StreamRecordKind"] +StreamRecordKind = enum_type_wrapper.EnumTypeWrapper(_STREAMRECORDKIND) +STREAM_RECORD_KIND_UNSPECIFIED = 0 +STREAM_RECORD_KIND_DATA = 1 +STREAM_RECORD_KIND_FINISH = 2 + + +_STREAMRECORD = DESCRIPTOR.message_types_by_name["StreamRecord"] +_STREAMRECORD_METADATAENTRY = _STREAMRECORD.nested_types_by_name["MetadataEntry"] +_STREAMSLICE = DESCRIPTOR.message_types_by_name["StreamSlice"] +_STREAMRANGE = DESCRIPTOR.message_types_by_name["StreamRange"] +StreamRecord = _reflection.GeneratedProtocolMessageType( + "StreamRecord", + (_message.Message,), + { + "MetadataEntry": _reflection.GeneratedProtocolMessageType( + "MetadataEntry", + (_message.Message,), + { + "DESCRIPTOR": _STREAMRECORD_METADATAENTRY, + "__module__": "temporalio.api.stream.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.stream.v1.StreamRecord.MetadataEntry) + }, + ), + "DESCRIPTOR": _STREAMRECORD, + "__module__": "temporalio.api.stream.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.stream.v1.StreamRecord) + }, +) +_sym_db.RegisterMessage(StreamRecord) +_sym_db.RegisterMessage(StreamRecord.MetadataEntry) + +StreamSlice = _reflection.GeneratedProtocolMessageType( + "StreamSlice", + (_message.Message,), + { + "DESCRIPTOR": _STREAMSLICE, + "__module__": "temporalio.api.stream.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.stream.v1.StreamSlice) + }, +) +_sym_db.RegisterMessage(StreamSlice) + +StreamRange = _reflection.GeneratedProtocolMessageType( + "StreamRange", + (_message.Message,), + { + "DESCRIPTOR": _STREAMRANGE, + "__module__": "temporalio.api.stream.v1.message_pb2", + # @@protoc_insertion_point(class_scope:temporal.api.stream.v1.StreamRange) + }, +) +_sym_db.RegisterMessage(StreamRange) + +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b"\n\031io.temporal.api.stream.v1B\014MessageProtoP\001Z#go.temporal.io/api/stream/v1;stream\252\002\030Temporalio.Api.Stream.V1\352\002\033Temporalio::Api::Stream::V1" + _STREAMRECORD_METADATAENTRY._options = None + _STREAMRECORD_METADATAENTRY._serialized_options = b"8\001" + _STREAMRECORDKIND._serialized_start = 707 + _STREAMRECORDKIND._serialized_end = 821 + _STREAMRECORD._serialized_start = 103 + _STREAMRECORD._serialized_end = 443 + _STREAMRECORD_METADATAENTRY._serialized_start = 363 + _STREAMRECORD_METADATAENTRY._serialized_end = 443 + _STREAMSLICE._serialized_start = 446 + _STREAMSLICE._serialized_end = 631 + _STREAMRANGE._serialized_start = 633 + _STREAMRANGE._serialized_end = 705 +# @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/stream/v1/message_pb2.pyi b/temporalio/api/stream/v1/message_pb2.pyi new file mode 100644 index 000000000..74a6d4a75 --- /dev/null +++ b/temporalio/api/stream/v1/message_pb2.pyi @@ -0,0 +1,267 @@ +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import builtins +import collections.abc +import sys +import typing + +import google.protobuf.descriptor +import google.protobuf.internal.containers +import google.protobuf.internal.enum_type_wrapper +import google.protobuf.message + +import temporalio.api.common.v1.message_pb2 + +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +class _StreamRecordKind: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + +class _StreamRecordKindEnumTypeWrapper( + google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[ + _StreamRecordKind.ValueType + ], + builtins.type, +): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + STREAM_RECORD_KIND_UNSPECIFIED: _StreamRecordKind.ValueType # 0 + """Read as DATA.""" + STREAM_RECORD_KIND_DATA: _StreamRecordKind.ValueType # 1 + """A value the producer published; `body` carries it.""" + STREAM_RECORD_KIND_FINISH: _StreamRecordKind.ValueType # 2 + """The producer named by `producer_id` writes nothing more on `topic`. + Says nothing about that producer's outcome and does not end the stream. + """ + +class StreamRecordKind(_StreamRecordKind, metaclass=_StreamRecordKindEnumTypeWrapper): + """What a record means to a reader. Kept on the record itself so every store + and every language reads it the same way without a private envelope. + """ + +STREAM_RECORD_KIND_UNSPECIFIED: StreamRecordKind.ValueType # 0 +"""Read as DATA.""" +STREAM_RECORD_KIND_DATA: StreamRecordKind.ValueType # 1 +"""A value the producer published; `body` carries it.""" +STREAM_RECORD_KIND_FINISH: StreamRecordKind.ValueType # 2 +"""The producer named by `producer_id` writes nothing more on `topic`. +Says nothing about that producer's outcome and does not end the stream. +""" +global___StreamRecordKind = StreamRecordKind + +class StreamRecord(google.protobuf.message.Message): + """One entry in a stream. The record is the wire format: stores keep it + serialized as is and readers in every language decode the same bytes. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + class MetadataEntry(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + KEY_FIELD_NUMBER: builtins.int + VALUE_FIELD_NUMBER: builtins.int + key: builtins.str + @property + def value(self) -> temporalio.api.common.v1.message_pb2.Payload: ... + def __init__( + self, + *, + key: builtins.str = ..., + value: temporalio.api.common.v1.message_pb2.Payload | None = ..., + ) -> None: ... + def HasField( + self, field_name: typing_extensions.Literal["value", b"value"] + ) -> builtins.bool: ... + def ClearField( + self, + field_name: typing_extensions.Literal["key", b"key", "value", b"value"], + ) -> None: ... + + BODY_FIELD_NUMBER: builtins.int + METADATA_FIELD_NUMBER: builtins.int + TOPIC_FIELD_NUMBER: builtins.int + KIND_FIELD_NUMBER: builtins.int + PRODUCER_ID_FIELD_NUMBER: builtins.int + ATTEMPT_FIELD_NUMBER: builtins.int + SEQUENCE_FIELD_NUMBER: builtins.int + @property + def body(self) -> temporalio.api.common.v1.message_pb2.Payload: + """The value the producer published, stored as sent. A payload codec + applies here as it does to any other payload. + """ + @property + def metadata( + self, + ) -> google.protobuf.internal.containers.MessageMap[ + builtins.str, temporalio.api.common.v1.message_pb2.Payload + ]: + """Producer-supplied provenance, stored as sent.""" + topic: builtins.str + """Producer-supplied grouping label, stored as sent.""" + kind: global___StreamRecordKind.ValueType + """How to read this record. Unspecified is read as DATA.""" + producer_id: builtins.str + """Who wrote the record. Empty when the owning Workflow did.""" + attempt: builtins.int + """The producer's attempt. Readers treat a later attempt by the same + producer as superseding what the earlier one wrote. + """ + sequence: builtins.int + """The producer's position within its attempt, or -1 when unnumbered. + Stored as sent; the server does not assign, validate or order by it. + """ + def __init__( + self, + *, + body: temporalio.api.common.v1.message_pb2.Payload | None = ..., + metadata: collections.abc.Mapping[ + builtins.str, temporalio.api.common.v1.message_pb2.Payload + ] + | None = ..., + topic: builtins.str = ..., + kind: global___StreamRecordKind.ValueType = ..., + producer_id: builtins.str = ..., + attempt: builtins.int = ..., + sequence: builtins.int = ..., + ) -> None: ... + def HasField( + self, field_name: typing_extensions.Literal["body", b"body"] + ) -> builtins.bool: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "attempt", + b"attempt", + "body", + b"body", + "kind", + b"kind", + "metadata", + b"metadata", + "producer_id", + b"producer_id", + "sequence", + b"sequence", + "topic", + b"topic", + ], + ) -> None: ... + +global___StreamRecord = StreamRecord + +class StreamSlice(google.protobuf.message.Message): + """A contiguous range of a stream delivered to a Workflow Task, along with the + offsets it covers. The offsets are what History records; the records + themselves are never written to History. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + STREAM_ID_FIELD_NUMBER: builtins.int + RUN_ID_FIELD_NUMBER: builtins.int + FROM_OFFSET_FIELD_NUMBER: builtins.int + TO_OFFSET_FIELD_NUMBER: builtins.int + RECORDS_FIELD_NUMBER: builtins.int + WORKFLOW_TASK_COMPLETED_EVENT_ID_FIELD_NUMBER: builtins.int + stream_id: builtins.str + run_id: builtins.str + """Run id of the execution that owns the stream. Set on both a slice for the + task being started and a re-supplied one. + """ + from_offset: builtins.int + """Inclusive.""" + to_offset: builtins.int + """Exclusive. Equal to from_offset when the subscription observed nothing, + which is a fact replay has to reproduce rather than an absence of one. + """ + @property + def records( + self, + ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[ + global___StreamRecord + ]: ... + workflow_task_completed_event_id: builtins.int + """The WorkflowTaskCompleted event whose consumed_stream_ranges recorded + this range. Set only when the server is re-supplying a range for a task + being replayed; a slice for the task now being started leaves it unset, + because the event closing that task does not exist yet. + + Replay needs this because a Workflow Task response carries one slice set + while a cache miss replays every prior task, so the ranges have to be + matched to the events that recorded them rather than to the response. + """ + def __init__( + self, + *, + stream_id: builtins.str = ..., + run_id: builtins.str = ..., + from_offset: builtins.int = ..., + to_offset: builtins.int = ..., + records: collections.abc.Iterable[global___StreamRecord] | None = ..., + workflow_task_completed_event_id: builtins.int = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "from_offset", + b"from_offset", + "records", + b"records", + "run_id", + b"run_id", + "stream_id", + b"stream_id", + "to_offset", + b"to_offset", + "workflow_task_completed_event_id", + b"workflow_task_completed_event_id", + ], + ) -> None: ... + +global___StreamSlice = StreamSlice + +class StreamRange(google.protobuf.message.Message): + """The offsets a Workflow Task consumed, without the payloads. Recorded on + WorkflowTaskCompleted so History grows with Workflow Tasks rather than with + records. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + STREAM_ID_FIELD_NUMBER: builtins.int + FROM_OFFSET_FIELD_NUMBER: builtins.int + TO_OFFSET_FIELD_NUMBER: builtins.int + stream_id: builtins.str + from_offset: builtins.int + """Inclusive.""" + to_offset: builtins.int + """Exclusive.""" + def __init__( + self, + *, + stream_id: builtins.str = ..., + from_offset: builtins.int = ..., + to_offset: builtins.int = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "from_offset", + b"from_offset", + "stream_id", + b"stream_id", + "to_offset", + b"to_offset", + ], + ) -> None: ... + +global___StreamRange = StreamRange diff --git a/temporalio/api/workflowservice/v1/request_response_pb2.py b/temporalio/api/workflowservice/v1/request_response_pb2.py index e1b2e01c4..cdf2becc2 100644 --- a/temporalio/api/workflowservice/v1/request_response_pb2.py +++ b/temporalio/api/workflowservice/v1/request_response_pb2.py @@ -114,6 +114,9 @@ from temporalio.api.sdk.v1 import ( worker_config_pb2 as temporal_dot_api_dot_sdk_dot_v1_dot_worker__config__pb2, ) +from temporalio.api.stream.v1 import ( + message_pb2 as temporal_dot_api_dot_stream_dot_v1_dot_message__pb2, +) from temporalio.api.taskqueue.v1 import ( message_pb2 as temporal_dot_api_dot_taskqueue_dot_v1_dot_message__pb2, ) @@ -131,7 +134,7 @@ ) DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n6temporal/api/workflowservice/v1/request_response.proto\x12\x1ftemporal.api.workflowservice.v1\x1a+temporal/api/enums/v1/batch_operation.proto\x1a"temporal/api/enums/v1/common.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a%temporal/api/enums/v1/namespace.proto\x1a(temporal/api/enums/v1/failed_cause.proto\x1a!temporal/api/enums/v1/query.proto\x1a!temporal/api/enums/v1/reset.proto\x1a&temporal/api/enums/v1/task_queue.proto\x1a&temporal/api/enums/v1/deployment.proto\x1a"temporal/api/enums/v1/update.proto\x1a)temporal/api/enums/v1/time_skipping.proto\x1a$temporal/api/enums/v1/activity.proto\x1a!temporal/api/enums/v1/nexus.proto\x1a&temporal/api/activity/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a%temporal/api/history/v1/message.proto\x1a&temporal/api/workflow/v1/message.proto\x1a%temporal/api/command/v1/message.proto\x1a$temporal/api/compute/v1/config.proto\x1a(temporal/api/deployment/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/filter/v1/message.proto\x1a&temporal/api/protocol/v1/message.proto\x1a\'temporal/api/namespace/v1/message.proto\x1a#temporal/api/query/v1/message.proto\x1a)temporal/api/replication/v1/message.proto\x1a#temporal/api/rules/v1/message.proto\x1a\'temporal/api/sdk/v1/worker_config.proto\x1a&temporal/api/schedule/v1/message.proto\x1a\'temporal/api/taskqueue/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a%temporal/api/version/v1/message.proto\x1a#temporal/api/batch/v1/message.proto\x1a\x30temporal/api/sdk/v1/task_complete_metadata.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a#temporal/api/nexus/v1/message.proto\x1a$temporal/api/worker/v1/message.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x88\x05\n\x18RegisterNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x13\n\x0bowner_email\x18\x03 \x01(\t\x12\x46\n#workflow_execution_retention_period\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12G\n\x08\x63lusters\x18\x05 \x03(\x0b\x32\x35.temporal.api.replication.v1.ClusterReplicationConfig\x12\x1b\n\x13\x61\x63tive_cluster_name\x18\x06 \x01(\t\x12Q\n\x04\x64\x61ta\x18\x07 \x03(\x0b\x32\x43.temporal.api.workflowservice.v1.RegisterNamespaceRequest.DataEntry\x12\x16\n\x0esecurity_token\x18\x08 \x01(\t\x12\x1b\n\x13is_global_namespace\x18\t \x01(\x08\x12\x44\n\x16history_archival_state\x18\n \x01(\x0e\x32$.temporal.api.enums.v1.ArchivalState\x12\x1c\n\x14history_archival_uri\x18\x0b \x01(\t\x12G\n\x19visibility_archival_state\x18\x0c \x01(\x0e\x32$.temporal.api.enums.v1.ArchivalState\x12\x1f\n\x17visibility_archival_uri\x18\r \x01(\t\x1a+\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x1b\n\x19RegisterNamespaceResponse"\x89\x01\n\x15ListNamespacesRequest\x12\x11\n\tpage_size\x18\x01 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c\x12\x44\n\x10namespace_filter\x18\x03 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceFilter"\x81\x01\n\x16ListNamespacesResponse\x12N\n\nnamespaces\x18\x01 \x03(\x0b\x32:.temporal.api.workflowservice.v1.DescribeNamespaceResponse\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"S\n\x18\x44\x65scribeNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\x18\n\x10weak_consistency\x18\x03 \x01(\x08"\x81\x04\n\x19\x44\x65scribeNamespaceResponse\x12@\n\x0enamespace_info\x18\x01 \x01(\x0b\x32(.temporal.api.namespace.v1.NamespaceInfo\x12:\n\x06\x63onfig\x18\x02 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceConfig\x12S\n\x12replication_config\x18\x03 \x01(\x0b\x32\x37.temporal.api.replication.v1.NamespaceReplicationConfig\x12\x18\n\x10\x66\x61ilover_version\x18\x04 \x01(\x03\x12\x1b\n\x13is_global_namespace\x18\x05 \x01(\x08\x12\x45\n\x10\x66\x61ilover_history\x18\x06 \x03(\x0b\x32+.temporal.api.replication.v1.FailoverStatus\x12J\n\x12poller_group_infos\x18\x07 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x08 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo"\xcf\x02\n\x16UpdateNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x43\n\x0bupdate_info\x18\x02 \x01(\x0b\x32..temporal.api.namespace.v1.UpdateNamespaceInfo\x12:\n\x06\x63onfig\x18\x03 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceConfig\x12S\n\x12replication_config\x18\x04 \x01(\x0b\x32\x37.temporal.api.replication.v1.NamespaceReplicationConfig\x12\x16\n\x0esecurity_token\x18\x05 \x01(\t\x12\x19\n\x11\x64\x65lete_bad_binary\x18\x06 \x01(\t\x12\x19\n\x11promote_namespace\x18\x07 \x01(\x08"\xa3\x02\n\x17UpdateNamespaceResponse\x12@\n\x0enamespace_info\x18\x01 \x01(\x0b\x32(.temporal.api.namespace.v1.NamespaceInfo\x12:\n\x06\x63onfig\x18\x02 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceConfig\x12S\n\x12replication_config\x18\x03 \x01(\x0b\x32\x37.temporal.api.replication.v1.NamespaceReplicationConfig\x12\x18\n\x10\x66\x61ilover_version\x18\x04 \x01(\x03\x12\x1b\n\x13is_global_namespace\x18\x05 \x01(\x08"F\n\x19\x44\x65precateNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x16\n\x0esecurity_token\x18\x02 \x01(\t"\x1c\n\x1a\x44\x65precateNamespaceResponse"\xd1\x0c\n\x1dStartWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x10\n\x08identity\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t\x12N\n\x18workflow_id_reuse_policy\x18\x0b \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12T\n\x1bworkflow_id_conflict_policy\x18\x16 \x01(\x0e\x32/.temporal.api.enums.v1.WorkflowIdConflictPolicy\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\r \x01(\t\x12*\n\x04memo\x18\x0e \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x0f \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\x06header\x18\x10 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x1f\n\x17request_eager_execution\x18\x11 \x01(\x08\x12;\n\x11\x63ontinued_failure\x18\x12 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x13 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x37\n\x14workflow_start_delay\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12>\n\x14\x63ompletion_callbacks\x18\x15 \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12\x38\n\ruser_metadata\x18\x17 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12+\n\x05links\x18\x18 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12I\n\x13versioning_override\x18\x19 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12H\n\x13on_conflict_options\x18\x1a \x01(\x0b\x32+.temporal.api.workflow.v1.OnConflictOptions\x12\x32\n\x08priority\x18\x1b \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12\\\n\x1f\x65\x61ger_worker_deployment_options\x18\x1c \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12H\n\x14time_skipping_config\x18\x1d \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig"\xaa\x02\n\x1eStartWorkflowExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x06 \x01(\t\x12\x0f\n\x07started\x18\x03 \x01(\x08\x12>\n\x06status\x18\x05 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowExecutionStatus\x12[\n\x13\x65\x61ger_workflow_task\x18\x02 \x01(\x0b\x32>.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse\x12*\n\x04link\x18\x04 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xaa\x02\n"GetWorkflowExecutionHistoryRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x19\n\x11maximum_page_size\x18\x03 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x04 \x01(\x0c\x12\x16\n\x0ewait_new_event\x18\x05 \x01(\x08\x12P\n\x19history_event_filter_type\x18\x06 \x01(\x0e\x32-.temporal.api.enums.v1.HistoryEventFilterType\x12\x15\n\rskip_archival\x18\x07 \x01(\x08"\xba\x01\n#GetWorkflowExecutionHistoryResponse\x12\x31\n\x07history\x18\x01 \x01(\x0b\x32 .temporal.api.history.v1.History\x12\x35\n\x0braw_history\x18\x02 \x03(\x0b\x32 .temporal.api.common.v1.DataBlob\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x10\n\x08\x61rchived\x18\x04 \x01(\x08"\xb0\x01\n)GetWorkflowExecutionHistoryReverseRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x19\n\x11maximum_page_size\x18\x03 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x04 \x01(\x0c"x\n*GetWorkflowExecutionHistoryReverseResponse\x12\x31\n\x07history\x18\x01 \x01(\x0b\x32 .temporal.api.history.v1.History\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c"\xb8\x03\n\x1cPollWorkflowTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x17\n\x0fpoller_group_id\x18\n \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x08 \x01(\t\x12!\n\x19worker_control_task_queue\x18\t \x01(\t\x12\x1b\n\x0f\x62inary_checksum\x18\x04 \x01(\tB\x02\x18\x01\x12Z\n\x1bworker_version_capabilities\x18\x05 \x01(\x0b\x32\x31.temporal.api.common.v1.WorkerVersionCapabilitiesB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x06 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptionsJ\x04\x08\x07\x10\x08R\x10worker_heartbeat"\xbf\x08\n\x1dPollWorkflowTaskQueueResponse\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12!\n\x19previous_started_event_id\x18\x04 \x01(\x03\x12\x18\n\x10started_event_id\x18\x05 \x01(\x03\x12\x0f\n\x07\x61ttempt\x18\x06 \x01(\x05\x12\x1a\n\x12\x62\x61\x63klog_count_hint\x18\x07 \x01(\x03\x12\x31\n\x07history\x18\x08 \x01(\x0b\x32 .temporal.api.history.v1.History\x12\x17\n\x0fnext_page_token\x18\t \x01(\x0c\x12\x33\n\x05query\x18\n \x01(\x0b\x32$.temporal.api.query.v1.WorkflowQuery\x12K\n\x1dworkflow_execution_task_queue\x18\x0b \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x32\n\x0escheduled_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x0cstarted_time\x18\r \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\\\n\x07queries\x18\x0e \x03(\x0b\x32K.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse.QueriesEntry\x12\x33\n\x08messages\x18\x0f \x03(\x0b\x32!.temporal.api.protocol.v1.Message\x12Q\n\x17poller_scaling_decision\x18\x10 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.PollerScalingDecision\x12\x17\n\x0fpoller_group_id\x18\x11 \x01(\t\x12J\n\x12poller_group_infos\x18\x12 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x13 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo\x1aT\n\x0cQueriesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.temporal.api.query.v1.WorkflowQuery:\x02\x38\x01"\xba\n\n#RespondWorkflowTaskCompletedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x32\n\x08\x63ommands\x18\x02 \x03(\x0b\x32 .temporal.api.command.v1.Command\x12\x10\n\x08identity\x18\x03 \x01(\t\x12O\n\x11sticky_attributes\x18\x04 \x01(\x0b\x32\x34.temporal.api.taskqueue.v1.StickyExecutionAttributes\x12 \n\x18return_new_workflow_task\x18\x05 \x01(\x08\x12&\n\x1e\x66orce_create_new_workflow_task\x18\x06 \x01(\x08\x12\x1b\n\x0f\x62inary_checksum\x18\x07 \x01(\tB\x02\x18\x01\x12m\n\rquery_results\x18\x08 \x03(\x0b\x32V.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest.QueryResultsEntry\x12\x11\n\tnamespace\x18\t \x01(\t\x12\x13\n\x0bresource_id\x18\x12 \x01(\t\x12L\n\x14worker_version_stamp\x18\n \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12\x33\n\x08messages\x18\x0b \x03(\x0b\x32!.temporal.api.protocol.v1.Message\x12H\n\x0csdk_metadata\x18\x0c \x01(\x0b\x32\x32.temporal.api.sdk.v1.WorkflowTaskCompletedMetadata\x12\x43\n\x11metering_metadata\x18\r \x01(\x0b\x32(.temporal.api.common.v1.MeteringMetadata\x12g\n\x0c\x63\x61pabilities\x18\x0e \x01(\x0b\x32Q.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest.Capabilities\x12>\n\ndeployment\x18\x0f \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12\x46\n\x13versioning_behavior\x18\x10 \x01(\x0e\x32).temporal.api.enums.v1.VersioningBehavior\x12O\n\x12\x64\x65ployment_options\x18\x11 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12\x1b\n\x13worker_instance_key\x18\x13 \x01(\t\x12!\n\x19worker_control_task_queue\x18\x14 \x01(\t\x12\x13\n\x0bpage_number\x18\x15 \x01(\x05\x12\x19\n\x11intermediate_page\x18\x16 \x01(\x08\x1a_\n\x11QueryResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x39\n\x05value\x18\x02 \x01(\x0b\x32*.temporal.api.query.v1.WorkflowQueryResult:\x02\x38\x01\x1a\x45\n\x0c\x43\x61pabilities\x12\x35\n-discard_speculative_workflow_task_with_events\x18\x01 \x01(\x08"\xf5\x01\n$RespondWorkflowTaskCompletedResponse\x12U\n\rworkflow_task\x18\x01 \x01(\x0b\x32>.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse\x12V\n\x0e\x61\x63tivity_tasks\x18\x02 \x03(\x0b\x32>.temporal.api.workflowservice.v1.PollActivityTaskQueueResponse\x12\x1e\n\x16reset_history_event_id\x18\x03 \x01(\x03"\x8d\x04\n RespondWorkflowTaskFailedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12=\n\x05\x63\x61use\x18\x02 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowTaskFailedCause\x12\x31\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x1b\n\x0f\x62inary_checksum\x18\x05 \x01(\tB\x02\x18\x01\x12\x11\n\tnamespace\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x0b \x01(\t\x12\x33\n\x08messages\x18\x07 \x03(\x0b\x32!.temporal.api.protocol.v1.Message\x12\x46\n\x0eworker_version\x18\x08 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\t \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\n \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"#\n!RespondWorkflowTaskFailedResponse"\xe6\x03\n\x1cPollActivityTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x17\n\x0fpoller_group_id\x18\n \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x08 \x01(\t\x12!\n\x19worker_control_task_queue\x18\t \x01(\t\x12I\n\x13task_queue_metadata\x18\x04 \x01(\x0b\x32,.temporal.api.taskqueue.v1.TaskQueueMetadata\x12Z\n\x1bworker_version_capabilities\x18\x05 \x01(\x0b\x32\x31.temporal.api.common.v1.WorkerVersionCapabilitiesB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x06 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptionsJ\x04\x08\x07\x10\x08R\x10worker_heartbeat"\x9d\t\n\x1dPollActivityTaskQueueResponse\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x1a\n\x12workflow_namespace\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x45\n\x12workflow_execution\x18\x04 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\ractivity_type\x18\x05 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x13\n\x0b\x61\x63tivity_id\x18\x06 \x01(\t\x12.\n\x06header\x18\x07 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12/\n\x05input\x18\x08 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12;\n\x11heartbeat_details\x18\t \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x32\n\x0escheduled_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x42\n\x1e\x63urrent_attempt_scheduled_time\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x0cstarted_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07\x61ttempt\x18\r \x01(\x05\x12<\n\x19schedule_to_close_timeout\x18\x0e \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\x0f \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\x10 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x11 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12Q\n\x17poller_scaling_decision\x18\x12 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.PollerScalingDecision\x12\x32\n\x08priority\x18\x13 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12\x17\n\x0f\x61\x63tivity_run_id\x18\x14 \x01(\t\x12J\n\x12poller_group_infos\x18\x15 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x16 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo"\xa5\x01\n"RecordActivityTaskHeartbeatRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\x05 \x01(\t"p\n#RecordActivityTaskHeartbeatResponse\x12\x18\n\x10\x63\x61ncel_requested\x18\x01 \x01(\x08\x12\x17\n\x0f\x61\x63tivity_paused\x18\x02 \x01(\x08\x12\x16\n\x0e\x61\x63tivity_reset\x18\x03 \x01(\x08"\xcf\x01\n&RecordActivityTaskHeartbeatByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"t\n\'RecordActivityTaskHeartbeatByIdResponse\x12\x18\n\x10\x63\x61ncel_requested\x18\x01 \x01(\x08\x12\x17\n\x0f\x61\x63tivity_paused\x18\x02 \x01(\x08\x12\x16\n\x0e\x61\x63tivity_reset\x18\x03 \x01(\x08"\xfe\x02\n#RespondActivityTaskCompletedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x30\n\x06result\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\x08 \x01(\t\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\x06 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x07 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"&\n$RespondActivityTaskCompletedResponse"\xcf\x01\n\'RespondActivityTaskCompletedByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x30\n\x06result\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"*\n(RespondActivityTaskCompletedByIdResponse"\xbe\x03\n RespondActivityTaskFailedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\t \x01(\t\x12@\n\x16last_heartbeat_details\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\x07 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x08 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"W\n!RespondActivityTaskFailedResponse\x12\x32\n\x08\x66\x61ilures\x18\x01 \x03(\x0b\x32 .temporal.api.failure.v1.Failure"\x8f\x02\n$RespondActivityTaskFailedByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x06 \x01(\t\x12@\n\x16last_heartbeat_details\x18\x07 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x0bresource_id\x18\x08 \x01(\t"[\n%RespondActivityTaskFailedByIdResponse\x12\x32\n\x08\x66\x61ilures\x18\x01 \x03(\x0b\x32 .temporal.api.failure.v1.Failure"\xfe\x02\n"RespondActivityTaskCanceledRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\x08 \x01(\t\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\x06 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x07 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"%\n#RespondActivityTaskCanceledResponse"\xa0\x02\n&RespondActivityTaskCanceledByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x06 \x01(\t\x12O\n\x12\x64\x65ployment_options\x18\x07 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12\x13\n\x0bresource_id\x18\x08 \x01(\t")\n\'RespondActivityTaskCanceledByIdResponse"\x84\x02\n%RequestCancelWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t\x12+\n\x05links\x18\x07 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link"(\n&RequestCancelWorkflowExecutionResponse"\xde\x02\n\x1eSignalWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x0bsignal_name\x18\x03 \x01(\t\x12/\n\x05input\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t\x12\x13\n\x07\x63ontrol\x18\x07 \x01(\tB\x02\x18\x01\x12.\n\x06header\x18\x08 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12+\n\x05links\x18\n \x03(\x0b\x32\x1c.temporal.api.common.v1.LinkJ\x04\x08\t\x10\n"M\n\x1fSignalWorkflowExecutionResponse\x12*\n\x04link\x18\x01 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xbb\n\n\'SignalWithStartWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x10\n\x08identity\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t\x12N\n\x18workflow_id_reuse_policy\x18\x0b \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12T\n\x1bworkflow_id_conflict_policy\x18\x16 \x01(\x0e\x32/.temporal.api.enums.v1.WorkflowIdConflictPolicy\x12\x13\n\x0bsignal_name\x18\x0c \x01(\t\x12\x36\n\x0csignal_input\x18\r \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x07\x63ontrol\x18\x0e \x01(\tB\x02\x18\x01\x12\x39\n\x0cretry_policy\x18\x0f \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\x10 \x01(\t\x12*\n\x04memo\x18\x11 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x12 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\x06header\x18\x13 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x37\n\x14workflow_start_delay\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\ruser_metadata\x18\x17 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12+\n\x05links\x18\x18 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12I\n\x13versioning_override\x18\x19 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12\x32\n\x08priority\x18\x1a \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12H\n\x14time_skipping_config\x18\x1b \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfigJ\x04\x08\x15\x10\x16"\x9e\x01\n(SignalWithStartWorkflowExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x04 \x01(\t\x12\x0f\n\x07started\x18\x02 \x01(\x08\x12\x31\n\x0bsignal_link\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xc1\x03\n\x1dResetWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12%\n\x1dworkflow_task_finish_event_id\x18\x04 \x01(\x03\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12G\n\x12reset_reapply_type\x18\x06 \x01(\x0e\x32\'.temporal.api.enums.v1.ResetReapplyTypeB\x02\x18\x01\x12S\n\x1breset_reapply_exclude_types\x18\x07 \x03(\x0e\x32..temporal.api.enums.v1.ResetReapplyExcludeType\x12K\n\x15post_reset_operations\x18\x08 \x03(\x0b\x32,.temporal.api.workflow.v1.PostResetOperation\x12\x10\n\x08identity\x18\t \x01(\t"0\n\x1eResetWorkflowExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t"\x9f\x02\n!TerminateWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x06 \x01(\t\x12+\n\x05links\x18\x07 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link"$\n"TerminateWorkflowExecutionResponse"z\n\x1e\x44\x65leteWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"!\n\x1f\x44\x65leteWorkflowExecutionResponse"\xc9\x02\n!ListOpenWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11maximum_page_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x42\n\x11start_time_filter\x18\x04 \x01(\x0b\x32\'.temporal.api.filter.v1.StartTimeFilter\x12K\n\x10\x65xecution_filter\x18\x05 \x01(\x0b\x32/.temporal.api.filter.v1.WorkflowExecutionFilterH\x00\x12\x41\n\x0btype_filter\x18\x06 \x01(\x0b\x32*.temporal.api.filter.v1.WorkflowTypeFilterH\x00\x42\t\n\x07\x66ilters"\x82\x01\n"ListOpenWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\x8a\x03\n#ListClosedWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11maximum_page_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x42\n\x11start_time_filter\x18\x04 \x01(\x0b\x32\'.temporal.api.filter.v1.StartTimeFilter\x12K\n\x10\x65xecution_filter\x18\x05 \x01(\x0b\x32/.temporal.api.filter.v1.WorkflowExecutionFilterH\x00\x12\x41\n\x0btype_filter\x18\x06 \x01(\x0b\x32*.temporal.api.filter.v1.WorkflowTypeFilterH\x00\x12=\n\rstatus_filter\x18\x07 \x01(\x0b\x32$.temporal.api.filter.v1.StatusFilterH\x00\x42\t\n\x07\x66ilters"\x84\x01\n$ListClosedWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"m\n\x1dListWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"~\n\x1eListWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"u\n%ListArchivedWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"\x86\x01\n&ListArchivedWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"m\n\x1dScanWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"~\n\x1eScanWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"B\n\x1e\x43ountWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xed\x01\n\x1f\x43ountWorkflowExecutionsResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x61\n\x06groups\x18\x02 \x03(\x0b\x32Q.temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"\x1c\n\x1aGetSearchAttributesRequest"\xc9\x01\n\x1bGetSearchAttributesResponse\x12T\n\x04keys\x18\x01 \x03(\x0b\x32\x46.temporal.api.workflowservice.v1.GetSearchAttributesResponse.KeysEntry\x1aT\n\tKeysEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0e\x32\'.temporal.api.enums.v1.IndexedValueType:\x02\x38\x01"\xe9\x02\n RespondQueryTaskCompletedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12>\n\x0e\x63ompleted_type\x18\x02 \x01(\x0e\x32&.temporal.api.enums.v1.QueryResultType\x12\x36\n\x0cquery_result\x18\x03 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x15\n\rerror_message\x18\x04 \x01(\t\x12\x11\n\tnamespace\x18\x06 \x01(\t\x12\x31\n\x07\x66\x61ilure\x18\x07 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12=\n\x05\x63\x61use\x18\x08 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowTaskFailedCause\x12\x17\n\x0fpoller_group_id\x18\t \x01(\tJ\x04\x08\x05\x10\x06"#\n!RespondQueryTaskCompletedResponse"n\n\x1bResetStickyTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"\x1e\n\x1cResetStickyTaskQueueResponse"\x9b\x02\n\x15ShutdownWorkerRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11sticky_task_queue\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x41\n\x10worker_heartbeat\x18\x05 \x01(\x0b\x32\'.temporal.api.worker.v1.WorkerHeartbeat\x12\x1b\n\x13worker_instance_key\x18\x06 \x01(\t\x12\x12\n\ntask_queue\x18\x07 \x01(\t\x12>\n\x10task_queue_types\x18\x08 \x03(\x0e\x32$.temporal.api.enums.v1.TaskQueueType"\x18\n\x16ShutdownWorkerResponse"\xe9\x01\n\x14QueryWorkflowRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x33\n\x05query\x18\x03 \x01(\x0b\x32$.temporal.api.query.v1.WorkflowQuery\x12K\n\x16query_reject_condition\x18\x04 \x01(\x0e\x32+.temporal.api.enums.v1.QueryRejectCondition"\xb9\x01\n\x15QueryWorkflowResponse\x12\x36\n\x0cquery_result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12<\n\x0equery_rejected\x18\x02 \x01(\x0b\x32$.temporal.api.query.v1.QueryRejected\x12*\n\x04link\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"s\n DescribeWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"\x99\x05\n!DescribeWorkflowExecutionResponse\x12K\n\x10\x65xecution_config\x18\x01 \x01(\x0b\x32\x31.temporal.api.workflow.v1.WorkflowExecutionConfig\x12P\n\x17workflow_execution_info\x18\x02 \x01(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12I\n\x12pending_activities\x18\x03 \x03(\x0b\x32-.temporal.api.workflow.v1.PendingActivityInfo\x12M\n\x10pending_children\x18\x04 \x03(\x0b\x32\x33.temporal.api.workflow.v1.PendingChildExecutionInfo\x12P\n\x15pending_workflow_task\x18\x05 \x01(\x0b\x32\x31.temporal.api.workflow.v1.PendingWorkflowTaskInfo\x12\x39\n\tcallbacks\x18\x06 \x03(\x0b\x32&.temporal.api.workflow.v1.CallbackInfo\x12U\n\x18pending_nexus_operations\x18\x07 \x03(\x0b\x32\x33.temporal.api.workflow.v1.PendingNexusOperationInfo\x12W\n\x16workflow_extended_info\x18\x08 \x01(\x0b\x32\x37.temporal.api.workflow.v1.WorkflowExecutionExtendedInfo"\x90\x04\n\x18\x44\x65scribeTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12=\n\x0ftask_queue_type\x18\x03 \x01(\x0e\x32$.temporal.api.enums.v1.TaskQueueType\x12\x14\n\x0creport_stats\x18\x08 \x01(\x08\x12\x15\n\rreport_config\x18\x0b \x01(\x08\x12%\n\x19include_task_queue_status\x18\x04 \x01(\x08\x42\x02\x18\x01\x12\x42\n\x08\x61pi_mode\x18\x05 \x01(\x0e\x32,.temporal.api.enums.v1.DescribeTaskQueueModeB\x02\x18\x01\x12J\n\x08versions\x18\x06 \x01(\x0b\x32\x34.temporal.api.taskqueue.v1.TaskQueueVersionSelectionB\x02\x18\x01\x12\x42\n\x10task_queue_types\x18\x07 \x03(\x0e\x32$.temporal.api.enums.v1.TaskQueueTypeB\x02\x18\x01\x12\x1a\n\x0ereport_pollers\x18\t \x01(\x08\x42\x02\x18\x01\x12$\n\x18report_task_reachability\x18\n \x01(\x08\x42\x02\x18\x01"\xec\x07\n\x19\x44\x65scribeTaskQueueResponse\x12\x36\n\x07pollers\x18\x01 \x03(\x0b\x32%.temporal.api.taskqueue.v1.PollerInfo\x12\x38\n\x05stats\x18\x05 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats\x12q\n\x15stats_by_priority_key\x18\x08 \x03(\x0b\x32R.temporal.api.workflowservice.v1.DescribeTaskQueueResponse.StatsByPriorityKeyEntry\x12K\n\x0fversioning_info\x18\x04 \x01(\x0b\x32\x32.temporal.api.taskqueue.v1.TaskQueueVersioningInfo\x12:\n\x06\x63onfig\x18\x06 \x01(\x0b\x32*.temporal.api.taskqueue.v1.TaskQueueConfig\x12k\n\x14\x65\x66\x66\x65\x63tive_rate_limit\x18\x07 \x01(\x0b\x32M.temporal.api.workflowservice.v1.DescribeTaskQueueResponse.EffectiveRateLimit\x12I\n\x11task_queue_status\x18\x02 \x01(\x0b\x32*.temporal.api.taskqueue.v1.TaskQueueStatusB\x02\x18\x01\x12g\n\rversions_info\x18\x03 \x03(\x0b\x32L.temporal.api.workflowservice.v1.DescribeTaskQueueResponse.VersionsInfoEntryB\x02\x18\x01\x1a\x64\n\x17StatsByPriorityKeyEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats:\x02\x38\x01\x1at\n\x12\x45\x66\x66\x65\x63tiveRateLimit\x12\x1b\n\x13requests_per_second\x18\x01 \x01(\x02\x12\x41\n\x11rate_limit_source\x18\x02 \x01(\x0e\x32&.temporal.api.enums.v1.RateLimitSource\x1a\x64\n\x11VersionsInfoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.temporal.api.taskqueue.v1.TaskQueueVersionInfo:\x02\x38\x01"\x17\n\x15GetClusterInfoRequest"\xd1\x03\n\x16GetClusterInfoResponse\x12h\n\x11supported_clients\x18\x01 \x03(\x0b\x32M.temporal.api.workflowservice.v1.GetClusterInfoResponse.SupportedClientsEntry\x12\x16\n\x0eserver_version\x18\x02 \x01(\t\x12\x12\n\ncluster_id\x18\x03 \x01(\t\x12:\n\x0cversion_info\x18\x04 \x01(\x0b\x32$.temporal.api.version.v1.VersionInfo\x12\x14\n\x0c\x63luster_name\x18\x05 \x01(\t\x12\x1b\n\x13history_shard_count\x18\x06 \x01(\x05\x12\x19\n\x11persistence_store\x18\x07 \x01(\t\x12\x18\n\x10visibility_store\x18\x08 \x01(\t\x12 \n\x18initial_failover_version\x18\t \x01(\x03\x12"\n\x1a\x66\x61ilover_version_increment\x18\n \x01(\x03\x1a\x37\n\x15SupportedClientsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x16\n\x14GetSystemInfoRequest"\xc1\x04\n\x15GetSystemInfoResponse\x12\x16\n\x0eserver_version\x18\x01 \x01(\t\x12Y\n\x0c\x63\x61pabilities\x18\x02 \x01(\x0b\x32\x43.temporal.api.workflowservice.v1.GetSystemInfoResponse.Capabilities\x1a\xb4\x03\n\x0c\x43\x61pabilities\x12\x1f\n\x17signal_and_query_header\x18\x01 \x01(\x08\x12&\n\x1einternal_error_differentiation\x18\x02 \x01(\x08\x12*\n"activity_failure_include_heartbeat\x18\x03 \x01(\x08\x12\x1a\n\x12supports_schedules\x18\x04 \x01(\x08\x12"\n\x1a\x65ncoded_failure_attributes\x18\x05 \x01(\x08\x12!\n\x19\x62uild_id_based_versioning\x18\x06 \x01(\x08\x12\x13\n\x0bupsert_memo\x18\x07 \x01(\x08\x12\x1c\n\x14\x65\x61ger_workflow_start\x18\x08 \x01(\x08\x12\x14\n\x0csdk_metadata\x18\t \x01(\x08\x12\'\n\x1f\x63ount_group_by_execution_status\x18\n \x01(\x08\x12\r\n\x05nexus\x18\x0b \x01(\x08\x12!\n\x19server_scaled_deployments\x18\x0c \x01(\x08\x12(\n server_scaled_provider_cloud_run\x18\r \x01(\x08"m\n\x1eListTaskQueuePartitionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue"\xdf\x01\n\x1fListTaskQueuePartitionsResponse\x12]\n\x1e\x61\x63tivity_task_queue_partitions\x18\x01 \x03(\x0b\x32\x35.temporal.api.taskqueue.v1.TaskQueuePartitionMetadata\x12]\n\x1eworkflow_task_queue_partitions\x18\x02 \x03(\x0b\x32\x35.temporal.api.taskqueue.v1.TaskQueuePartitionMetadata"\xcc\x02\n\x15\x43reateScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x34\n\x08schedule\x18\x03 \x01(\x0b\x32".temporal.api.schedule.v1.Schedule\x12>\n\rinitial_patch\x18\x04 \x01(\x0b\x32\'.temporal.api.schedule.v1.SchedulePatch\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t\x12*\n\x04memo\x18\x07 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x08 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes"0\n\x16\x43reateScheduleResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c"A\n\x17\x44\x65scribeScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t"\x8f\x02\n\x18\x44\x65scribeScheduleResponse\x12\x34\n\x08schedule\x18\x01 \x01(\x0b\x32".temporal.api.schedule.v1.Schedule\x12\x34\n\x04info\x18\x02 \x01(\x0b\x32&.temporal.api.schedule.v1.ScheduleInfo\x12*\n\x04memo\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x04 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x16\n\x0e\x63onflict_token\x18\x05 \x01(\x0c"\xa4\x02\n\x15UpdateScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x34\n\x08schedule\x18\x03 \x01(\x0b\x32".temporal.api.schedule.v1.Schedule\x12\x16\n\x0e\x63onflict_token\x18\x04 \x01(\x0c\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t\x12\x43\n\x11search_attributes\x18\x07 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12*\n\x04memo\x18\x08 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\x18\n\x16UpdateScheduleResponse"\x9c\x01\n\x14PatchScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x36\n\x05patch\x18\x03 \x01(\x0b\x32\'.temporal.api.schedule.v1.SchedulePatch\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t"\x17\n\x15PatchScheduleResponse"\xa8\x01\n ListScheduleMatchingTimesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12.\n\nstart_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"S\n!ListScheduleMatchingTimesResponse\x12.\n\nstart_time\x18\x01 \x03(\x0b\x32\x1a.google.protobuf.Timestamp"Q\n\x15\x44\x65leteScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t"\x18\n\x16\x44\x65leteScheduleResponse"l\n\x14ListSchedulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11maximum_page_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"p\n\x15ListSchedulesResponse\x12>\n\tschedules\x18\x01 \x03(\x0b\x32+.temporal.api.schedule.v1.ScheduleListEntry\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"9\n\x15\x43ountSchedulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xdb\x01\n\x16\x43ountSchedulesResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12X\n\x06groups\x18\x02 \x03(\x0b\x32H.temporal.api.workflowservice.v1.CountSchedulesResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"\x86\x05\n\'UpdateWorkerBuildIdCompatibilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12-\n#add_new_build_id_in_new_default_set\x18\x03 \x01(\tH\x00\x12\x87\x01\n\x1b\x61\x64\x64_new_compatible_build_id\x18\x04 \x01(\x0b\x32`.temporal.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityRequest.AddNewCompatibleVersionH\x00\x12!\n\x17promote_set_by_build_id\x18\x05 \x01(\tH\x00\x12%\n\x1bpromote_build_id_within_set\x18\x06 \x01(\tH\x00\x12h\n\nmerge_sets\x18\x07 \x01(\x0b\x32R.temporal.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityRequest.MergeSetsH\x00\x1ao\n\x17\x41\x64\x64NewCompatibleVersion\x12\x14\n\x0cnew_build_id\x18\x01 \x01(\t\x12$\n\x1c\x65xisting_compatible_build_id\x18\x02 \x01(\t\x12\x18\n\x10make_set_default\x18\x03 \x01(\x08\x1aI\n\tMergeSets\x12\x1c\n\x14primary_set_build_id\x18\x01 \x01(\t\x12\x1e\n\x16secondary_set_build_id\x18\x02 \x01(\tB\x0b\n\toperation"@\n(UpdateWorkerBuildIdCompatibilityResponseJ\x04\x08\x01\x10\x02R\x0eversion_set_id"_\n$GetWorkerBuildIdCompatibilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12\x10\n\x08max_sets\x18\x03 \x01(\x05"t\n%GetWorkerBuildIdCompatibilityResponse\x12K\n\x12major_version_sets\x18\x01 \x03(\x0b\x32/.temporal.api.taskqueue.v1.CompatibleVersionSet"\xb5\r\n"UpdateWorkerVersioningRulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12\x16\n\x0e\x63onflict_token\x18\x03 \x01(\x0c\x12\x81\x01\n\x16insert_assignment_rule\x18\x04 \x01(\x0b\x32_.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.InsertBuildIdAssignmentRuleH\x00\x12\x83\x01\n\x17replace_assignment_rule\x18\x05 \x01(\x0b\x32`.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.ReplaceBuildIdAssignmentRuleH\x00\x12\x81\x01\n\x16\x64\x65lete_assignment_rule\x18\x06 \x01(\x0b\x32_.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.DeleteBuildIdAssignmentRuleH\x00\x12\x8c\x01\n\x1c\x61\x64\x64_compatible_redirect_rule\x18\x07 \x01(\x0b\x32\x64.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.AddCompatibleBuildIdRedirectRuleH\x00\x12\x94\x01\n replace_compatible_redirect_rule\x18\x08 \x01(\x0b\x32h.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.ReplaceCompatibleBuildIdRedirectRuleH\x00\x12\x92\x01\n\x1f\x64\x65lete_compatible_redirect_rule\x18\t \x01(\x0b\x32g.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.DeleteCompatibleBuildIdRedirectRuleH\x00\x12l\n\x0f\x63ommit_build_id\x18\n \x01(\x0b\x32Q.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.CommitBuildIdH\x00\x1aq\n\x1bInsertBuildIdAssignmentRule\x12\x12\n\nrule_index\x18\x01 \x01(\x05\x12>\n\x04rule\x18\x02 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.BuildIdAssignmentRule\x1a\x81\x01\n\x1cReplaceBuildIdAssignmentRule\x12\x12\n\nrule_index\x18\x01 \x01(\x05\x12>\n\x04rule\x18\x02 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.BuildIdAssignmentRule\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\x1a@\n\x1b\x44\x65leteBuildIdAssignmentRule\x12\x12\n\nrule_index\x18\x01 \x01(\x05\x12\r\n\x05\x66orce\x18\x02 \x01(\x08\x1aj\n AddCompatibleBuildIdRedirectRule\x12\x46\n\x04rule\x18\x01 \x01(\x0b\x32\x38.temporal.api.taskqueue.v1.CompatibleBuildIdRedirectRule\x1an\n$ReplaceCompatibleBuildIdRedirectRule\x12\x46\n\x04rule\x18\x01 \x01(\x0b\x32\x38.temporal.api.taskqueue.v1.CompatibleBuildIdRedirectRule\x1a>\n#DeleteCompatibleBuildIdRedirectRule\x12\x17\n\x0fsource_build_id\x18\x01 \x01(\t\x1a\x37\n\rCommitBuildId\x12\x17\n\x0ftarget_build_id\x18\x01 \x01(\t\x12\r\n\x05\x66orce\x18\x02 \x01(\x08\x42\x0b\n\toperation"\xfc\x01\n#UpdateWorkerVersioningRulesResponse\x12U\n\x10\x61ssignment_rules\x18\x01 \x03(\x0b\x32;.temporal.api.taskqueue.v1.TimestampedBuildIdAssignmentRule\x12\x66\n\x19\x63ompatible_redirect_rules\x18\x02 \x03(\x0b\x32\x43.temporal.api.taskqueue.v1.TimestampedCompatibleBuildIdRedirectRule\x12\x16\n\x0e\x63onflict_token\x18\x03 \x01(\x0c"H\n\x1fGetWorkerVersioningRulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t"\xf9\x01\n GetWorkerVersioningRulesResponse\x12U\n\x10\x61ssignment_rules\x18\x01 \x03(\x0b\x32;.temporal.api.taskqueue.v1.TimestampedBuildIdAssignmentRule\x12\x66\n\x19\x63ompatible_redirect_rules\x18\x02 \x03(\x0b\x32\x43.temporal.api.taskqueue.v1.TimestampedCompatibleBuildIdRedirectRule\x12\x16\n\x0e\x63onflict_token\x18\x03 \x01(\x0c"\x9c\x01\n GetWorkerTaskReachabilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tbuild_ids\x18\x02 \x03(\t\x12\x13\n\x0btask_queues\x18\x03 \x03(\t\x12=\n\x0creachability\x18\x04 \x01(\x0e\x32\'.temporal.api.enums.v1.TaskReachability"r\n!GetWorkerTaskReachabilityResponse\x12M\n\x15\x62uild_id_reachability\x18\x01 \x03(\x0b\x32..temporal.api.taskqueue.v1.BuildIdReachability"\x85\x02\n\x1eUpdateWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1e\n\x16\x66irst_execution_run_id\x18\x03 \x01(\t\x12\x37\n\x0bwait_policy\x18\x04 \x01(\x0b\x32".temporal.api.update.v1.WaitPolicy\x12\x30\n\x07request\x18\x05 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request"\x83\x02\n\x1fUpdateWorkflowExecutionResponse\x12\x35\n\nupdate_ref\x18\x01 \x01(\x0b\x32!.temporal.api.update.v1.UpdateRef\x12\x30\n\x07outcome\x18\x02 \x01(\x0b\x32\x1f.temporal.api.update.v1.Outcome\x12K\n\x05stage\x18\x03 \x01(\x0e\x32<.temporal.api.enums.v1.UpdateWorkflowExecutionLifecycleStage\x12*\n\x04link\x18\x04 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xd6\n\n\x1aStartBatchOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x18\n\x10visibility_query\x18\x02 \x01(\t\x12\x0e\n\x06job_id\x18\x03 \x01(\t\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x41\n\nexecutions\x18\x05 \x03(\x0b\x32).temporal.api.common.v1.WorkflowExecutionB\x02\x18\x01\x12<\n\x11target_executions\x18\x16 \x03(\x0b\x32!.temporal.api.common.v1.Execution\x12!\n\x19max_operations_per_second\x18\x06 \x01(\x02\x12Q\n\x15termination_operation\x18\n \x01(\x0b\x32\x30.temporal.api.batch.v1.BatchOperationTerminationH\x00\x12G\n\x10signal_operation\x18\x0b \x01(\x0b\x32+.temporal.api.batch.v1.BatchOperationSignalH\x00\x12S\n\x16\x63\x61ncellation_operation\x18\x0c \x01(\x0b\x32\x31.temporal.api.batch.v1.BatchOperationCancellationH\x00\x12K\n\x12\x64\x65letion_operation\x18\r \x01(\x0b\x32-.temporal.api.batch.v1.BatchOperationDeletionH\x00\x12\x45\n\x0freset_operation\x18\x0e \x01(\x0b\x32*.temporal.api.batch.v1.BatchOperationResetH\x00\x12p\n!update_workflow_options_operation\x18\x0f \x01(\x0b\x32\x43.temporal.api.batch.v1.BatchOperationUpdateWorkflowExecutionOptionsH\x00\x12^\n\x1cunpause_activities_operation\x18\x10 \x01(\x0b\x32\x36.temporal.api.batch.v1.BatchOperationUnpauseActivitiesH\x00\x12Z\n\x1areset_activities_operation\x18\x11 \x01(\x0b\x32\x34.temporal.api.batch.v1.BatchOperationResetActivitiesH\x00\x12g\n!update_activity_options_operation\x18\x12 \x01(\x0b\x32:.temporal.api.batch.v1.BatchOperationUpdateActivityOptionsH\x00\x12\\\n\x1b\x63\x61ncel_activities_operation\x18\x13 \x01(\x0b\x32\x35.temporal.api.batch.v1.BatchOperationCancelActivitiesH\x00\x12\x62\n\x1eterminate_activities_operation\x18\x14 \x01(\x0b\x32\x38.temporal.api.batch.v1.BatchOperationTerminateActivitiesH\x00\x12\\\n\x1b\x64\x65lete_activities_operation\x18\x15 \x01(\x0b\x32\x35.temporal.api.batch.v1.BatchOperationDeleteActivitiesH\x00\x42\x0b\n\toperation"\x1d\n\x1bStartBatchOperationResponse"`\n\x19StopBatchOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t"\x1c\n\x1aStopBatchOperationResponse"B\n\x1d\x44\x65scribeBatchOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t"\xd8\x03\n\x1e\x44\x65scribeBatchOperationResponse\x12\x41\n\x0eoperation_type\x18\x01 \x01(\x0e\x32).temporal.api.enums.v1.BatchOperationType\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x39\n\x05state\x18\x03 \x01(\x0e\x32*.temporal.api.enums.v1.BatchOperationState\x12.\n\nstart_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nclose_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1d\n\x15total_operation_count\x18\x06 \x01(\x03\x12 \n\x18\x63omplete_operation_count\x18\x07 \x01(\x03\x12\x1f\n\x17\x66\x61ilure_operation_count\x18\x08 \x01(\x03\x12\x10\n\x08identity\x18\t \x01(\t\x12\x0e\n\x06reason\x18\n \x01(\t\x12\r\n\x05query\x18\x0b \x01(\t\x12\x35\n\nexecutions\x18\x0c \x03(\x0b\x32!.temporal.api.common.v1.Execution"[\n\x1aListBatchOperationsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c"y\n\x1bListBatchOperationsResponse\x12\x41\n\x0eoperation_info\x18\x01 \x03(\x0b\x32).temporal.api.batch.v1.BatchOperationInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xb9\x01\n"PollWorkflowExecutionUpdateRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x35\n\nupdate_ref\x18\x02 \x01(\x0b\x32!.temporal.api.update.v1.UpdateRef\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x37\n\x0bwait_policy\x18\x04 \x01(\x0b\x32".temporal.api.update.v1.WaitPolicy"\xdb\x01\n#PollWorkflowExecutionUpdateResponse\x12\x30\n\x07outcome\x18\x01 \x01(\x0b\x32\x1f.temporal.api.update.v1.Outcome\x12K\n\x05stage\x18\x02 \x01(\x0e\x32<.temporal.api.enums.v1.UpdateWorkflowExecutionLifecycleStage\x12\x35\n\nupdate_ref\x18\x03 \x01(\x0b\x32!.temporal.api.update.v1.UpdateRef"\xa0\x03\n\x19PollNexusTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x03 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x17\n\x0fpoller_group_id\x18\t \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x08 \x01(\t\x12Z\n\x1bworker_version_capabilities\x18\x04 \x01(\x0b\x32\x31.temporal.api.common.v1.WorkerVersionCapabilitiesB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x06 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12\x41\n\x10worker_heartbeat\x18\x07 \x03(\x0b\x32\'.temporal.api.worker.v1.WorkerHeartbeat"\xe2\x02\n\x1aPollNexusTaskQueueResponse\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12/\n\x07request\x18\x02 \x01(\x0b\x32\x1e.temporal.api.nexus.v1.Request\x12Q\n\x17poller_scaling_decision\x18\x03 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.PollerScalingDecision\x12\x17\n\x0fpoller_group_id\x18\x04 \x01(\t\x12J\n\x12poller_group_infos\x18\x05 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x06 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo"\xa7\x01\n RespondNexusTaskCompletedRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\ntask_token\x18\x03 \x01(\x0c\x12\x31\n\x08response\x18\x04 \x01(\x0b\x32\x1f.temporal.api.nexus.v1.Response\x12\x17\n\x0fpoller_group_id\x18\x05 \x01(\t"#\n!RespondNexusTaskCompletedResponse"\xdc\x01\n\x1dRespondNexusTaskFailedRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\ntask_token\x18\x03 \x01(\x0c\x12\x36\n\x05\x65rror\x18\x04 \x01(\x0b\x32#.temporal.api.nexus.v1.HandlerErrorB\x02\x18\x01\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x17\n\x0fpoller_group_id\x18\x06 \x01(\t" \n\x1eRespondNexusTaskFailedResponse"\xf4\x02\n\x1c\x45xecuteMultiOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12[\n\noperations\x18\x02 \x03(\x0b\x32G.temporal.api.workflowservice.v1.ExecuteMultiOperationRequest.Operation\x12\x13\n\x0bresource_id\x18\x03 \x01(\t\x1a\xce\x01\n\tOperation\x12X\n\x0estart_workflow\x18\x01 \x01(\x0b\x32>.temporal.api.workflowservice.v1.StartWorkflowExecutionRequestH\x00\x12Z\n\x0fupdate_workflow\x18\x02 \x01(\x0b\x32?.temporal.api.workflowservice.v1.UpdateWorkflowExecutionRequestH\x00\x42\x0b\n\toperation"\xcc\x02\n\x1d\x45xecuteMultiOperationResponse\x12Z\n\tresponses\x18\x01 \x03(\x0b\x32G.temporal.api.workflowservice.v1.ExecuteMultiOperationResponse.Response\x1a\xce\x01\n\x08Response\x12Y\n\x0estart_workflow\x18\x01 \x01(\x0b\x32?.temporal.api.workflowservice.v1.StartWorkflowExecutionResponseH\x00\x12[\n\x0fupdate_workflow\x18\x02 \x01(\x0b\x32@.temporal.api.workflowservice.v1.UpdateWorkflowExecutionResponseH\x00\x42\n\n\x08response"\xd0\x02\n\x1cUpdateActivityOptionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x43\n\x10\x61\x63tivity_options\x18\x04 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions\x12/\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x0c\n\x02id\x18\x06 \x01(\tH\x00\x12\x0e\n\x04type\x18\x07 \x01(\tH\x00\x12\x13\n\tmatch_all\x18\t \x01(\x08H\x00\x12\x18\n\x10restore_original\x18\x08 \x01(\x08\x42\n\n\x08\x61\x63tivity"\xbf\x02\n%UpdateActivityExecutionOptionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x43\n\x10\x61\x63tivity_options\x18\x06 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions\x12/\n\x0bupdate_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x18\n\x10restore_original\x18\x08 \x01(\x08\x12\x13\n\x0bresource_id\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t"d\n\x1dUpdateActivityOptionsResponse\x12\x43\n\x10\x61\x63tivity_options\x18\x01 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions"m\n&UpdateActivityExecutionOptionsResponse\x12\x43\n\x10\x61\x63tivity_options\x18\x01 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions"\xc7\x01\n\x14PauseActivityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x0e\n\x04type\x18\x05 \x01(\tH\x00\x12\x0e\n\x06reason\x18\x06 \x01(\t\x12\x12\n\nrequest_id\x18\x07 \x01(\tB\n\n\x08\x61\x63tivity"\xb7\x01\n\x1dPauseActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x07 \x01(\t\x12\x12\n\nrequest_id\x18\x08 \x01(\t"\x17\n\x15PauseActivityResponse" \n\x1ePauseActivityExecutionResponse"\x98\x02\n\x16UnpauseActivityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x0e\n\x04type\x18\x05 \x01(\tH\x00\x12\x15\n\x0bunpause_all\x18\x06 \x01(\x08H\x00\x12\x16\n\x0ereset_attempts\x18\x07 \x01(\x08\x12\x17\n\x0freset_heartbeat\x18\x08 \x01(\x08\x12)\n\x06jitter\x18\t \x01(\x0b\x32\x19.google.protobuf.DurationB\n\n\x08\x61\x63tivity"\x91\x02\n\x1fUnpauseActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x08 \x01(\t\x12)\n\x06jitter\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0bresource_id\x18\n \x01(\t\x12\x12\n\nrequest_id\x18\x0b \x01(\tJ\x04\x08\x06\x10\x07J\x04\x08\x07\x10\x08R\x0ereset_attemptsR\x0freset_heartbeat"\x19\n\x17UnpauseActivityResponse""\n UnpauseActivityExecutionResponse"\xb3\x02\n\x14ResetActivityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x0e\n\x04type\x18\x05 \x01(\tH\x00\x12\x13\n\tmatch_all\x18\n \x01(\x08H\x00\x12\x17\n\x0freset_heartbeat\x18\x06 \x01(\x08\x12\x13\n\x0bkeep_paused\x18\x07 \x01(\x08\x12)\n\x06jitter\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12 \n\x18restore_original_options\x18\t \x01(\x08\x42\n\n\x08\x61\x63tivity"\xa2\x02\n\x1dResetActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x13\n\x0bkeep_paused\x18\x06 \x01(\x08\x12)\n\x06jitter\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12 \n\x18restore_original_options\x18\x08 \x01(\x08\x12\x13\n\x0bresource_id\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t\x12\x17\n\x0freset_heartbeat\x18\x0b \x01(\x08"\x17\n\x15ResetActivityResponse" \n\x1eResetActivityExecutionResponse"\x9c\x02\n%UpdateWorkflowExecutionOptionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12V\n\x1aworkflow_execution_options\x18\x03 \x01(\x0b\x32\x32.temporal.api.workflow.v1.WorkflowExecutionOptions\x12/\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x10\n\x08identity\x18\x05 \x01(\t"\xb1\x01\n&UpdateWorkflowExecutionOptionsResponse\x12V\n\x1aworkflow_execution_options\x18\x01 \x01(\x0b\x32\x32.temporal.api.workflow.v1.WorkflowExecutionOptions\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"j\n\x19\x44\x65scribeDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12:\n\ndeployment\x18\x02 \x01(\x0b\x32&.temporal.api.deployment.v1.Deployment"a\n\x1a\x44\x65scribeDeploymentResponse\x12\x43\n\x0f\x64\x65ployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo"\xc2\x01\n&DescribeWorkerDeploymentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x07version\x18\x02 \x01(\tB\x02\x18\x01\x12O\n\x12\x64\x65ployment_version\x18\x03 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x1f\n\x17report_task_queue_stats\x18\x04 \x01(\x08"\x8c\x05\n\'DescribeWorkerDeploymentVersionResponse\x12_\n\x1eworker_deployment_version_info\x18\x01 \x01(\x0b\x32\x37.temporal.api.deployment.v1.WorkerDeploymentVersionInfo\x12v\n\x13version_task_queues\x18\x02 \x03(\x0b\x32Y.temporal.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse.VersionTaskQueue\x1a\x87\x03\n\x10VersionTaskQueue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x32\n\x04type\x18\x02 \x01(\x0e\x32$.temporal.api.enums.v1.TaskQueueType\x12\x38\n\x05stats\x18\x03 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats\x12\x90\x01\n\x15stats_by_priority_key\x18\x04 \x03(\x0b\x32q.temporal.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse.VersionTaskQueue.StatsByPriorityKeyEntry\x1a\x64\n\x17StatsByPriorityKeyEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats:\x02\x38\x01"M\n\x1f\x44\x65scribeWorkerDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t"\x8c\x01\n DescribeWorkerDeploymentResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12P\n\x16worker_deployment_info\x18\x02 \x01(\x0b\x32\x30.temporal.api.deployment.v1.WorkerDeploymentInfo"l\n\x16ListDeploymentsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x13\n\x0bseries_name\x18\x04 \x01(\t"w\n\x17ListDeploymentsResponse\x12\x17\n\x0fnext_page_token\x18\x01 \x01(\x0c\x12\x43\n\x0b\x64\x65ployments\x18\x02 \x03(\x0b\x32..temporal.api.deployment.v1.DeploymentListInfo"\xcd\x01\n\x1bSetCurrentDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12:\n\ndeployment\x18\x02 \x01(\x0b\x32&.temporal.api.deployment.v1.Deployment\x12\x10\n\x08identity\x18\x03 \x01(\t\x12M\n\x0fupdate_metadata\x18\x04 \x01(\x0b\x32\x34.temporal.api.deployment.v1.UpdateDeploymentMetadata"\xb9\x01\n\x1cSetCurrentDeploymentResponse\x12K\n\x17\x63urrent_deployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo\x12L\n\x18previous_deployment_info\x18\x02 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo"\xe5\x01\n(SetWorkerDeploymentCurrentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x13\n\x07version\x18\x03 \x01(\tB\x02\x18\x01\x12\x10\n\x08\x62uild_id\x18\x07 \x01(\t\x12\x16\n\x0e\x63onflict_token\x18\x04 \x01(\x0c\x12\x10\n\x08identity\x18\x05 \x01(\t\x12"\n\x1aignore_missing_task_queues\x18\x06 \x01(\x08\x12\x18\n\x10\x61llow_no_pollers\x18\t \x01(\x08"\xbf\x01\n)SetWorkerDeploymentCurrentVersionResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12\x1c\n\x10previous_version\x18\x02 \x01(\tB\x02\x18\x01\x12\\\n\x1bprevious_deployment_version\x18\x03 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersionB\x02\x18\x01"\xf9\x01\n(SetWorkerDeploymentRampingVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x13\n\x07version\x18\x03 \x01(\tB\x02\x18\x01\x12\x10\n\x08\x62uild_id\x18\x08 \x01(\t\x12\x12\n\npercentage\x18\x04 \x01(\x02\x12\x16\n\x0e\x63onflict_token\x18\x05 \x01(\x0c\x12\x10\n\x08identity\x18\x06 \x01(\t\x12"\n\x1aignore_missing_task_queues\x18\x07 \x01(\x08\x12\x18\n\x10\x61llow_no_pollers\x18\n \x01(\x08"\xe0\x01\n)SetWorkerDeploymentRampingVersionResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12\x1c\n\x10previous_version\x18\x02 \x01(\tB\x02\x18\x01\x12\\\n\x1bprevious_deployment_version\x18\x04 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersionB\x02\x18\x01\x12\x1f\n\x13previous_percentage\x18\x03 \x01(\x02\x42\x02\x18\x01"q\n\x1d\x43reateWorkerDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t"8\n\x1e\x43reateWorkerDeploymentResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c"]\n\x1cListWorkerDeploymentsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c"\x9f\x05\n\x1dListWorkerDeploymentsResponse\x12\x17\n\x0fnext_page_token\x18\x01 \x01(\x0c\x12r\n\x12worker_deployments\x18\x02 \x03(\x0b\x32V.temporal.api.workflowservice.v1.ListWorkerDeploymentsResponse.WorkerDeploymentSummary\x1a\xf0\x03\n\x17WorkerDeploymentSummary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x41\n\x0erouting_config\x18\x03 \x01(\x0b\x32).temporal.api.deployment.v1.RoutingConfig\x12o\n\x16latest_version_summary\x18\x04 \x01(\x0b\x32O.temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary\x12p\n\x17\x63urrent_version_summary\x18\x05 \x01(\x0b\x32O.temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary\x12p\n\x17ramping_version_summary\x18\x06 \x01(\x0b\x32O.temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary"\xf0\x01\n$CreateWorkerDeploymentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x02 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12>\n\x0e\x63ompute_config\x18\x04 \x01(\x0b\x32&.temporal.api.compute.v1.ComputeConfig\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t"\'\n%CreateWorkerDeploymentVersionResponse"\xc8\x01\n$DeleteWorkerDeploymentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x07version\x18\x02 \x01(\tB\x02\x18\x01\x12O\n\x12\x64\x65ployment_version\x18\x05 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x15\n\rskip_drainage\x18\x03 \x01(\x08\x12\x10\n\x08identity\x18\x04 \x01(\t"\'\n%DeleteWorkerDeploymentVersionResponse"]\n\x1d\x44\x65leteWorkerDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t" \n\x1e\x44\x65leteWorkerDeploymentResponse"\x84\x04\n1UpdateWorkerDeploymentVersionComputeConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x02 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x99\x01\n\x1d\x63ompute_config_scaling_groups\x18\x06 \x03(\x0b\x32r.temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionComputeConfigRequest.ComputeConfigScalingGroupsEntry\x12,\n$remove_compute_config_scaling_groups\x18\x07 \x03(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x1a{\n\x1f\x43omputeConfigScalingGroupsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.temporal.api.compute.v1.ComputeConfigScalingGroupUpdate:\x02\x38\x01"4\n2UpdateWorkerDeploymentVersionComputeConfigResponse"\xf4\x03\n3ValidateWorkerDeploymentVersionComputeConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x02 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x9b\x01\n\x1d\x63ompute_config_scaling_groups\x18\x06 \x03(\x0b\x32t.temporal.api.workflowservice.v1.ValidateWorkerDeploymentVersionComputeConfigRequest.ComputeConfigScalingGroupsEntry\x12,\n$remove_compute_config_scaling_groups\x18\x07 \x03(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x1a{\n\x1f\x43omputeConfigScalingGroupsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.temporal.api.compute.v1.ComputeConfigScalingGroupUpdate:\x02\x38\x01"6\n4ValidateWorkerDeploymentVersionComputeConfigResponse"\xa2\x03\n,UpdateWorkerDeploymentVersionMetadataRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x07version\x18\x02 \x01(\tB\x02\x18\x01\x12O\n\x12\x64\x65ployment_version\x18\x05 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12x\n\x0eupsert_entries\x18\x03 \x03(\x0b\x32`.temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataRequest.UpsertEntriesEntry\x12\x16\n\x0eremove_entries\x18\x04 \x03(\t\x12\x10\n\x08identity\x18\x06 \x01(\t\x1aU\n\x12UpsertEntriesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"n\n-UpdateWorkerDeploymentVersionMetadataResponse\x12=\n\x08metadata\x18\x01 \x01(\x0b\x32+.temporal.api.deployment.v1.VersionMetadata"\xbd\x01\n!SetWorkerDeploymentManagerRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x1a\n\x10manager_identity\x18\x03 \x01(\tH\x00\x12\x0e\n\x04self\x18\x04 \x01(\x08H\x00\x12\x16\n\x0e\x63onflict_token\x18\x05 \x01(\x0c\x12\x10\n\x08identity\x18\x06 \x01(\tB\x16\n\x14new_manager_identity"c\n"SetWorkerDeploymentManagerResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12%\n\x19previous_manager_identity\x18\x02 \x01(\tB\x02\x18\x01"E\n\x1bGetCurrentDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bseries_name\x18\x02 \x01(\t"k\n\x1cGetCurrentDeploymentResponse\x12K\n\x17\x63urrent_deployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo"q\n GetDeploymentReachabilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12:\n\ndeployment\x18\x02 \x01(\x0b\x32&.temporal.api.deployment.v1.Deployment"\xe3\x01\n!GetDeploymentReachabilityResponse\x12\x43\n\x0f\x64\x65ployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo\x12\x43\n\x0creachability\x18\x02 \x01(\x0e\x32-.temporal.api.enums.v1.DeploymentReachability\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb4\x01\n\x19\x43reateWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x35\n\x04spec\x18\x02 \x01(\x0b\x32\'.temporal.api.rules.v1.WorkflowRuleSpec\x12\x12\n\nforce_scan\x18\x03 \x01(\x08\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x06 \x01(\t"_\n\x1a\x43reateWorkflowRuleResponse\x12\x31\n\x04rule\x18\x01 \x01(\x0b\x32#.temporal.api.rules.v1.WorkflowRule\x12\x0e\n\x06job_id\x18\x02 \x01(\t"A\n\x1b\x44\x65scribeWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0f\n\x07rule_id\x18\x02 \x01(\t"Q\n\x1c\x44\x65scribeWorkflowRuleResponse\x12\x31\n\x04rule\x18\x01 \x01(\x0b\x32#.temporal.api.rules.v1.WorkflowRule"?\n\x19\x44\x65leteWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0f\n\x07rule_id\x18\x02 \x01(\t"\x1c\n\x1a\x44\x65leteWorkflowRuleResponse"F\n\x18ListWorkflowRulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"h\n\x19ListWorkflowRulesResponse\x12\x32\n\x05rules\x18\x01 \x03(\x0b\x32#.temporal.api.rules.v1.WorkflowRule\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xce\x01\n\x1aTriggerWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x37\n\x04spec\x18\x05 \x01(\x0b\x32\'.temporal.api.rules.v1.WorkflowRuleSpecH\x00\x12\x10\n\x08identity\x18\x03 \x01(\tB\x06\n\x04rule".\n\x1bTriggerWorkflowRuleResponse\x12\x0f\n\x07\x61pplied\x18\x01 \x01(\x08"\x9b\x01\n\x1cRecordWorkerHeartbeatRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x41\n\x10worker_heartbeat\x18\x03 \x03(\x0b\x32\'.temporal.api.worker.v1.WorkerHeartbeat\x12\x13\n\x0bresource_id\x18\x04 \x01(\t"\x1f\n\x1dRecordWorkerHeartbeatResponse"\x82\x01\n\x12ListWorkersRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t\x12\x1e\n\x16include_system_workers\x18\x05 \x01(\x08"\xa5\x01\n\x13ListWorkersResponse\x12<\n\x0cworkers_info\x18\x01 \x03(\x0b\x32".temporal.api.worker.v1.WorkerInfoB\x02\x18\x01\x12\x37\n\x07workers\x18\x03 \x03(\x0b\x32&.temporal.api.worker.v1.WorkerListInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xd5\x05\n\x1cUpdateTaskQueueConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\ntask_queue\x18\x03 \x01(\t\x12=\n\x0ftask_queue_type\x18\x04 \x01(\x0e\x32$.temporal.api.enums.v1.TaskQueueType\x12n\n\x17update_queue_rate_limit\x18\x05 \x01(\x0b\x32M.temporal.api.workflowservice.v1.UpdateTaskQueueConfigRequest.RateLimitUpdate\x12}\n&update_fairness_key_rate_limit_default\x18\x06 \x01(\x0b\x32M.temporal.api.workflowservice.v1.UpdateTaskQueueConfigRequest.RateLimitUpdate\x12\x84\x01\n\x1dset_fairness_weight_overrides\x18\x07 \x03(\x0b\x32].temporal.api.workflowservice.v1.UpdateTaskQueueConfigRequest.SetFairnessWeightOverridesEntry\x12\'\n\x1funset_fairness_weight_overrides\x18\x08 \x03(\t\x1a[\n\x0fRateLimitUpdate\x12\x38\n\nrate_limit\x18\x01 \x01(\x0b\x32$.temporal.api.taskqueue.v1.RateLimit\x12\x0e\n\x06reason\x18\x02 \x01(\t\x1a\x41\n\x1fSetFairnessWeightOverridesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02:\x02\x38\x01"[\n\x1dUpdateTaskQueueConfigResponse\x12:\n\x06\x63onfig\x18\x01 \x01(\x0b\x32*.temporal.api.taskqueue.v1.TaskQueueConfig"\x9e\x01\n\x18\x46\x65tchWorkerConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x38\n\x08selector\x18\x06 \x01(\x0b\x32&.temporal.api.common.v1.WorkerSelector\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"U\n\x19\x46\x65tchWorkerConfigResponse\x12\x38\n\rworker_config\x18\x01 \x01(\x0b\x32!.temporal.api.sdk.v1.WorkerConfig"\x8a\x02\n\x19UpdateWorkerConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x38\n\rworker_config\x18\x04 \x01(\x0b\x32!.temporal.api.sdk.v1.WorkerConfig\x12/\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x38\n\x08selector\x18\x06 \x01(\x0b\x32&.temporal.api.common.v1.WorkerSelector\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"d\n\x1aUpdateWorkerConfigResponse\x12:\n\rworker_config\x18\x01 \x01(\x0b\x32!.temporal.api.sdk.v1.WorkerConfigH\x00\x42\n\n\x08response"G\n\x15\x44\x65scribeWorkerRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x02 \x01(\t"Q\n\x16\x44\x65scribeWorkerResponse\x12\x37\n\x0bworker_info\x18\x01 \x01(\x0b\x32".temporal.api.worker.v1.WorkerInfo"W\n\x13\x43ountWorkersRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t\x12\x1e\n\x16include_system_workers\x18\x03 \x01(\x08"%\n\x14\x43ountWorkersResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03"\x8d\x01\n\x1dPauseWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x0e\n\x06reason\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t" \n\x1ePauseWorkflowExecutionResponse"\x8f\x01\n\x1fUnpauseWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x0e\n\x06reason\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t""\n UnpauseWorkflowExecutionResponse"\x99\t\n\x1dStartActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12;\n\ractivity_type\x18\x05 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x38\n\ntask_queue\x18\x06 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12<\n\x19schedule_to_close_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0b \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12/\n\x05input\x18\x0c \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x45\n\x0fid_reuse_policy\x18\r \x01(\x0e\x32,.temporal.api.enums.v1.ActivityIdReusePolicy\x12K\n\x12id_conflict_policy\x18\x0e \x01(\x0e\x32/.temporal.api.enums.v1.ActivityIdConflictPolicy\x12\x43\n\x11search_attributes\x18\x0f \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\x06header\x18\x10 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x38\n\ruser_metadata\x18\x11 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12\x32\n\x08priority\x18\x12 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12>\n\x14\x63ompletion_callbacks\x18\x13 \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12+\n\x05links\x18\x14 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12\x46\n\x13on_conflict_options\x18\x15 \x01(\x0b\x32).temporal.api.common.v1.OnConflictOptions\x12.\n\x0bstart_delay\x18\x16 \x01(\x0b\x32\x19.google.protobuf.Duration"m\n\x1eStartActivityExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x0f\n\x07started\x18\x02 \x01(\x08\x12*\n\x04link\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xe4\x01\n DescribeActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x15\n\rinclude_input\x18\x04 \x01(\x08\x12\x17\n\x0finclude_outcome\x18\x05 \x01(\x08\x12\x17\n\x0flong_poll_token\x18\x06 \x01(\x0c\x12!\n\x19include_heartbeat_details\x18\x07 \x01(\x08\x12\x1c\n\x14include_last_failure\x18\x08 \x01(\x08"\xbc\x02\n!DescribeActivityExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12=\n\x04info\x18\x02 \x01(\x0b\x32/.temporal.api.activity.v1.ActivityExecutionInfo\x12/\n\x05input\x18\x03 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x43\n\x07outcome\x18\x04 \x01(\x0b\x32\x32.temporal.api.activity.v1.ActivityExecutionOutcome\x12\x17\n\x0flong_poll_token\x18\x05 \x01(\x0c\x12\x39\n\tcallbacks\x18\x06 \x03(\x0b\x32&.temporal.api.activity.v1.CallbackInfo"V\n\x1cPollActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t"t\n\x1dPollActivityExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x43\n\x07outcome\x18\x02 \x01(\x0b\x32\x32.temporal.api.activity.v1.ActivityExecutionOutcome"m\n\x1dListActivityExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"\x82\x01\n\x1eListActivityExecutionsResponse\x12G\n\nexecutions\x18\x01 \x03(\x0b\x32\x33.temporal.api.activity.v1.ActivityExecutionListInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xd1\x06\n#StartNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x14\n\x0coperation_id\x18\x04 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x05 \x01(\t\x12\x0f\n\x07service\x18\x06 \x01(\t\x12\x11\n\toperation\x18\x07 \x01(\t\x12<\n\x19schedule_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12.\n\x05input\x18\x0b \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12K\n\x0fid_reuse_policy\x18\x0c \x01(\x0e\x32\x32.temporal.api.enums.v1.NexusOperationIdReusePolicy\x12Q\n\x12id_conflict_policy\x18\r \x01(\x0e\x32\x35.temporal.api.enums.v1.NexusOperationIdConflictPolicy\x12\x43\n\x11search_attributes\x18\x0e \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12k\n\x0cnexus_header\x18\x0f \x03(\x0b\x32U.temporal.api.workflowservice.v1.StartNexusOperationExecutionRequest.NexusHeaderEntry\x12\x38\n\ruser_metadata\x18\x10 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"G\n$StartNexusOperationExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x0f\n\x07started\x18\x02 \x01(\x08"\xaa\x01\n&DescribeNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x15\n\rinclude_input\x18\x04 \x01(\x08\x12\x17\n\x0finclude_outcome\x18\x05 \x01(\x08\x12\x17\n\x0flong_poll_token\x18\x06 \x01(\x0c"\xb7\x02\n\'DescribeNexusOperationExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12@\n\x04info\x18\x02 \x01(\x0b\x32\x32.temporal.api.nexus.v1.NexusOperationExecutionInfo\x12.\n\x05input\x18\x03 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x31\n\x06result\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x12\x33\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x12\x17\n\x0flong_poll_token\x18\x06 \x01(\x0c\x42\t\n\x07outcome"\xa1\x01\n"PollNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x42\n\nwait_stage\x18\x04 \x01(\x0e\x32..temporal.api.enums.v1.NexusOperationWaitStage"\x85\x02\n#PollNexusOperationExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x42\n\nwait_stage\x18\x02 \x01(\x0e\x32..temporal.api.enums.v1.NexusOperationWaitStage\x12\x17\n\x0foperation_token\x18\x03 \x01(\t\x12\x31\n\x06result\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x12\x33\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\t\n\x07outcome"s\n#ListNexusOperationExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"\x8b\x01\n$ListNexusOperationExecutionsResponse\x12J\n\noperations\x18\x01 \x03(\x0b\x32\x36.temporal.api.nexus.v1.NexusOperationExecutionListInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"B\n\x1e\x43ountActivityExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xed\x01\n\x1f\x43ountActivityExecutionsResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x61\n\x06groups\x18\x02 \x03(\x0b\x32Q.temporal.api.workflowservice.v1.CountActivityExecutionsResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"H\n$CountNexusOperationExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xf9\x01\n%CountNexusOperationExecutionsResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12g\n\x06groups\x18\x02 \x03(\x0b\x32W.temporal.api.workflowservice.v1.CountNexusOperationExecutionsResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"\x95\x01\n%RequestCancelActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t"(\n&RequestCancelActivityExecutionResponse"\x91\x01\n!TerminateActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t"$\n"TerminateActivityExecutionResponse"X\n\x1e\x44\x65leteActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t"!\n\x1f\x44\x65leteActivityExecutionResponse"\x9c\x01\n+RequestCancelNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t".\n,RequestCancelNexusOperationExecutionResponse"\x98\x01\n\'TerminateNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t"*\n(TerminateNexusOperationExecutionResponse"_\n$DeleteNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t"\'\n%DeleteNexusOperationExecutionResponse"\x9d\x01\n(PollWorkflowExecutionTimeSkippingRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x17\n\x0f\x66\x61st_forward_id\x18\x03 \x01(\t"\xe8\x01\n)PollWorkflowExecutionTimeSkippingResponse\x12T\n\x1b\x66\x61st_forward_polling_result\x18\x01 \x01(\x0e\x32/.temporal.api.enums.v1.FastForwardPollingResult\x12\x15\n\rfailed_reason\x18\x02 \x01(\t\x12N\n\x11\x66\x61st_forward_info\x18\x03 \x01(\x0b\x32\x33.temporal.api.common.v1.TimeSkippingFastForwardInfoB\xbe\x01\n"io.temporal.api.workflowservice.v1B\x14RequestResponseProtoP\x01Z5go.temporal.io/api/workflowservice/v1;workflowservice\xaa\x02!Temporalio.Api.WorkflowService.V1\xea\x02$Temporalio::Api::WorkflowService::V1b\x06proto3' + b'\n6temporal/api/workflowservice/v1/request_response.proto\x12\x1ftemporal.api.workflowservice.v1\x1a+temporal/api/enums/v1/batch_operation.proto\x1a"temporal/api/enums/v1/common.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a%temporal/api/enums/v1/namespace.proto\x1a(temporal/api/enums/v1/failed_cause.proto\x1a!temporal/api/enums/v1/query.proto\x1a!temporal/api/enums/v1/reset.proto\x1a&temporal/api/enums/v1/task_queue.proto\x1a&temporal/api/enums/v1/deployment.proto\x1a"temporal/api/enums/v1/update.proto\x1a)temporal/api/enums/v1/time_skipping.proto\x1a$temporal/api/enums/v1/activity.proto\x1a!temporal/api/enums/v1/nexus.proto\x1a&temporal/api/activity/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/stream/v1/message.proto\x1a%temporal/api/history/v1/message.proto\x1a&temporal/api/workflow/v1/message.proto\x1a%temporal/api/command/v1/message.proto\x1a$temporal/api/compute/v1/config.proto\x1a(temporal/api/deployment/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/filter/v1/message.proto\x1a&temporal/api/protocol/v1/message.proto\x1a\'temporal/api/namespace/v1/message.proto\x1a#temporal/api/query/v1/message.proto\x1a)temporal/api/replication/v1/message.proto\x1a#temporal/api/rules/v1/message.proto\x1a\'temporal/api/sdk/v1/worker_config.proto\x1a&temporal/api/schedule/v1/message.proto\x1a\'temporal/api/taskqueue/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a%temporal/api/version/v1/message.proto\x1a#temporal/api/batch/v1/message.proto\x1a\x30temporal/api/sdk/v1/task_complete_metadata.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a#temporal/api/nexus/v1/message.proto\x1a$temporal/api/worker/v1/message.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x88\x05\n\x18RegisterNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x13\n\x0bowner_email\x18\x03 \x01(\t\x12\x46\n#workflow_execution_retention_period\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12G\n\x08\x63lusters\x18\x05 \x03(\x0b\x32\x35.temporal.api.replication.v1.ClusterReplicationConfig\x12\x1b\n\x13\x61\x63tive_cluster_name\x18\x06 \x01(\t\x12Q\n\x04\x64\x61ta\x18\x07 \x03(\x0b\x32\x43.temporal.api.workflowservice.v1.RegisterNamespaceRequest.DataEntry\x12\x16\n\x0esecurity_token\x18\x08 \x01(\t\x12\x1b\n\x13is_global_namespace\x18\t \x01(\x08\x12\x44\n\x16history_archival_state\x18\n \x01(\x0e\x32$.temporal.api.enums.v1.ArchivalState\x12\x1c\n\x14history_archival_uri\x18\x0b \x01(\t\x12G\n\x19visibility_archival_state\x18\x0c \x01(\x0e\x32$.temporal.api.enums.v1.ArchivalState\x12\x1f\n\x17visibility_archival_uri\x18\r \x01(\t\x1a+\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x1b\n\x19RegisterNamespaceResponse"\x89\x01\n\x15ListNamespacesRequest\x12\x11\n\tpage_size\x18\x01 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c\x12\x44\n\x10namespace_filter\x18\x03 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceFilter"\x81\x01\n\x16ListNamespacesResponse\x12N\n\nnamespaces\x18\x01 \x03(\x0b\x32:.temporal.api.workflowservice.v1.DescribeNamespaceResponse\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"S\n\x18\x44\x65scribeNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\x18\n\x10weak_consistency\x18\x03 \x01(\x08"\x81\x04\n\x19\x44\x65scribeNamespaceResponse\x12@\n\x0enamespace_info\x18\x01 \x01(\x0b\x32(.temporal.api.namespace.v1.NamespaceInfo\x12:\n\x06\x63onfig\x18\x02 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceConfig\x12S\n\x12replication_config\x18\x03 \x01(\x0b\x32\x37.temporal.api.replication.v1.NamespaceReplicationConfig\x12\x18\n\x10\x66\x61ilover_version\x18\x04 \x01(\x03\x12\x1b\n\x13is_global_namespace\x18\x05 \x01(\x08\x12\x45\n\x10\x66\x61ilover_history\x18\x06 \x03(\x0b\x32+.temporal.api.replication.v1.FailoverStatus\x12J\n\x12poller_group_infos\x18\x07 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x08 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo"\xcf\x02\n\x16UpdateNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x43\n\x0bupdate_info\x18\x02 \x01(\x0b\x32..temporal.api.namespace.v1.UpdateNamespaceInfo\x12:\n\x06\x63onfig\x18\x03 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceConfig\x12S\n\x12replication_config\x18\x04 \x01(\x0b\x32\x37.temporal.api.replication.v1.NamespaceReplicationConfig\x12\x16\n\x0esecurity_token\x18\x05 \x01(\t\x12\x19\n\x11\x64\x65lete_bad_binary\x18\x06 \x01(\t\x12\x19\n\x11promote_namespace\x18\x07 \x01(\x08"\xa3\x02\n\x17UpdateNamespaceResponse\x12@\n\x0enamespace_info\x18\x01 \x01(\x0b\x32(.temporal.api.namespace.v1.NamespaceInfo\x12:\n\x06\x63onfig\x18\x02 \x01(\x0b\x32*.temporal.api.namespace.v1.NamespaceConfig\x12S\n\x12replication_config\x18\x03 \x01(\x0b\x32\x37.temporal.api.replication.v1.NamespaceReplicationConfig\x12\x18\n\x10\x66\x61ilover_version\x18\x04 \x01(\x03\x12\x1b\n\x13is_global_namespace\x18\x05 \x01(\x08"F\n\x19\x44\x65precateNamespaceRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x16\n\x0esecurity_token\x18\x02 \x01(\t"\x1c\n\x1a\x44\x65precateNamespaceResponse"\xd1\x0c\n\x1dStartWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x10\n\x08identity\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t\x12N\n\x18workflow_id_reuse_policy\x18\x0b \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12T\n\x1bworkflow_id_conflict_policy\x18\x16 \x01(\x0e\x32/.temporal.api.enums.v1.WorkflowIdConflictPolicy\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\r \x01(\t\x12*\n\x04memo\x18\x0e \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x0f \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\x06header\x18\x10 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x1f\n\x17request_eager_execution\x18\x11 \x01(\x08\x12;\n\x11\x63ontinued_failure\x18\x12 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x13 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x37\n\x14workflow_start_delay\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12>\n\x14\x63ompletion_callbacks\x18\x15 \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12\x38\n\ruser_metadata\x18\x17 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12+\n\x05links\x18\x18 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12I\n\x13versioning_override\x18\x19 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12H\n\x13on_conflict_options\x18\x1a \x01(\x0b\x32+.temporal.api.workflow.v1.OnConflictOptions\x12\x32\n\x08priority\x18\x1b \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12\\\n\x1f\x65\x61ger_worker_deployment_options\x18\x1c \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12H\n\x14time_skipping_config\x18\x1d \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfig"\xaa\x02\n\x1eStartWorkflowExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x06 \x01(\t\x12\x0f\n\x07started\x18\x03 \x01(\x08\x12>\n\x06status\x18\x05 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowExecutionStatus\x12[\n\x13\x65\x61ger_workflow_task\x18\x02 \x01(\x0b\x32>.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse\x12*\n\x04link\x18\x04 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xaa\x02\n"GetWorkflowExecutionHistoryRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x19\n\x11maximum_page_size\x18\x03 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x04 \x01(\x0c\x12\x16\n\x0ewait_new_event\x18\x05 \x01(\x08\x12P\n\x19history_event_filter_type\x18\x06 \x01(\x0e\x32-.temporal.api.enums.v1.HistoryEventFilterType\x12\x15\n\rskip_archival\x18\x07 \x01(\x08"\xba\x01\n#GetWorkflowExecutionHistoryResponse\x12\x31\n\x07history\x18\x01 \x01(\x0b\x32 .temporal.api.history.v1.History\x12\x35\n\x0braw_history\x18\x02 \x03(\x0b\x32 .temporal.api.common.v1.DataBlob\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x10\n\x08\x61rchived\x18\x04 \x01(\x08"\xb0\x01\n)GetWorkflowExecutionHistoryReverseRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x19\n\x11maximum_page_size\x18\x03 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x04 \x01(\x0c"x\n*GetWorkflowExecutionHistoryReverseResponse\x12\x31\n\x07history\x18\x01 \x01(\x0b\x32 .temporal.api.history.v1.History\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c"\xb8\x03\n\x1cPollWorkflowTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x17\n\x0fpoller_group_id\x18\n \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x08 \x01(\t\x12!\n\x19worker_control_task_queue\x18\t \x01(\t\x12\x1b\n\x0f\x62inary_checksum\x18\x04 \x01(\tB\x02\x18\x01\x12Z\n\x1bworker_version_capabilities\x18\x05 \x01(\x0b\x32\x31.temporal.api.common.v1.WorkerVersionCapabilitiesB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x06 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptionsJ\x04\x08\x07\x10\x08R\x10worker_heartbeat"\xfb\x08\n\x1dPollWorkflowTaskQueueResponse\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12!\n\x19previous_started_event_id\x18\x04 \x01(\x03\x12\x18\n\x10started_event_id\x18\x05 \x01(\x03\x12\x0f\n\x07\x61ttempt\x18\x06 \x01(\x05\x12\x1a\n\x12\x62\x61\x63klog_count_hint\x18\x07 \x01(\x03\x12\x31\n\x07history\x18\x08 \x01(\x0b\x32 .temporal.api.history.v1.History\x12\x17\n\x0fnext_page_token\x18\t \x01(\x0c\x12\x33\n\x05query\x18\n \x01(\x0b\x32$.temporal.api.query.v1.WorkflowQuery\x12K\n\x1dworkflow_execution_task_queue\x18\x0b \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x32\n\x0escheduled_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x0cstarted_time\x18\r \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\\\n\x07queries\x18\x0e \x03(\x0b\x32K.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse.QueriesEntry\x12\x33\n\x08messages\x18\x0f \x03(\x0b\x32!.temporal.api.protocol.v1.Message\x12Q\n\x17poller_scaling_decision\x18\x10 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.PollerScalingDecision\x12\x17\n\x0fpoller_group_id\x18\x11 \x01(\t\x12J\n\x12poller_group_infos\x18\x12 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x13 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo\x12:\n\rstream_slices\x18\x14 \x03(\x0b\x32#.temporal.api.stream.v1.StreamSlice\x1aT\n\x0cQueriesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.temporal.api.query.v1.WorkflowQuery:\x02\x38\x01"\xba\n\n#RespondWorkflowTaskCompletedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x32\n\x08\x63ommands\x18\x02 \x03(\x0b\x32 .temporal.api.command.v1.Command\x12\x10\n\x08identity\x18\x03 \x01(\t\x12O\n\x11sticky_attributes\x18\x04 \x01(\x0b\x32\x34.temporal.api.taskqueue.v1.StickyExecutionAttributes\x12 \n\x18return_new_workflow_task\x18\x05 \x01(\x08\x12&\n\x1e\x66orce_create_new_workflow_task\x18\x06 \x01(\x08\x12\x1b\n\x0f\x62inary_checksum\x18\x07 \x01(\tB\x02\x18\x01\x12m\n\rquery_results\x18\x08 \x03(\x0b\x32V.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest.QueryResultsEntry\x12\x11\n\tnamespace\x18\t \x01(\t\x12\x13\n\x0bresource_id\x18\x12 \x01(\t\x12L\n\x14worker_version_stamp\x18\n \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12\x33\n\x08messages\x18\x0b \x03(\x0b\x32!.temporal.api.protocol.v1.Message\x12H\n\x0csdk_metadata\x18\x0c \x01(\x0b\x32\x32.temporal.api.sdk.v1.WorkflowTaskCompletedMetadata\x12\x43\n\x11metering_metadata\x18\r \x01(\x0b\x32(.temporal.api.common.v1.MeteringMetadata\x12g\n\x0c\x63\x61pabilities\x18\x0e \x01(\x0b\x32Q.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest.Capabilities\x12>\n\ndeployment\x18\x0f \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12\x46\n\x13versioning_behavior\x18\x10 \x01(\x0e\x32).temporal.api.enums.v1.VersioningBehavior\x12O\n\x12\x64\x65ployment_options\x18\x11 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12\x1b\n\x13worker_instance_key\x18\x13 \x01(\t\x12!\n\x19worker_control_task_queue\x18\x14 \x01(\t\x12\x13\n\x0bpage_number\x18\x15 \x01(\x05\x12\x19\n\x11intermediate_page\x18\x16 \x01(\x08\x1a_\n\x11QueryResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x39\n\x05value\x18\x02 \x01(\x0b\x32*.temporal.api.query.v1.WorkflowQueryResult:\x02\x38\x01\x1a\x45\n\x0c\x43\x61pabilities\x12\x35\n-discard_speculative_workflow_task_with_events\x18\x01 \x01(\x08"\xf5\x01\n$RespondWorkflowTaskCompletedResponse\x12U\n\rworkflow_task\x18\x01 \x01(\x0b\x32>.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse\x12V\n\x0e\x61\x63tivity_tasks\x18\x02 \x03(\x0b\x32>.temporal.api.workflowservice.v1.PollActivityTaskQueueResponse\x12\x1e\n\x16reset_history_event_id\x18\x03 \x01(\x03"\x8d\x04\n RespondWorkflowTaskFailedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12=\n\x05\x63\x61use\x18\x02 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowTaskFailedCause\x12\x31\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x1b\n\x0f\x62inary_checksum\x18\x05 \x01(\tB\x02\x18\x01\x12\x11\n\tnamespace\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x0b \x01(\t\x12\x33\n\x08messages\x18\x07 \x03(\x0b\x32!.temporal.api.protocol.v1.Message\x12\x46\n\x0eworker_version\x18\x08 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\t \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\n \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"#\n!RespondWorkflowTaskFailedResponse"\xe6\x03\n\x1cPollActivityTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x17\n\x0fpoller_group_id\x18\n \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x08 \x01(\t\x12!\n\x19worker_control_task_queue\x18\t \x01(\t\x12I\n\x13task_queue_metadata\x18\x04 \x01(\x0b\x32,.temporal.api.taskqueue.v1.TaskQueueMetadata\x12Z\n\x1bworker_version_capabilities\x18\x05 \x01(\x0b\x32\x31.temporal.api.common.v1.WorkerVersionCapabilitiesB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x06 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptionsJ\x04\x08\x07\x10\x08R\x10worker_heartbeat"\x9d\t\n\x1dPollActivityTaskQueueResponse\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x1a\n\x12workflow_namespace\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x45\n\x12workflow_execution\x18\x04 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12;\n\ractivity_type\x18\x05 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x13\n\x0b\x61\x63tivity_id\x18\x06 \x01(\t\x12.\n\x06header\x18\x07 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12/\n\x05input\x18\x08 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12;\n\x11heartbeat_details\x18\t \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x32\n\x0escheduled_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x42\n\x1e\x63urrent_attempt_scheduled_time\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x0cstarted_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07\x61ttempt\x18\r \x01(\x05\x12<\n\x19schedule_to_close_timeout\x18\x0e \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\x0f \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\x10 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x11 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12Q\n\x17poller_scaling_decision\x18\x12 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.PollerScalingDecision\x12\x32\n\x08priority\x18\x13 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12\x17\n\x0f\x61\x63tivity_run_id\x18\x14 \x01(\t\x12J\n\x12poller_group_infos\x18\x15 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x16 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo"\xa5\x01\n"RecordActivityTaskHeartbeatRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\x05 \x01(\t"p\n#RecordActivityTaskHeartbeatResponse\x12\x18\n\x10\x63\x61ncel_requested\x18\x01 \x01(\x08\x12\x17\n\x0f\x61\x63tivity_paused\x18\x02 \x01(\x08\x12\x16\n\x0e\x61\x63tivity_reset\x18\x03 \x01(\x08"\xcf\x01\n&RecordActivityTaskHeartbeatByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"t\n\'RecordActivityTaskHeartbeatByIdResponse\x12\x18\n\x10\x63\x61ncel_requested\x18\x01 \x01(\x08\x12\x17\n\x0f\x61\x63tivity_paused\x18\x02 \x01(\x08\x12\x16\n\x0e\x61\x63tivity_reset\x18\x03 \x01(\x08"\xfe\x02\n#RespondActivityTaskCompletedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x30\n\x06result\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\x08 \x01(\t\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\x06 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x07 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"&\n$RespondActivityTaskCompletedResponse"\xcf\x01\n\'RespondActivityTaskCompletedByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x30\n\x06result\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"*\n(RespondActivityTaskCompletedByIdResponse"\xbe\x03\n RespondActivityTaskFailedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\t \x01(\t\x12@\n\x16last_heartbeat_details\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x46\n\x0eworker_version\x18\x06 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\x07 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x08 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"W\n!RespondActivityTaskFailedResponse\x12\x32\n\x08\x66\x61ilures\x18\x01 \x03(\x0b\x32 .temporal.api.failure.v1.Failure"\x8f\x02\n$RespondActivityTaskFailedByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x10\n\x08identity\x18\x06 \x01(\t\x12@\n\x16last_heartbeat_details\x18\x07 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x0bresource_id\x18\x08 \x01(\t"[\n%RespondActivityTaskFailedByIdResponse\x12\x32\n\x08\x66\x61ilures\x18\x01 \x03(\x0b\x32 .temporal.api.failure.v1.Failure"\xfe\x02\n"RespondActivityTaskCanceledRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x31\n\x07\x64\x65tails\x18\x02 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x11\n\tnamespace\x18\x04 \x01(\t\x12\x13\n\x0bresource_id\x18\x08 \x01(\t\x12\x46\n\x0eworker_version\x18\x05 \x01(\x0b\x32*.temporal.api.common.v1.WorkerVersionStampB\x02\x18\x01\x12>\n\ndeployment\x18\x06 \x01(\x0b\x32&.temporal.api.deployment.v1.DeploymentB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x07 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions"%\n#RespondActivityTaskCanceledResponse"\xa0\x02\n&RespondActivityTaskCanceledByIdRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x06 \x01(\t\x12O\n\x12\x64\x65ployment_options\x18\x07 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12\x13\n\x0bresource_id\x18\x08 \x01(\t")\n\'RespondActivityTaskCanceledByIdResponse"\x84\x02\n%RequestCancelWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t\x12+\n\x05links\x18\x07 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link"(\n&RequestCancelWorkflowExecutionResponse"\xde\x02\n\x1eSignalWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x13\n\x0bsignal_name\x18\x03 \x01(\t\x12/\n\x05input\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t\x12\x13\n\x07\x63ontrol\x18\x07 \x01(\tB\x02\x18\x01\x12.\n\x06header\x18\x08 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12+\n\x05links\x18\n \x03(\x0b\x32\x1c.temporal.api.common.v1.LinkJ\x04\x08\t\x10\n"M\n\x1fSignalWorkflowExecutionResponse\x12*\n\x04link\x18\x01 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xbb\n\n\'SignalWithStartWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12;\n\rworkflow_type\x18\x03 \x01(\x0b\x32$.temporal.api.common.v1.WorkflowType\x12\x38\n\ntask_queue\x18\x04 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12/\n\x05input\x18\x05 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12=\n\x1aworkflow_execution_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x10\n\x08identity\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t\x12N\n\x18workflow_id_reuse_policy\x18\x0b \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12T\n\x1bworkflow_id_conflict_policy\x18\x16 \x01(\x0e\x32/.temporal.api.enums.v1.WorkflowIdConflictPolicy\x12\x13\n\x0bsignal_name\x18\x0c \x01(\t\x12\x36\n\x0csignal_input\x18\r \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x13\n\x07\x63ontrol\x18\x0e \x01(\tB\x02\x18\x01\x12\x39\n\x0cretry_policy\x18\x0f \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\x10 \x01(\t\x12*\n\x04memo\x18\x11 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x12 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\x06header\x18\x13 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x37\n\x14workflow_start_delay\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\ruser_metadata\x18\x17 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12+\n\x05links\x18\x18 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12I\n\x13versioning_override\x18\x19 \x01(\x0b\x32,.temporal.api.workflow.v1.VersioningOverride\x12\x32\n\x08priority\x18\x1a \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12H\n\x14time_skipping_config\x18\x1b \x01(\x0b\x32*.temporal.api.common.v1.TimeSkippingConfigJ\x04\x08\x15\x10\x16"\x9e\x01\n(SignalWithStartWorkflowExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x04 \x01(\t\x12\x0f\n\x07started\x18\x02 \x01(\x08\x12\x31\n\x0bsignal_link\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xc1\x03\n\x1dResetWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12%\n\x1dworkflow_task_finish_event_id\x18\x04 \x01(\x03\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12G\n\x12reset_reapply_type\x18\x06 \x01(\x0e\x32\'.temporal.api.enums.v1.ResetReapplyTypeB\x02\x18\x01\x12S\n\x1breset_reapply_exclude_types\x18\x07 \x03(\x0e\x32..temporal.api.enums.v1.ResetReapplyExcludeType\x12K\n\x15post_reset_operations\x18\x08 \x03(\x0b\x32,.temporal.api.workflow.v1.PostResetOperation\x12\x10\n\x08identity\x18\t \x01(\t"0\n\x1eResetWorkflowExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t"\x9f\x02\n!TerminateWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x31\n\x07\x64\x65tails\x18\x04 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x1e\n\x16\x66irst_execution_run_id\x18\x06 \x01(\t\x12+\n\x05links\x18\x07 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link"$\n"TerminateWorkflowExecutionResponse"z\n\x1e\x44\x65leteWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"!\n\x1f\x44\x65leteWorkflowExecutionResponse"\xc9\x02\n!ListOpenWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11maximum_page_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x42\n\x11start_time_filter\x18\x04 \x01(\x0b\x32\'.temporal.api.filter.v1.StartTimeFilter\x12K\n\x10\x65xecution_filter\x18\x05 \x01(\x0b\x32/.temporal.api.filter.v1.WorkflowExecutionFilterH\x00\x12\x41\n\x0btype_filter\x18\x06 \x01(\x0b\x32*.temporal.api.filter.v1.WorkflowTypeFilterH\x00\x42\t\n\x07\x66ilters"\x82\x01\n"ListOpenWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\x8a\x03\n#ListClosedWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11maximum_page_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x42\n\x11start_time_filter\x18\x04 \x01(\x0b\x32\'.temporal.api.filter.v1.StartTimeFilter\x12K\n\x10\x65xecution_filter\x18\x05 \x01(\x0b\x32/.temporal.api.filter.v1.WorkflowExecutionFilterH\x00\x12\x41\n\x0btype_filter\x18\x06 \x01(\x0b\x32*.temporal.api.filter.v1.WorkflowTypeFilterH\x00\x12=\n\rstatus_filter\x18\x07 \x01(\x0b\x32$.temporal.api.filter.v1.StatusFilterH\x00\x42\t\n\x07\x66ilters"\x84\x01\n$ListClosedWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"m\n\x1dListWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"~\n\x1eListWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"u\n%ListArchivedWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"\x86\x01\n&ListArchivedWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"m\n\x1dScanWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"~\n\x1eScanWorkflowExecutionsResponse\x12\x43\n\nexecutions\x18\x01 \x03(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"B\n\x1e\x43ountWorkflowExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xed\x01\n\x1f\x43ountWorkflowExecutionsResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x61\n\x06groups\x18\x02 \x03(\x0b\x32Q.temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"\x1c\n\x1aGetSearchAttributesRequest"\xc9\x01\n\x1bGetSearchAttributesResponse\x12T\n\x04keys\x18\x01 \x03(\x0b\x32\x46.temporal.api.workflowservice.v1.GetSearchAttributesResponse.KeysEntry\x1aT\n\tKeysEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0e\x32\'.temporal.api.enums.v1.IndexedValueType:\x02\x38\x01"\xe9\x02\n RespondQueryTaskCompletedRequest\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12>\n\x0e\x63ompleted_type\x18\x02 \x01(\x0e\x32&.temporal.api.enums.v1.QueryResultType\x12\x36\n\x0cquery_result\x18\x03 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x15\n\rerror_message\x18\x04 \x01(\t\x12\x11\n\tnamespace\x18\x06 \x01(\t\x12\x31\n\x07\x66\x61ilure\x18\x07 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12=\n\x05\x63\x61use\x18\x08 \x01(\x0e\x32..temporal.api.enums.v1.WorkflowTaskFailedCause\x12\x17\n\x0fpoller_group_id\x18\t \x01(\tJ\x04\x08\x05\x10\x06"#\n!RespondQueryTaskCompletedResponse"n\n\x1bResetStickyTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"\x1e\n\x1cResetStickyTaskQueueResponse"\x9b\x02\n\x15ShutdownWorkerRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11sticky_task_queue\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x41\n\x10worker_heartbeat\x18\x05 \x01(\x0b\x32\'.temporal.api.worker.v1.WorkerHeartbeat\x12\x1b\n\x13worker_instance_key\x18\x06 \x01(\t\x12\x12\n\ntask_queue\x18\x07 \x01(\t\x12>\n\x10task_queue_types\x18\x08 \x03(\x0e\x32$.temporal.api.enums.v1.TaskQueueType"\x18\n\x16ShutdownWorkerResponse"\xe9\x01\n\x14QueryWorkflowRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x33\n\x05query\x18\x03 \x01(\x0b\x32$.temporal.api.query.v1.WorkflowQuery\x12K\n\x16query_reject_condition\x18\x04 \x01(\x0e\x32+.temporal.api.enums.v1.QueryRejectCondition"\xb9\x01\n\x15QueryWorkflowResponse\x12\x36\n\x0cquery_result\x18\x01 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12<\n\x0equery_rejected\x18\x02 \x01(\x0b\x32$.temporal.api.query.v1.QueryRejected\x12*\n\x04link\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"s\n DescribeWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution"\x99\x05\n!DescribeWorkflowExecutionResponse\x12K\n\x10\x65xecution_config\x18\x01 \x01(\x0b\x32\x31.temporal.api.workflow.v1.WorkflowExecutionConfig\x12P\n\x17workflow_execution_info\x18\x02 \x01(\x0b\x32/.temporal.api.workflow.v1.WorkflowExecutionInfo\x12I\n\x12pending_activities\x18\x03 \x03(\x0b\x32-.temporal.api.workflow.v1.PendingActivityInfo\x12M\n\x10pending_children\x18\x04 \x03(\x0b\x32\x33.temporal.api.workflow.v1.PendingChildExecutionInfo\x12P\n\x15pending_workflow_task\x18\x05 \x01(\x0b\x32\x31.temporal.api.workflow.v1.PendingWorkflowTaskInfo\x12\x39\n\tcallbacks\x18\x06 \x03(\x0b\x32&.temporal.api.workflow.v1.CallbackInfo\x12U\n\x18pending_nexus_operations\x18\x07 \x03(\x0b\x32\x33.temporal.api.workflow.v1.PendingNexusOperationInfo\x12W\n\x16workflow_extended_info\x18\x08 \x01(\x0b\x32\x37.temporal.api.workflow.v1.WorkflowExecutionExtendedInfo"\x90\x04\n\x18\x44\x65scribeTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12=\n\x0ftask_queue_type\x18\x03 \x01(\x0e\x32$.temporal.api.enums.v1.TaskQueueType\x12\x14\n\x0creport_stats\x18\x08 \x01(\x08\x12\x15\n\rreport_config\x18\x0b \x01(\x08\x12%\n\x19include_task_queue_status\x18\x04 \x01(\x08\x42\x02\x18\x01\x12\x42\n\x08\x61pi_mode\x18\x05 \x01(\x0e\x32,.temporal.api.enums.v1.DescribeTaskQueueModeB\x02\x18\x01\x12J\n\x08versions\x18\x06 \x01(\x0b\x32\x34.temporal.api.taskqueue.v1.TaskQueueVersionSelectionB\x02\x18\x01\x12\x42\n\x10task_queue_types\x18\x07 \x03(\x0e\x32$.temporal.api.enums.v1.TaskQueueTypeB\x02\x18\x01\x12\x1a\n\x0ereport_pollers\x18\t \x01(\x08\x42\x02\x18\x01\x12$\n\x18report_task_reachability\x18\n \x01(\x08\x42\x02\x18\x01"\xec\x07\n\x19\x44\x65scribeTaskQueueResponse\x12\x36\n\x07pollers\x18\x01 \x03(\x0b\x32%.temporal.api.taskqueue.v1.PollerInfo\x12\x38\n\x05stats\x18\x05 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats\x12q\n\x15stats_by_priority_key\x18\x08 \x03(\x0b\x32R.temporal.api.workflowservice.v1.DescribeTaskQueueResponse.StatsByPriorityKeyEntry\x12K\n\x0fversioning_info\x18\x04 \x01(\x0b\x32\x32.temporal.api.taskqueue.v1.TaskQueueVersioningInfo\x12:\n\x06\x63onfig\x18\x06 \x01(\x0b\x32*.temporal.api.taskqueue.v1.TaskQueueConfig\x12k\n\x14\x65\x66\x66\x65\x63tive_rate_limit\x18\x07 \x01(\x0b\x32M.temporal.api.workflowservice.v1.DescribeTaskQueueResponse.EffectiveRateLimit\x12I\n\x11task_queue_status\x18\x02 \x01(\x0b\x32*.temporal.api.taskqueue.v1.TaskQueueStatusB\x02\x18\x01\x12g\n\rversions_info\x18\x03 \x03(\x0b\x32L.temporal.api.workflowservice.v1.DescribeTaskQueueResponse.VersionsInfoEntryB\x02\x18\x01\x1a\x64\n\x17StatsByPriorityKeyEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats:\x02\x38\x01\x1at\n\x12\x45\x66\x66\x65\x63tiveRateLimit\x12\x1b\n\x13requests_per_second\x18\x01 \x01(\x02\x12\x41\n\x11rate_limit_source\x18\x02 \x01(\x0e\x32&.temporal.api.enums.v1.RateLimitSource\x1a\x64\n\x11VersionsInfoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.temporal.api.taskqueue.v1.TaskQueueVersionInfo:\x02\x38\x01"\x17\n\x15GetClusterInfoRequest"\xd1\x03\n\x16GetClusterInfoResponse\x12h\n\x11supported_clients\x18\x01 \x03(\x0b\x32M.temporal.api.workflowservice.v1.GetClusterInfoResponse.SupportedClientsEntry\x12\x16\n\x0eserver_version\x18\x02 \x01(\t\x12\x12\n\ncluster_id\x18\x03 \x01(\t\x12:\n\x0cversion_info\x18\x04 \x01(\x0b\x32$.temporal.api.version.v1.VersionInfo\x12\x14\n\x0c\x63luster_name\x18\x05 \x01(\t\x12\x1b\n\x13history_shard_count\x18\x06 \x01(\x05\x12\x19\n\x11persistence_store\x18\x07 \x01(\t\x12\x18\n\x10visibility_store\x18\x08 \x01(\t\x12 \n\x18initial_failover_version\x18\t \x01(\x03\x12"\n\x1a\x66\x61ilover_version_increment\x18\n \x01(\x03\x1a\x37\n\x15SupportedClientsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x16\n\x14GetSystemInfoRequest"\xc1\x04\n\x15GetSystemInfoResponse\x12\x16\n\x0eserver_version\x18\x01 \x01(\t\x12Y\n\x0c\x63\x61pabilities\x18\x02 \x01(\x0b\x32\x43.temporal.api.workflowservice.v1.GetSystemInfoResponse.Capabilities\x1a\xb4\x03\n\x0c\x43\x61pabilities\x12\x1f\n\x17signal_and_query_header\x18\x01 \x01(\x08\x12&\n\x1einternal_error_differentiation\x18\x02 \x01(\x08\x12*\n"activity_failure_include_heartbeat\x18\x03 \x01(\x08\x12\x1a\n\x12supports_schedules\x18\x04 \x01(\x08\x12"\n\x1a\x65ncoded_failure_attributes\x18\x05 \x01(\x08\x12!\n\x19\x62uild_id_based_versioning\x18\x06 \x01(\x08\x12\x13\n\x0bupsert_memo\x18\x07 \x01(\x08\x12\x1c\n\x14\x65\x61ger_workflow_start\x18\x08 \x01(\x08\x12\x14\n\x0csdk_metadata\x18\t \x01(\x08\x12\'\n\x1f\x63ount_group_by_execution_status\x18\n \x01(\x08\x12\r\n\x05nexus\x18\x0b \x01(\x08\x12!\n\x19server_scaled_deployments\x18\x0c \x01(\x08\x12(\n server_scaled_provider_cloud_run\x18\r \x01(\x08"m\n\x1eListTaskQueuePartitionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x02 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue"\xdf\x01\n\x1fListTaskQueuePartitionsResponse\x12]\n\x1e\x61\x63tivity_task_queue_partitions\x18\x01 \x03(\x0b\x32\x35.temporal.api.taskqueue.v1.TaskQueuePartitionMetadata\x12]\n\x1eworkflow_task_queue_partitions\x18\x02 \x03(\x0b\x32\x35.temporal.api.taskqueue.v1.TaskQueuePartitionMetadata"\xcc\x02\n\x15\x43reateScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x34\n\x08schedule\x18\x03 \x01(\x0b\x32".temporal.api.schedule.v1.Schedule\x12>\n\rinitial_patch\x18\x04 \x01(\x0b\x32\'.temporal.api.schedule.v1.SchedulePatch\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t\x12*\n\x04memo\x18\x07 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x08 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes"0\n\x16\x43reateScheduleResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c"A\n\x17\x44\x65scribeScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t"\x8f\x02\n\x18\x44\x65scribeScheduleResponse\x12\x34\n\x08schedule\x18\x01 \x01(\x0b\x32".temporal.api.schedule.v1.Schedule\x12\x34\n\x04info\x18\x02 \x01(\x0b\x32&.temporal.api.schedule.v1.ScheduleInfo\x12*\n\x04memo\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x04 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12\x16\n\x0e\x63onflict_token\x18\x05 \x01(\x0c"\xa4\x02\n\x15UpdateScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x34\n\x08schedule\x18\x03 \x01(\x0b\x32".temporal.api.schedule.v1.Schedule\x12\x16\n\x0e\x63onflict_token\x18\x04 \x01(\x0c\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t\x12\x43\n\x11search_attributes\x18\x07 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12*\n\x04memo\x18\x08 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\x18\n\x16UpdateScheduleResponse"\x9c\x01\n\x14PatchScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x36\n\x05patch\x18\x03 \x01(\x0b\x32\'.temporal.api.schedule.v1.SchedulePatch\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t"\x17\n\x15PatchScheduleResponse"\xa8\x01\n ListScheduleMatchingTimesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12.\n\nstart_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"S\n!ListScheduleMatchingTimesResponse\x12.\n\nstart_time\x18\x01 \x03(\x0b\x32\x1a.google.protobuf.Timestamp"Q\n\x15\x44\x65leteScheduleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bschedule_id\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t"\x18\n\x16\x44\x65leteScheduleResponse"l\n\x14ListSchedulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x19\n\x11maximum_page_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"p\n\x15ListSchedulesResponse\x12>\n\tschedules\x18\x01 \x03(\x0b\x32+.temporal.api.schedule.v1.ScheduleListEntry\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"9\n\x15\x43ountSchedulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xdb\x01\n\x16\x43ountSchedulesResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12X\n\x06groups\x18\x02 \x03(\x0b\x32H.temporal.api.workflowservice.v1.CountSchedulesResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"\x86\x05\n\'UpdateWorkerBuildIdCompatibilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12-\n#add_new_build_id_in_new_default_set\x18\x03 \x01(\tH\x00\x12\x87\x01\n\x1b\x61\x64\x64_new_compatible_build_id\x18\x04 \x01(\x0b\x32`.temporal.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityRequest.AddNewCompatibleVersionH\x00\x12!\n\x17promote_set_by_build_id\x18\x05 \x01(\tH\x00\x12%\n\x1bpromote_build_id_within_set\x18\x06 \x01(\tH\x00\x12h\n\nmerge_sets\x18\x07 \x01(\x0b\x32R.temporal.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityRequest.MergeSetsH\x00\x1ao\n\x17\x41\x64\x64NewCompatibleVersion\x12\x14\n\x0cnew_build_id\x18\x01 \x01(\t\x12$\n\x1c\x65xisting_compatible_build_id\x18\x02 \x01(\t\x12\x18\n\x10make_set_default\x18\x03 \x01(\x08\x1aI\n\tMergeSets\x12\x1c\n\x14primary_set_build_id\x18\x01 \x01(\t\x12\x1e\n\x16secondary_set_build_id\x18\x02 \x01(\tB\x0b\n\toperation"@\n(UpdateWorkerBuildIdCompatibilityResponseJ\x04\x08\x01\x10\x02R\x0eversion_set_id"_\n$GetWorkerBuildIdCompatibilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12\x10\n\x08max_sets\x18\x03 \x01(\x05"t\n%GetWorkerBuildIdCompatibilityResponse\x12K\n\x12major_version_sets\x18\x01 \x03(\x0b\x32/.temporal.api.taskqueue.v1.CompatibleVersionSet"\xb5\r\n"UpdateWorkerVersioningRulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12\x16\n\x0e\x63onflict_token\x18\x03 \x01(\x0c\x12\x81\x01\n\x16insert_assignment_rule\x18\x04 \x01(\x0b\x32_.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.InsertBuildIdAssignmentRuleH\x00\x12\x83\x01\n\x17replace_assignment_rule\x18\x05 \x01(\x0b\x32`.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.ReplaceBuildIdAssignmentRuleH\x00\x12\x81\x01\n\x16\x64\x65lete_assignment_rule\x18\x06 \x01(\x0b\x32_.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.DeleteBuildIdAssignmentRuleH\x00\x12\x8c\x01\n\x1c\x61\x64\x64_compatible_redirect_rule\x18\x07 \x01(\x0b\x32\x64.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.AddCompatibleBuildIdRedirectRuleH\x00\x12\x94\x01\n replace_compatible_redirect_rule\x18\x08 \x01(\x0b\x32h.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.ReplaceCompatibleBuildIdRedirectRuleH\x00\x12\x92\x01\n\x1f\x64\x65lete_compatible_redirect_rule\x18\t \x01(\x0b\x32g.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.DeleteCompatibleBuildIdRedirectRuleH\x00\x12l\n\x0f\x63ommit_build_id\x18\n \x01(\x0b\x32Q.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.CommitBuildIdH\x00\x1aq\n\x1bInsertBuildIdAssignmentRule\x12\x12\n\nrule_index\x18\x01 \x01(\x05\x12>\n\x04rule\x18\x02 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.BuildIdAssignmentRule\x1a\x81\x01\n\x1cReplaceBuildIdAssignmentRule\x12\x12\n\nrule_index\x18\x01 \x01(\x05\x12>\n\x04rule\x18\x02 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.BuildIdAssignmentRule\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\x1a@\n\x1b\x44\x65leteBuildIdAssignmentRule\x12\x12\n\nrule_index\x18\x01 \x01(\x05\x12\r\n\x05\x66orce\x18\x02 \x01(\x08\x1aj\n AddCompatibleBuildIdRedirectRule\x12\x46\n\x04rule\x18\x01 \x01(\x0b\x32\x38.temporal.api.taskqueue.v1.CompatibleBuildIdRedirectRule\x1an\n$ReplaceCompatibleBuildIdRedirectRule\x12\x46\n\x04rule\x18\x01 \x01(\x0b\x32\x38.temporal.api.taskqueue.v1.CompatibleBuildIdRedirectRule\x1a>\n#DeleteCompatibleBuildIdRedirectRule\x12\x17\n\x0fsource_build_id\x18\x01 \x01(\t\x1a\x37\n\rCommitBuildId\x12\x17\n\x0ftarget_build_id\x18\x01 \x01(\t\x12\r\n\x05\x66orce\x18\x02 \x01(\x08\x42\x0b\n\toperation"\xfc\x01\n#UpdateWorkerVersioningRulesResponse\x12U\n\x10\x61ssignment_rules\x18\x01 \x03(\x0b\x32;.temporal.api.taskqueue.v1.TimestampedBuildIdAssignmentRule\x12\x66\n\x19\x63ompatible_redirect_rules\x18\x02 \x03(\x0b\x32\x43.temporal.api.taskqueue.v1.TimestampedCompatibleBuildIdRedirectRule\x12\x16\n\x0e\x63onflict_token\x18\x03 \x01(\x0c"H\n\x1fGetWorkerVersioningRulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t"\xf9\x01\n GetWorkerVersioningRulesResponse\x12U\n\x10\x61ssignment_rules\x18\x01 \x03(\x0b\x32;.temporal.api.taskqueue.v1.TimestampedBuildIdAssignmentRule\x12\x66\n\x19\x63ompatible_redirect_rules\x18\x02 \x03(\x0b\x32\x43.temporal.api.taskqueue.v1.TimestampedCompatibleBuildIdRedirectRule\x12\x16\n\x0e\x63onflict_token\x18\x03 \x01(\x0c"\x9c\x01\n GetWorkerTaskReachabilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tbuild_ids\x18\x02 \x03(\t\x12\x13\n\x0btask_queues\x18\x03 \x03(\t\x12=\n\x0creachability\x18\x04 \x01(\x0e\x32\'.temporal.api.enums.v1.TaskReachability"r\n!GetWorkerTaskReachabilityResponse\x12M\n\x15\x62uild_id_reachability\x18\x01 \x03(\x0b\x32..temporal.api.taskqueue.v1.BuildIdReachability"\x85\x02\n\x1eUpdateWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x1e\n\x16\x66irst_execution_run_id\x18\x03 \x01(\t\x12\x37\n\x0bwait_policy\x18\x04 \x01(\x0b\x32".temporal.api.update.v1.WaitPolicy\x12\x30\n\x07request\x18\x05 \x01(\x0b\x32\x1f.temporal.api.update.v1.Request"\x83\x02\n\x1fUpdateWorkflowExecutionResponse\x12\x35\n\nupdate_ref\x18\x01 \x01(\x0b\x32!.temporal.api.update.v1.UpdateRef\x12\x30\n\x07outcome\x18\x02 \x01(\x0b\x32\x1f.temporal.api.update.v1.Outcome\x12K\n\x05stage\x18\x03 \x01(\x0e\x32<.temporal.api.enums.v1.UpdateWorkflowExecutionLifecycleStage\x12*\n\x04link\x18\x04 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xd6\n\n\x1aStartBatchOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x18\n\x10visibility_query\x18\x02 \x01(\t\x12\x0e\n\x06job_id\x18\x03 \x01(\t\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x41\n\nexecutions\x18\x05 \x03(\x0b\x32).temporal.api.common.v1.WorkflowExecutionB\x02\x18\x01\x12<\n\x11target_executions\x18\x16 \x03(\x0b\x32!.temporal.api.common.v1.Execution\x12!\n\x19max_operations_per_second\x18\x06 \x01(\x02\x12Q\n\x15termination_operation\x18\n \x01(\x0b\x32\x30.temporal.api.batch.v1.BatchOperationTerminationH\x00\x12G\n\x10signal_operation\x18\x0b \x01(\x0b\x32+.temporal.api.batch.v1.BatchOperationSignalH\x00\x12S\n\x16\x63\x61ncellation_operation\x18\x0c \x01(\x0b\x32\x31.temporal.api.batch.v1.BatchOperationCancellationH\x00\x12K\n\x12\x64\x65letion_operation\x18\r \x01(\x0b\x32-.temporal.api.batch.v1.BatchOperationDeletionH\x00\x12\x45\n\x0freset_operation\x18\x0e \x01(\x0b\x32*.temporal.api.batch.v1.BatchOperationResetH\x00\x12p\n!update_workflow_options_operation\x18\x0f \x01(\x0b\x32\x43.temporal.api.batch.v1.BatchOperationUpdateWorkflowExecutionOptionsH\x00\x12^\n\x1cunpause_activities_operation\x18\x10 \x01(\x0b\x32\x36.temporal.api.batch.v1.BatchOperationUnpauseActivitiesH\x00\x12Z\n\x1areset_activities_operation\x18\x11 \x01(\x0b\x32\x34.temporal.api.batch.v1.BatchOperationResetActivitiesH\x00\x12g\n!update_activity_options_operation\x18\x12 \x01(\x0b\x32:.temporal.api.batch.v1.BatchOperationUpdateActivityOptionsH\x00\x12\\\n\x1b\x63\x61ncel_activities_operation\x18\x13 \x01(\x0b\x32\x35.temporal.api.batch.v1.BatchOperationCancelActivitiesH\x00\x12\x62\n\x1eterminate_activities_operation\x18\x14 \x01(\x0b\x32\x38.temporal.api.batch.v1.BatchOperationTerminateActivitiesH\x00\x12\\\n\x1b\x64\x65lete_activities_operation\x18\x15 \x01(\x0b\x32\x35.temporal.api.batch.v1.BatchOperationDeleteActivitiesH\x00\x42\x0b\n\toperation"\x1d\n\x1bStartBatchOperationResponse"`\n\x19StopBatchOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t"\x1c\n\x1aStopBatchOperationResponse"B\n\x1d\x44\x65scribeBatchOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t"\xd8\x03\n\x1e\x44\x65scribeBatchOperationResponse\x12\x41\n\x0eoperation_type\x18\x01 \x01(\x0e\x32).temporal.api.enums.v1.BatchOperationType\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x39\n\x05state\x18\x03 \x01(\x0e\x32*.temporal.api.enums.v1.BatchOperationState\x12.\n\nstart_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nclose_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1d\n\x15total_operation_count\x18\x06 \x01(\x03\x12 \n\x18\x63omplete_operation_count\x18\x07 \x01(\x03\x12\x1f\n\x17\x66\x61ilure_operation_count\x18\x08 \x01(\x03\x12\x10\n\x08identity\x18\t \x01(\t\x12\x0e\n\x06reason\x18\n \x01(\t\x12\r\n\x05query\x18\x0b \x01(\t\x12\x35\n\nexecutions\x18\x0c \x03(\x0b\x32!.temporal.api.common.v1.Execution"[\n\x1aListBatchOperationsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c"y\n\x1bListBatchOperationsResponse\x12\x41\n\x0eoperation_info\x18\x01 \x03(\x0b\x32).temporal.api.batch.v1.BatchOperationInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xb9\x01\n"PollWorkflowExecutionUpdateRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x35\n\nupdate_ref\x18\x02 \x01(\x0b\x32!.temporal.api.update.v1.UpdateRef\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x37\n\x0bwait_policy\x18\x04 \x01(\x0b\x32".temporal.api.update.v1.WaitPolicy"\xdb\x01\n#PollWorkflowExecutionUpdateResponse\x12\x30\n\x07outcome\x18\x01 \x01(\x0b\x32\x1f.temporal.api.update.v1.Outcome\x12K\n\x05stage\x18\x02 \x01(\x0e\x32<.temporal.api.enums.v1.UpdateWorkflowExecutionLifecycleStage\x12\x35\n\nupdate_ref\x18\x03 \x01(\x0b\x32!.temporal.api.update.v1.UpdateRef"\xa0\x03\n\x19PollNexusTaskQueueRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x38\n\ntask_queue\x18\x03 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12\x17\n\x0fpoller_group_id\x18\t \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x08 \x01(\t\x12Z\n\x1bworker_version_capabilities\x18\x04 \x01(\x0b\x32\x31.temporal.api.common.v1.WorkerVersionCapabilitiesB\x02\x18\x01\x12O\n\x12\x64\x65ployment_options\x18\x06 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentOptions\x12\x41\n\x10worker_heartbeat\x18\x07 \x03(\x0b\x32\'.temporal.api.worker.v1.WorkerHeartbeat"\xe2\x02\n\x1aPollNexusTaskQueueResponse\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12/\n\x07request\x18\x02 \x01(\x0b\x32\x1e.temporal.api.nexus.v1.Request\x12Q\n\x17poller_scaling_decision\x18\x03 \x01(\x0b\x32\x30.temporal.api.taskqueue.v1.PollerScalingDecision\x12\x17\n\x0fpoller_group_id\x18\x04 \x01(\t\x12J\n\x12poller_group_infos\x18\x05 \x03(\x0b\x32*.temporal.api.taskqueue.v1.PollerGroupInfoB\x02\x18\x01\x12G\n\x12poller_groups_info\x18\x06 \x01(\x0b\x32+.temporal.api.taskqueue.v1.PollerGroupsInfo"\xa7\x01\n RespondNexusTaskCompletedRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\ntask_token\x18\x03 \x01(\x0c\x12\x31\n\x08response\x18\x04 \x01(\x0b\x32\x1f.temporal.api.nexus.v1.Response\x12\x17\n\x0fpoller_group_id\x18\x05 \x01(\t"#\n!RespondNexusTaskCompletedResponse"\xdc\x01\n\x1dRespondNexusTaskFailedRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\ntask_token\x18\x03 \x01(\x0c\x12\x36\n\x05\x65rror\x18\x04 \x01(\x0b\x32#.temporal.api.nexus.v1.HandlerErrorB\x02\x18\x01\x12\x31\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12\x17\n\x0fpoller_group_id\x18\x06 \x01(\t" \n\x1eRespondNexusTaskFailedResponse"\xf4\x02\n\x1c\x45xecuteMultiOperationRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12[\n\noperations\x18\x02 \x03(\x0b\x32G.temporal.api.workflowservice.v1.ExecuteMultiOperationRequest.Operation\x12\x13\n\x0bresource_id\x18\x03 \x01(\t\x1a\xce\x01\n\tOperation\x12X\n\x0estart_workflow\x18\x01 \x01(\x0b\x32>.temporal.api.workflowservice.v1.StartWorkflowExecutionRequestH\x00\x12Z\n\x0fupdate_workflow\x18\x02 \x01(\x0b\x32?.temporal.api.workflowservice.v1.UpdateWorkflowExecutionRequestH\x00\x42\x0b\n\toperation"\xcc\x02\n\x1d\x45xecuteMultiOperationResponse\x12Z\n\tresponses\x18\x01 \x03(\x0b\x32G.temporal.api.workflowservice.v1.ExecuteMultiOperationResponse.Response\x1a\xce\x01\n\x08Response\x12Y\n\x0estart_workflow\x18\x01 \x01(\x0b\x32?.temporal.api.workflowservice.v1.StartWorkflowExecutionResponseH\x00\x12[\n\x0fupdate_workflow\x18\x02 \x01(\x0b\x32@.temporal.api.workflowservice.v1.UpdateWorkflowExecutionResponseH\x00\x42\n\n\x08response"\xd0\x02\n\x1cUpdateActivityOptionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x43\n\x10\x61\x63tivity_options\x18\x04 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions\x12/\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x0c\n\x02id\x18\x06 \x01(\tH\x00\x12\x0e\n\x04type\x18\x07 \x01(\tH\x00\x12\x13\n\tmatch_all\x18\t \x01(\x08H\x00\x12\x18\n\x10restore_original\x18\x08 \x01(\x08\x42\n\n\x08\x61\x63tivity"\xbf\x02\n%UpdateActivityExecutionOptionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x43\n\x10\x61\x63tivity_options\x18\x06 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions\x12/\n\x0bupdate_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x18\n\x10restore_original\x18\x08 \x01(\x08\x12\x13\n\x0bresource_id\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t"d\n\x1dUpdateActivityOptionsResponse\x12\x43\n\x10\x61\x63tivity_options\x18\x01 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions"m\n&UpdateActivityExecutionOptionsResponse\x12\x43\n\x10\x61\x63tivity_options\x18\x01 \x01(\x0b\x32).temporal.api.activity.v1.ActivityOptions"\xc7\x01\n\x14PauseActivityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x0e\n\x04type\x18\x05 \x01(\tH\x00\x12\x0e\n\x06reason\x18\x06 \x01(\t\x12\x12\n\nrequest_id\x18\x07 \x01(\tB\n\n\x08\x61\x63tivity"\xb7\x01\n\x1dPauseActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t\x12\x13\n\x0bresource_id\x18\x07 \x01(\t\x12\x12\n\nrequest_id\x18\x08 \x01(\t"\x17\n\x15PauseActivityResponse" \n\x1ePauseActivityExecutionResponse"\x98\x02\n\x16UnpauseActivityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x0e\n\x04type\x18\x05 \x01(\tH\x00\x12\x15\n\x0bunpause_all\x18\x06 \x01(\x08H\x00\x12\x16\n\x0ereset_attempts\x18\x07 \x01(\x08\x12\x17\n\x0freset_heartbeat\x18\x08 \x01(\x08\x12)\n\x06jitter\x18\t \x01(\x0b\x32\x19.google.protobuf.DurationB\n\n\x08\x61\x63tivity"\x91\x02\n\x1fUnpauseActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x08 \x01(\t\x12)\n\x06jitter\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0bresource_id\x18\n \x01(\t\x12\x12\n\nrequest_id\x18\x0b \x01(\tJ\x04\x08\x06\x10\x07J\x04\x08\x07\x10\x08R\x0ereset_attemptsR\x0freset_heartbeat"\x19\n\x17UnpauseActivityResponse""\n UnpauseActivityExecutionResponse"\xb3\x02\n\x14ResetActivityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x0e\n\x04type\x18\x05 \x01(\tH\x00\x12\x13\n\tmatch_all\x18\n \x01(\x08H\x00\x12\x17\n\x0freset_heartbeat\x18\x06 \x01(\x08\x12\x13\n\x0bkeep_paused\x18\x07 \x01(\x08\x12)\n\x06jitter\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12 \n\x18restore_original_options\x18\t \x01(\x08\x42\n\n\x08\x61\x63tivity"\xa2\x02\n\x1dResetActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x0e\n\x06run_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x13\n\x0bkeep_paused\x18\x06 \x01(\x08\x12)\n\x06jitter\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12 \n\x18restore_original_options\x18\x08 \x01(\x08\x12\x13\n\x0bresource_id\x18\t \x01(\t\x12\x12\n\nrequest_id\x18\n \x01(\t\x12\x17\n\x0freset_heartbeat\x18\x0b \x01(\x08"\x17\n\x15ResetActivityResponse" \n\x1eResetActivityExecutionResponse"\x9c\x02\n%UpdateWorkflowExecutionOptionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12V\n\x1aworkflow_execution_options\x18\x03 \x01(\x0b\x32\x32.temporal.api.workflow.v1.WorkflowExecutionOptions\x12/\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x10\n\x08identity\x18\x05 \x01(\t"\xb1\x01\n&UpdateWorkflowExecutionOptionsResponse\x12V\n\x1aworkflow_execution_options\x18\x01 \x01(\x0b\x32\x32.temporal.api.workflow.v1.WorkflowExecutionOptions\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"j\n\x19\x44\x65scribeDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12:\n\ndeployment\x18\x02 \x01(\x0b\x32&.temporal.api.deployment.v1.Deployment"a\n\x1a\x44\x65scribeDeploymentResponse\x12\x43\n\x0f\x64\x65ployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo"\xc2\x01\n&DescribeWorkerDeploymentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x07version\x18\x02 \x01(\tB\x02\x18\x01\x12O\n\x12\x64\x65ployment_version\x18\x03 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x1f\n\x17report_task_queue_stats\x18\x04 \x01(\x08"\x8c\x05\n\'DescribeWorkerDeploymentVersionResponse\x12_\n\x1eworker_deployment_version_info\x18\x01 \x01(\x0b\x32\x37.temporal.api.deployment.v1.WorkerDeploymentVersionInfo\x12v\n\x13version_task_queues\x18\x02 \x03(\x0b\x32Y.temporal.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse.VersionTaskQueue\x1a\x87\x03\n\x10VersionTaskQueue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x32\n\x04type\x18\x02 \x01(\x0e\x32$.temporal.api.enums.v1.TaskQueueType\x12\x38\n\x05stats\x18\x03 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats\x12\x90\x01\n\x15stats_by_priority_key\x18\x04 \x03(\x0b\x32q.temporal.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse.VersionTaskQueue.StatsByPriorityKeyEntry\x1a\x64\n\x17StatsByPriorityKeyEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).temporal.api.taskqueue.v1.TaskQueueStats:\x02\x38\x01"M\n\x1f\x44\x65scribeWorkerDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t"\x8c\x01\n DescribeWorkerDeploymentResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12P\n\x16worker_deployment_info\x18\x02 \x01(\x0b\x32\x30.temporal.api.deployment.v1.WorkerDeploymentInfo"l\n\x16ListDeploymentsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\x13\n\x0bseries_name\x18\x04 \x01(\t"w\n\x17ListDeploymentsResponse\x12\x17\n\x0fnext_page_token\x18\x01 \x01(\x0c\x12\x43\n\x0b\x64\x65ployments\x18\x02 \x03(\x0b\x32..temporal.api.deployment.v1.DeploymentListInfo"\xcd\x01\n\x1bSetCurrentDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12:\n\ndeployment\x18\x02 \x01(\x0b\x32&.temporal.api.deployment.v1.Deployment\x12\x10\n\x08identity\x18\x03 \x01(\t\x12M\n\x0fupdate_metadata\x18\x04 \x01(\x0b\x32\x34.temporal.api.deployment.v1.UpdateDeploymentMetadata"\xb9\x01\n\x1cSetCurrentDeploymentResponse\x12K\n\x17\x63urrent_deployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo\x12L\n\x18previous_deployment_info\x18\x02 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo"\xe5\x01\n(SetWorkerDeploymentCurrentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x13\n\x07version\x18\x03 \x01(\tB\x02\x18\x01\x12\x10\n\x08\x62uild_id\x18\x07 \x01(\t\x12\x16\n\x0e\x63onflict_token\x18\x04 \x01(\x0c\x12\x10\n\x08identity\x18\x05 \x01(\t\x12"\n\x1aignore_missing_task_queues\x18\x06 \x01(\x08\x12\x18\n\x10\x61llow_no_pollers\x18\t \x01(\x08"\xbf\x01\n)SetWorkerDeploymentCurrentVersionResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12\x1c\n\x10previous_version\x18\x02 \x01(\tB\x02\x18\x01\x12\\\n\x1bprevious_deployment_version\x18\x03 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersionB\x02\x18\x01"\xf9\x01\n(SetWorkerDeploymentRampingVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x13\n\x07version\x18\x03 \x01(\tB\x02\x18\x01\x12\x10\n\x08\x62uild_id\x18\x08 \x01(\t\x12\x12\n\npercentage\x18\x04 \x01(\x02\x12\x16\n\x0e\x63onflict_token\x18\x05 \x01(\x0c\x12\x10\n\x08identity\x18\x06 \x01(\t\x12"\n\x1aignore_missing_task_queues\x18\x07 \x01(\x08\x12\x18\n\x10\x61llow_no_pollers\x18\n \x01(\x08"\xe0\x01\n)SetWorkerDeploymentRampingVersionResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12\x1c\n\x10previous_version\x18\x02 \x01(\tB\x02\x18\x01\x12\\\n\x1bprevious_deployment_version\x18\x04 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersionB\x02\x18\x01\x12\x1f\n\x13previous_percentage\x18\x03 \x01(\x02\x42\x02\x18\x01"q\n\x1d\x43reateWorkerDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t"8\n\x1e\x43reateWorkerDeploymentResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c"]\n\x1cListWorkerDeploymentsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c"\x9f\x05\n\x1dListWorkerDeploymentsResponse\x12\x17\n\x0fnext_page_token\x18\x01 \x01(\x0c\x12r\n\x12worker_deployments\x18\x02 \x03(\x0b\x32V.temporal.api.workflowservice.v1.ListWorkerDeploymentsResponse.WorkerDeploymentSummary\x1a\xf0\x03\n\x17WorkerDeploymentSummary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x41\n\x0erouting_config\x18\x03 \x01(\x0b\x32).temporal.api.deployment.v1.RoutingConfig\x12o\n\x16latest_version_summary\x18\x04 \x01(\x0b\x32O.temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary\x12p\n\x17\x63urrent_version_summary\x18\x05 \x01(\x0b\x32O.temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary\x12p\n\x17ramping_version_summary\x18\x06 \x01(\x0b\x32O.temporal.api.deployment.v1.WorkerDeploymentInfo.WorkerDeploymentVersionSummary"\xf0\x01\n$CreateWorkerDeploymentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x02 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12>\n\x0e\x63ompute_config\x18\x04 \x01(\x0b\x32&.temporal.api.compute.v1.ComputeConfig\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t"\'\n%CreateWorkerDeploymentVersionResponse"\xc8\x01\n$DeleteWorkerDeploymentVersionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x07version\x18\x02 \x01(\tB\x02\x18\x01\x12O\n\x12\x64\x65ployment_version\x18\x05 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x15\n\rskip_drainage\x18\x03 \x01(\x08\x12\x10\n\x08identity\x18\x04 \x01(\t"\'\n%DeleteWorkerDeploymentVersionResponse"]\n\x1d\x44\x65leteWorkerDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x10\n\x08identity\x18\x03 \x01(\t" \n\x1e\x44\x65leteWorkerDeploymentResponse"\x84\x04\n1UpdateWorkerDeploymentVersionComputeConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x02 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x99\x01\n\x1d\x63ompute_config_scaling_groups\x18\x06 \x03(\x0b\x32r.temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionComputeConfigRequest.ComputeConfigScalingGroupsEntry\x12,\n$remove_compute_config_scaling_groups\x18\x07 \x03(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x1a{\n\x1f\x43omputeConfigScalingGroupsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.temporal.api.compute.v1.ComputeConfigScalingGroupUpdate:\x02\x38\x01"4\n2UpdateWorkerDeploymentVersionComputeConfigResponse"\xf4\x03\n3ValidateWorkerDeploymentVersionComputeConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12O\n\x12\x64\x65ployment_version\x18\x02 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12\x9b\x01\n\x1d\x63ompute_config_scaling_groups\x18\x06 \x03(\x0b\x32t.temporal.api.workflowservice.v1.ValidateWorkerDeploymentVersionComputeConfigRequest.ComputeConfigScalingGroupsEntry\x12,\n$remove_compute_config_scaling_groups\x18\x07 \x03(\t\x12\x10\n\x08identity\x18\x03 \x01(\t\x1a{\n\x1f\x43omputeConfigScalingGroupsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.temporal.api.compute.v1.ComputeConfigScalingGroupUpdate:\x02\x38\x01"6\n4ValidateWorkerDeploymentVersionComputeConfigResponse"\xa2\x03\n,UpdateWorkerDeploymentVersionMetadataRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x07version\x18\x02 \x01(\tB\x02\x18\x01\x12O\n\x12\x64\x65ployment_version\x18\x05 \x01(\x0b\x32\x33.temporal.api.deployment.v1.WorkerDeploymentVersion\x12x\n\x0eupsert_entries\x18\x03 \x03(\x0b\x32`.temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataRequest.UpsertEntriesEntry\x12\x16\n\x0eremove_entries\x18\x04 \x03(\t\x12\x10\n\x08identity\x18\x06 \x01(\t\x1aU\n\x12UpsertEntriesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"n\n-UpdateWorkerDeploymentVersionMetadataResponse\x12=\n\x08metadata\x18\x01 \x01(\x0b\x32+.temporal.api.deployment.v1.VersionMetadata"\xbd\x01\n!SetWorkerDeploymentManagerRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0f\x64\x65ployment_name\x18\x02 \x01(\t\x12\x1a\n\x10manager_identity\x18\x03 \x01(\tH\x00\x12\x0e\n\x04self\x18\x04 \x01(\x08H\x00\x12\x16\n\x0e\x63onflict_token\x18\x05 \x01(\x0c\x12\x10\n\x08identity\x18\x06 \x01(\tB\x16\n\x14new_manager_identity"c\n"SetWorkerDeploymentManagerResponse\x12\x16\n\x0e\x63onflict_token\x18\x01 \x01(\x0c\x12%\n\x19previous_manager_identity\x18\x02 \x01(\tB\x02\x18\x01"E\n\x1bGetCurrentDeploymentRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bseries_name\x18\x02 \x01(\t"k\n\x1cGetCurrentDeploymentResponse\x12K\n\x17\x63urrent_deployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo"q\n GetDeploymentReachabilityRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12:\n\ndeployment\x18\x02 \x01(\x0b\x32&.temporal.api.deployment.v1.Deployment"\xe3\x01\n!GetDeploymentReachabilityResponse\x12\x43\n\x0f\x64\x65ployment_info\x18\x01 \x01(\x0b\x32*.temporal.api.deployment.v1.DeploymentInfo\x12\x43\n\x0creachability\x18\x02 \x01(\x0e\x32-.temporal.api.enums.v1.DeploymentReachability\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb4\x01\n\x19\x43reateWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x35\n\x04spec\x18\x02 \x01(\x0b\x32\'.temporal.api.rules.v1.WorkflowRuleSpec\x12\x12\n\nforce_scan\x18\x03 \x01(\x08\x12\x12\n\nrequest_id\x18\x04 \x01(\t\x12\x10\n\x08identity\x18\x05 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x06 \x01(\t"_\n\x1a\x43reateWorkflowRuleResponse\x12\x31\n\x04rule\x18\x01 \x01(\x0b\x32#.temporal.api.rules.v1.WorkflowRule\x12\x0e\n\x06job_id\x18\x02 \x01(\t"A\n\x1b\x44\x65scribeWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0f\n\x07rule_id\x18\x02 \x01(\t"Q\n\x1c\x44\x65scribeWorkflowRuleResponse\x12\x31\n\x04rule\x18\x01 \x01(\x0b\x32#.temporal.api.rules.v1.WorkflowRule"?\n\x19\x44\x65leteWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x0f\n\x07rule_id\x18\x02 \x01(\t"\x1c\n\x1a\x44\x65leteWorkflowRuleResponse"F\n\x18ListWorkflowRulesRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"h\n\x19ListWorkflowRulesResponse\x12\x32\n\x05rules\x18\x01 \x03(\x0b\x32#.temporal.api.rules.v1.WorkflowRule\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xce\x01\n\x1aTriggerWorkflowRuleRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12<\n\texecution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x0c\n\x02id\x18\x04 \x01(\tH\x00\x12\x37\n\x04spec\x18\x05 \x01(\x0b\x32\'.temporal.api.rules.v1.WorkflowRuleSpecH\x00\x12\x10\n\x08identity\x18\x03 \x01(\tB\x06\n\x04rule".\n\x1bTriggerWorkflowRuleResponse\x12\x0f\n\x07\x61pplied\x18\x01 \x01(\x08"\x9b\x01\n\x1cRecordWorkerHeartbeatRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x41\n\x10worker_heartbeat\x18\x03 \x03(\x0b\x32\'.temporal.api.worker.v1.WorkerHeartbeat\x12\x13\n\x0bresource_id\x18\x04 \x01(\t"\x1f\n\x1dRecordWorkerHeartbeatResponse"\x82\x01\n\x12ListWorkersRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t\x12\x1e\n\x16include_system_workers\x18\x05 \x01(\x08"\xa5\x01\n\x13ListWorkersResponse\x12<\n\x0cworkers_info\x18\x01 \x03(\x0b\x32".temporal.api.worker.v1.WorkerInfoB\x02\x18\x01\x12\x37\n\x07workers\x18\x03 \x03(\x0b\x32&.temporal.api.worker.v1.WorkerListInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xd5\x05\n\x1cUpdateTaskQueueConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\ntask_queue\x18\x03 \x01(\t\x12=\n\x0ftask_queue_type\x18\x04 \x01(\x0e\x32$.temporal.api.enums.v1.TaskQueueType\x12n\n\x17update_queue_rate_limit\x18\x05 \x01(\x0b\x32M.temporal.api.workflowservice.v1.UpdateTaskQueueConfigRequest.RateLimitUpdate\x12}\n&update_fairness_key_rate_limit_default\x18\x06 \x01(\x0b\x32M.temporal.api.workflowservice.v1.UpdateTaskQueueConfigRequest.RateLimitUpdate\x12\x84\x01\n\x1dset_fairness_weight_overrides\x18\x07 \x03(\x0b\x32].temporal.api.workflowservice.v1.UpdateTaskQueueConfigRequest.SetFairnessWeightOverridesEntry\x12\'\n\x1funset_fairness_weight_overrides\x18\x08 \x03(\t\x1a[\n\x0fRateLimitUpdate\x12\x38\n\nrate_limit\x18\x01 \x01(\x0b\x32$.temporal.api.taskqueue.v1.RateLimit\x12\x0e\n\x06reason\x18\x02 \x01(\t\x1a\x41\n\x1fSetFairnessWeightOverridesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02:\x02\x38\x01"[\n\x1dUpdateTaskQueueConfigResponse\x12:\n\x06\x63onfig\x18\x01 \x01(\x0b\x32*.temporal.api.taskqueue.v1.TaskQueueConfig"\x9e\x01\n\x18\x46\x65tchWorkerConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x38\n\x08selector\x18\x06 \x01(\x0b\x32&.temporal.api.common.v1.WorkerSelector\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"U\n\x19\x46\x65tchWorkerConfigResponse\x12\x38\n\rworker_config\x18\x01 \x01(\x0b\x32!.temporal.api.sdk.v1.WorkerConfig"\x8a\x02\n\x19UpdateWorkerConfigRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x38\n\rworker_config\x18\x04 \x01(\x0b\x32!.temporal.api.sdk.v1.WorkerConfig\x12/\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x38\n\x08selector\x18\x06 \x01(\x0b\x32&.temporal.api.common.v1.WorkerSelector\x12\x13\n\x0bresource_id\x18\x07 \x01(\t"d\n\x1aUpdateWorkerConfigResponse\x12:\n\rworker_config\x18\x01 \x01(\x0b\x32!.temporal.api.sdk.v1.WorkerConfigH\x00\x42\n\n\x08response"G\n\x15\x44\x65scribeWorkerRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x1b\n\x13worker_instance_key\x18\x02 \x01(\t"Q\n\x16\x44\x65scribeWorkerResponse\x12\x37\n\x0bworker_info\x18\x01 \x01(\x0b\x32".temporal.api.worker.v1.WorkerInfo"W\n\x13\x43ountWorkersRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t\x12\x1e\n\x16include_system_workers\x18\x03 \x01(\x08"%\n\x14\x43ountWorkersResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03"\x8d\x01\n\x1dPauseWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x0e\n\x06reason\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t" \n\x1ePauseWorkflowExecutionResponse"\x8f\x01\n\x1fUnpauseWorkflowExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x0e\n\x06reason\x18\x05 \x01(\t\x12\x12\n\nrequest_id\x18\x06 \x01(\t""\n UnpauseWorkflowExecutionResponse"\x99\t\n\x1dStartActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x04 \x01(\t\x12;\n\ractivity_type\x18\x05 \x01(\x0b\x32$.temporal.api.common.v1.ActivityType\x12\x38\n\ntask_queue\x18\x06 \x01(\x0b\x32$.temporal.api.taskqueue.v1.TaskQueue\x12<\n\x19schedule_to_close_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0b \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12/\n\x05input\x18\x0c \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x45\n\x0fid_reuse_policy\x18\r \x01(\x0e\x32,.temporal.api.enums.v1.ActivityIdReusePolicy\x12K\n\x12id_conflict_policy\x18\x0e \x01(\x0e\x32/.temporal.api.enums.v1.ActivityIdConflictPolicy\x12\x43\n\x11search_attributes\x18\x0f \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\x06header\x18\x10 \x01(\x0b\x32\x1e.temporal.api.common.v1.Header\x12\x38\n\ruser_metadata\x18\x11 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12\x32\n\x08priority\x18\x12 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x12>\n\x14\x63ompletion_callbacks\x18\x13 \x03(\x0b\x32 .temporal.api.common.v1.Callback\x12+\n\x05links\x18\x14 \x03(\x0b\x32\x1c.temporal.api.common.v1.Link\x12\x46\n\x13on_conflict_options\x18\x15 \x01(\x0b\x32).temporal.api.common.v1.OnConflictOptions\x12.\n\x0bstart_delay\x18\x16 \x01(\x0b\x32\x19.google.protobuf.Duration"m\n\x1eStartActivityExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x0f\n\x07started\x18\x02 \x01(\x08\x12*\n\x04link\x18\x03 \x01(\x0b\x32\x1c.temporal.api.common.v1.Link"\xe4\x01\n DescribeActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x15\n\rinclude_input\x18\x04 \x01(\x08\x12\x17\n\x0finclude_outcome\x18\x05 \x01(\x08\x12\x17\n\x0flong_poll_token\x18\x06 \x01(\x0c\x12!\n\x19include_heartbeat_details\x18\x07 \x01(\x08\x12\x1c\n\x14include_last_failure\x18\x08 \x01(\x08"\xbc\x02\n!DescribeActivityExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12=\n\x04info\x18\x02 \x01(\x0b\x32/.temporal.api.activity.v1.ActivityExecutionInfo\x12/\n\x05input\x18\x03 \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x43\n\x07outcome\x18\x04 \x01(\x0b\x32\x32.temporal.api.activity.v1.ActivityExecutionOutcome\x12\x17\n\x0flong_poll_token\x18\x05 \x01(\x0c\x12\x39\n\tcallbacks\x18\x06 \x03(\x0b\x32&.temporal.api.activity.v1.CallbackInfo"V\n\x1cPollActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t"t\n\x1dPollActivityExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x43\n\x07outcome\x18\x02 \x01(\x0b\x32\x32.temporal.api.activity.v1.ActivityExecutionOutcome"m\n\x1dListActivityExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"\x82\x01\n\x1eListActivityExecutionsResponse\x12G\n\nexecutions\x18\x01 \x03(\x0b\x32\x33.temporal.api.activity.v1.ActivityExecutionListInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"\xd1\x06\n#StartNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x10\n\x08identity\x18\x02 \x01(\t\x12\x12\n\nrequest_id\x18\x03 \x01(\t\x12\x14\n\x0coperation_id\x18\x04 \x01(\t\x12\x10\n\x08\x65ndpoint\x18\x05 \x01(\t\x12\x0f\n\x07service\x18\x06 \x01(\t\x12\x11\n\toperation\x18\x07 \x01(\t\x12<\n\x19schedule_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12.\n\x05input\x18\x0b \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12K\n\x0fid_reuse_policy\x18\x0c \x01(\x0e\x32\x32.temporal.api.enums.v1.NexusOperationIdReusePolicy\x12Q\n\x12id_conflict_policy\x18\r \x01(\x0e\x32\x35.temporal.api.enums.v1.NexusOperationIdConflictPolicy\x12\x43\n\x11search_attributes\x18\x0e \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12k\n\x0cnexus_header\x18\x0f \x03(\x0b\x32U.temporal.api.workflowservice.v1.StartNexusOperationExecutionRequest.NexusHeaderEntry\x12\x38\n\ruser_metadata\x18\x10 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"G\n$StartNexusOperationExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x0f\n\x07started\x18\x02 \x01(\x08"\xaa\x01\n&DescribeNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x15\n\rinclude_input\x18\x04 \x01(\x08\x12\x17\n\x0finclude_outcome\x18\x05 \x01(\x08\x12\x17\n\x0flong_poll_token\x18\x06 \x01(\x0c"\xb7\x02\n\'DescribeNexusOperationExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12@\n\x04info\x18\x02 \x01(\x0b\x32\x32.temporal.api.nexus.v1.NexusOperationExecutionInfo\x12.\n\x05input\x18\x03 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x31\n\x06result\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x12\x33\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x12\x17\n\x0flong_poll_token\x18\x06 \x01(\x0c\x42\t\n\x07outcome"\xa1\x01\n"PollNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x42\n\nwait_stage\x18\x04 \x01(\x0e\x32..temporal.api.enums.v1.NexusOperationWaitStage"\x85\x02\n#PollNexusOperationExecutionResponse\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x42\n\nwait_stage\x18\x02 \x01(\x0e\x32..temporal.api.enums.v1.NexusOperationWaitStage\x12\x17\n\x0foperation_token\x18\x03 \x01(\t\x12\x31\n\x06result\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x12\x33\n\x07\x66\x61ilure\x18\x05 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\t\n\x07outcome"s\n#ListNexusOperationExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\x0c\x12\r\n\x05query\x18\x04 \x01(\t"\x8b\x01\n$ListNexusOperationExecutionsResponse\x12J\n\noperations\x18\x01 \x03(\x0b\x32\x36.temporal.api.nexus.v1.NexusOperationExecutionListInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\x0c"B\n\x1e\x43ountActivityExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xed\x01\n\x1f\x43ountActivityExecutionsResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x61\n\x06groups\x18\x02 \x03(\x0b\x32Q.temporal.api.workflowservice.v1.CountActivityExecutionsResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"H\n$CountNexusOperationExecutionsRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\r\n\x05query\x18\x02 \x01(\t"\xf9\x01\n%CountNexusOperationExecutionsResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12g\n\x06groups\x18\x02 \x03(\x0b\x32W.temporal.api.workflowservice.v1.CountNexusOperationExecutionsResponse.AggregationGroup\x1aX\n\x10\x41ggregationGroup\x12\x35\n\x0cgroup_values\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\r\n\x05\x63ount\x18\x02 \x01(\x03"\x95\x01\n%RequestCancelActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t"(\n&RequestCancelActivityExecutionResponse"\x91\x01\n!TerminateActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t"$\n"TerminateActivityExecutionResponse"X\n\x1e\x44\x65leteActivityExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t"!\n\x1f\x44\x65leteActivityExecutionResponse"\x9c\x01\n+RequestCancelNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t".\n,RequestCancelNexusOperationExecutionResponse"\x98\x01\n\'TerminateNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t\x12\x10\n\x08identity\x18\x04 \x01(\t\x12\x12\n\nrequest_id\x18\x05 \x01(\t\x12\x0e\n\x06reason\x18\x06 \x01(\t"*\n(TerminateNexusOperationExecutionResponse"_\n$DeleteNexusOperationExecutionRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x14\n\x0coperation_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\t"\'\n%DeleteNexusOperationExecutionResponse"\x9d\x01\n(PollWorkflowExecutionTimeSkippingRequest\x12\x11\n\tnamespace\x18\x01 \x01(\t\x12\x45\n\x12workflow_execution\x18\x02 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x17\n\x0f\x66\x61st_forward_id\x18\x03 \x01(\t"\xe8\x01\n)PollWorkflowExecutionTimeSkippingResponse\x12T\n\x1b\x66\x61st_forward_polling_result\x18\x01 \x01(\x0e\x32/.temporal.api.enums.v1.FastForwardPollingResult\x12\x15\n\rfailed_reason\x18\x02 \x01(\t\x12N\n\x11\x66\x61st_forward_info\x18\x03 \x01(\x0b\x32\x33.temporal.api.common.v1.TimeSkippingFastForwardInfoB\xbe\x01\n"io.temporal.api.workflowservice.v1B\x14RequestResponseProtoP\x01Z5go.temporal.io/api/workflowservice/v1;workflowservice\xaa\x02!Temporalio.Api.WorkflowService.V1\xea\x02$Temporalio::Api::WorkflowService::V1b\x06proto3' ) @@ -4214,578 +4217,578 @@ _UPDATETASKQUEUECONFIGREQUEST_SETFAIRNESSWEIGHTOVERRIDESENTRY._serialized_options = b"8\001" _STARTNEXUSOPERATIONEXECUTIONREQUEST_NEXUSHEADERENTRY._options = None _STARTNEXUSOPERATIONEXECUTIONREQUEST_NEXUSHEADERENTRY._serialized_options = b"8\001" - _REGISTERNAMESPACEREQUEST._serialized_start = 1646 - _REGISTERNAMESPACEREQUEST._serialized_end = 2294 - _REGISTERNAMESPACEREQUEST_DATAENTRY._serialized_start = 2251 - _REGISTERNAMESPACEREQUEST_DATAENTRY._serialized_end = 2294 - _REGISTERNAMESPACERESPONSE._serialized_start = 2296 - _REGISTERNAMESPACERESPONSE._serialized_end = 2323 - _LISTNAMESPACESREQUEST._serialized_start = 2326 - _LISTNAMESPACESREQUEST._serialized_end = 2463 - _LISTNAMESPACESRESPONSE._serialized_start = 2466 - _LISTNAMESPACESRESPONSE._serialized_end = 2595 - _DESCRIBENAMESPACEREQUEST._serialized_start = 2597 - _DESCRIBENAMESPACEREQUEST._serialized_end = 2680 - _DESCRIBENAMESPACERESPONSE._serialized_start = 2683 - _DESCRIBENAMESPACERESPONSE._serialized_end = 3196 - _UPDATENAMESPACEREQUEST._serialized_start = 3199 - _UPDATENAMESPACEREQUEST._serialized_end = 3534 - _UPDATENAMESPACERESPONSE._serialized_start = 3537 - _UPDATENAMESPACERESPONSE._serialized_end = 3828 - _DEPRECATENAMESPACEREQUEST._serialized_start = 3830 - _DEPRECATENAMESPACEREQUEST._serialized_end = 3900 - _DEPRECATENAMESPACERESPONSE._serialized_start = 3902 - _DEPRECATENAMESPACERESPONSE._serialized_end = 3930 - _STARTWORKFLOWEXECUTIONREQUEST._serialized_start = 3933 - _STARTWORKFLOWEXECUTIONREQUEST._serialized_end = 5550 - _STARTWORKFLOWEXECUTIONRESPONSE._serialized_start = 5553 - _STARTWORKFLOWEXECUTIONRESPONSE._serialized_end = 5851 - _GETWORKFLOWEXECUTIONHISTORYREQUEST._serialized_start = 5854 - _GETWORKFLOWEXECUTIONHISTORYREQUEST._serialized_end = 6152 - _GETWORKFLOWEXECUTIONHISTORYRESPONSE._serialized_start = 6155 - _GETWORKFLOWEXECUTIONHISTORYRESPONSE._serialized_end = 6341 - _GETWORKFLOWEXECUTIONHISTORYREVERSEREQUEST._serialized_start = 6344 - _GETWORKFLOWEXECUTIONHISTORYREVERSEREQUEST._serialized_end = 6520 - _GETWORKFLOWEXECUTIONHISTORYREVERSERESPONSE._serialized_start = 6522 - _GETWORKFLOWEXECUTIONHISTORYREVERSERESPONSE._serialized_end = 6642 - _POLLWORKFLOWTASKQUEUEREQUEST._serialized_start = 6645 - _POLLWORKFLOWTASKQUEUEREQUEST._serialized_end = 7085 - _POLLWORKFLOWTASKQUEUERESPONSE._serialized_start = 7088 - _POLLWORKFLOWTASKQUEUERESPONSE._serialized_end = 8175 - _POLLWORKFLOWTASKQUEUERESPONSE_QUERIESENTRY._serialized_start = 8091 - _POLLWORKFLOWTASKQUEUERESPONSE_QUERIESENTRY._serialized_end = 8175 - _RESPONDWORKFLOWTASKCOMPLETEDREQUEST._serialized_start = 8178 - _RESPONDWORKFLOWTASKCOMPLETEDREQUEST._serialized_end = 9516 - _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_QUERYRESULTSENTRY._serialized_start = 9350 - _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_QUERYRESULTSENTRY._serialized_end = 9445 - _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_CAPABILITIES._serialized_start = 9447 - _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_CAPABILITIES._serialized_end = 9516 - _RESPONDWORKFLOWTASKCOMPLETEDRESPONSE._serialized_start = 9519 - _RESPONDWORKFLOWTASKCOMPLETEDRESPONSE._serialized_end = 9764 - _RESPONDWORKFLOWTASKFAILEDREQUEST._serialized_start = 9767 - _RESPONDWORKFLOWTASKFAILEDREQUEST._serialized_end = 10292 - _RESPONDWORKFLOWTASKFAILEDRESPONSE._serialized_start = 10294 - _RESPONDWORKFLOWTASKFAILEDRESPONSE._serialized_end = 10329 - _POLLACTIVITYTASKQUEUEREQUEST._serialized_start = 10332 - _POLLACTIVITYTASKQUEUEREQUEST._serialized_end = 10818 - _POLLACTIVITYTASKQUEUERESPONSE._serialized_start = 10821 - _POLLACTIVITYTASKQUEUERESPONSE._serialized_end = 12002 - _RECORDACTIVITYTASKHEARTBEATREQUEST._serialized_start = 12005 - _RECORDACTIVITYTASKHEARTBEATREQUEST._serialized_end = 12170 - _RECORDACTIVITYTASKHEARTBEATRESPONSE._serialized_start = 12172 - _RECORDACTIVITYTASKHEARTBEATRESPONSE._serialized_end = 12284 - _RECORDACTIVITYTASKHEARTBEATBYIDREQUEST._serialized_start = 12287 - _RECORDACTIVITYTASKHEARTBEATBYIDREQUEST._serialized_end = 12494 - _RECORDACTIVITYTASKHEARTBEATBYIDRESPONSE._serialized_start = 12496 - _RECORDACTIVITYTASKHEARTBEATBYIDRESPONSE._serialized_end = 12612 - _RESPONDACTIVITYTASKCOMPLETEDREQUEST._serialized_start = 12615 - _RESPONDACTIVITYTASKCOMPLETEDREQUEST._serialized_end = 12997 - _RESPONDACTIVITYTASKCOMPLETEDRESPONSE._serialized_start = 12999 - _RESPONDACTIVITYTASKCOMPLETEDRESPONSE._serialized_end = 13037 - _RESPONDACTIVITYTASKCOMPLETEDBYIDREQUEST._serialized_start = 13040 - _RESPONDACTIVITYTASKCOMPLETEDBYIDREQUEST._serialized_end = 13247 - _RESPONDACTIVITYTASKCOMPLETEDBYIDRESPONSE._serialized_start = 13249 - _RESPONDACTIVITYTASKCOMPLETEDBYIDRESPONSE._serialized_end = 13291 - _RESPONDACTIVITYTASKFAILEDREQUEST._serialized_start = 13294 - _RESPONDACTIVITYTASKFAILEDREQUEST._serialized_end = 13740 - _RESPONDACTIVITYTASKFAILEDRESPONSE._serialized_start = 13742 - _RESPONDACTIVITYTASKFAILEDRESPONSE._serialized_end = 13829 - _RESPONDACTIVITYTASKFAILEDBYIDREQUEST._serialized_start = 13832 - _RESPONDACTIVITYTASKFAILEDBYIDREQUEST._serialized_end = 14103 - _RESPONDACTIVITYTASKFAILEDBYIDRESPONSE._serialized_start = 14105 - _RESPONDACTIVITYTASKFAILEDBYIDRESPONSE._serialized_end = 14196 - _RESPONDACTIVITYTASKCANCELEDREQUEST._serialized_start = 14199 - _RESPONDACTIVITYTASKCANCELEDREQUEST._serialized_end = 14581 - _RESPONDACTIVITYTASKCANCELEDRESPONSE._serialized_start = 14583 - _RESPONDACTIVITYTASKCANCELEDRESPONSE._serialized_end = 14620 - _RESPONDACTIVITYTASKCANCELEDBYIDREQUEST._serialized_start = 14623 - _RESPONDACTIVITYTASKCANCELEDBYIDREQUEST._serialized_end = 14911 - _RESPONDACTIVITYTASKCANCELEDBYIDRESPONSE._serialized_start = 14913 - _RESPONDACTIVITYTASKCANCELEDBYIDRESPONSE._serialized_end = 14954 - _REQUESTCANCELWORKFLOWEXECUTIONREQUEST._serialized_start = 14957 - _REQUESTCANCELWORKFLOWEXECUTIONREQUEST._serialized_end = 15217 - _REQUESTCANCELWORKFLOWEXECUTIONRESPONSE._serialized_start = 15219 - _REQUESTCANCELWORKFLOWEXECUTIONRESPONSE._serialized_end = 15259 - _SIGNALWORKFLOWEXECUTIONREQUEST._serialized_start = 15262 - _SIGNALWORKFLOWEXECUTIONREQUEST._serialized_end = 15612 - _SIGNALWORKFLOWEXECUTIONRESPONSE._serialized_start = 15614 - _SIGNALWORKFLOWEXECUTIONRESPONSE._serialized_end = 15691 - _SIGNALWITHSTARTWORKFLOWEXECUTIONREQUEST._serialized_start = 15694 - _SIGNALWITHSTARTWORKFLOWEXECUTIONREQUEST._serialized_end = 17033 - _SIGNALWITHSTARTWORKFLOWEXECUTIONRESPONSE._serialized_start = 17036 - _SIGNALWITHSTARTWORKFLOWEXECUTIONRESPONSE._serialized_end = 17194 - _RESETWORKFLOWEXECUTIONREQUEST._serialized_start = 17197 - _RESETWORKFLOWEXECUTIONREQUEST._serialized_end = 17646 - _RESETWORKFLOWEXECUTIONRESPONSE._serialized_start = 17648 - _RESETWORKFLOWEXECUTIONRESPONSE._serialized_end = 17696 - _TERMINATEWORKFLOWEXECUTIONREQUEST._serialized_start = 17699 - _TERMINATEWORKFLOWEXECUTIONREQUEST._serialized_end = 17986 - _TERMINATEWORKFLOWEXECUTIONRESPONSE._serialized_start = 17988 - _TERMINATEWORKFLOWEXECUTIONRESPONSE._serialized_end = 18024 - _DELETEWORKFLOWEXECUTIONREQUEST._serialized_start = 18026 - _DELETEWORKFLOWEXECUTIONREQUEST._serialized_end = 18148 - _DELETEWORKFLOWEXECUTIONRESPONSE._serialized_start = 18150 - _DELETEWORKFLOWEXECUTIONRESPONSE._serialized_end = 18183 - _LISTOPENWORKFLOWEXECUTIONSREQUEST._serialized_start = 18186 - _LISTOPENWORKFLOWEXECUTIONSREQUEST._serialized_end = 18515 - _LISTOPENWORKFLOWEXECUTIONSRESPONSE._serialized_start = 18518 - _LISTOPENWORKFLOWEXECUTIONSRESPONSE._serialized_end = 18648 - _LISTCLOSEDWORKFLOWEXECUTIONSREQUEST._serialized_start = 18651 - _LISTCLOSEDWORKFLOWEXECUTIONSREQUEST._serialized_end = 19045 - _LISTCLOSEDWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19048 - _LISTCLOSEDWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19180 - _LISTWORKFLOWEXECUTIONSREQUEST._serialized_start = 19182 - _LISTWORKFLOWEXECUTIONSREQUEST._serialized_end = 19291 - _LISTWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19293 - _LISTWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19419 - _LISTARCHIVEDWORKFLOWEXECUTIONSREQUEST._serialized_start = 19421 - _LISTARCHIVEDWORKFLOWEXECUTIONSREQUEST._serialized_end = 19538 - _LISTARCHIVEDWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19541 - _LISTARCHIVEDWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19675 - _SCANWORKFLOWEXECUTIONSREQUEST._serialized_start = 19677 - _SCANWORKFLOWEXECUTIONSREQUEST._serialized_end = 19786 - _SCANWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19788 - _SCANWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19914 - _COUNTWORKFLOWEXECUTIONSREQUEST._serialized_start = 19916 - _COUNTWORKFLOWEXECUTIONSREQUEST._serialized_end = 19982 - _COUNTWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19985 - _COUNTWORKFLOWEXECUTIONSRESPONSE._serialized_end = 20222 - _COUNTWORKFLOWEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_start = 20134 - _COUNTWORKFLOWEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_end = 20222 - _GETSEARCHATTRIBUTESREQUEST._serialized_start = 20224 - _GETSEARCHATTRIBUTESREQUEST._serialized_end = 20252 - _GETSEARCHATTRIBUTESRESPONSE._serialized_start = 20255 - _GETSEARCHATTRIBUTESRESPONSE._serialized_end = 20456 - _GETSEARCHATTRIBUTESRESPONSE_KEYSENTRY._serialized_start = 20372 - _GETSEARCHATTRIBUTESRESPONSE_KEYSENTRY._serialized_end = 20456 - _RESPONDQUERYTASKCOMPLETEDREQUEST._serialized_start = 20459 - _RESPONDQUERYTASKCOMPLETEDREQUEST._serialized_end = 20820 - _RESPONDQUERYTASKCOMPLETEDRESPONSE._serialized_start = 20822 - _RESPONDQUERYTASKCOMPLETEDRESPONSE._serialized_end = 20857 - _RESETSTICKYTASKQUEUEREQUEST._serialized_start = 20859 - _RESETSTICKYTASKQUEUEREQUEST._serialized_end = 20969 - _RESETSTICKYTASKQUEUERESPONSE._serialized_start = 20971 - _RESETSTICKYTASKQUEUERESPONSE._serialized_end = 21001 - _SHUTDOWNWORKERREQUEST._serialized_start = 21004 - _SHUTDOWNWORKERREQUEST._serialized_end = 21287 - _SHUTDOWNWORKERRESPONSE._serialized_start = 21289 - _SHUTDOWNWORKERRESPONSE._serialized_end = 21313 - _QUERYWORKFLOWREQUEST._serialized_start = 21316 - _QUERYWORKFLOWREQUEST._serialized_end = 21549 - _QUERYWORKFLOWRESPONSE._serialized_start = 21552 - _QUERYWORKFLOWRESPONSE._serialized_end = 21737 - _DESCRIBEWORKFLOWEXECUTIONREQUEST._serialized_start = 21739 - _DESCRIBEWORKFLOWEXECUTIONREQUEST._serialized_end = 21854 - _DESCRIBEWORKFLOWEXECUTIONRESPONSE._serialized_start = 21857 - _DESCRIBEWORKFLOWEXECUTIONRESPONSE._serialized_end = 22522 - _DESCRIBETASKQUEUEREQUEST._serialized_start = 22525 - _DESCRIBETASKQUEUEREQUEST._serialized_end = 23053 - _DESCRIBETASKQUEUERESPONSE._serialized_start = 23056 - _DESCRIBETASKQUEUERESPONSE._serialized_end = 24060 - _DESCRIBETASKQUEUERESPONSE_STATSBYPRIORITYKEYENTRY._serialized_start = 23740 - _DESCRIBETASKQUEUERESPONSE_STATSBYPRIORITYKEYENTRY._serialized_end = 23840 - _DESCRIBETASKQUEUERESPONSE_EFFECTIVERATELIMIT._serialized_start = 23842 - _DESCRIBETASKQUEUERESPONSE_EFFECTIVERATELIMIT._serialized_end = 23958 - _DESCRIBETASKQUEUERESPONSE_VERSIONSINFOENTRY._serialized_start = 23960 - _DESCRIBETASKQUEUERESPONSE_VERSIONSINFOENTRY._serialized_end = 24060 - _GETCLUSTERINFOREQUEST._serialized_start = 24062 - _GETCLUSTERINFOREQUEST._serialized_end = 24085 - _GETCLUSTERINFORESPONSE._serialized_start = 24088 - _GETCLUSTERINFORESPONSE._serialized_end = 24553 - _GETCLUSTERINFORESPONSE_SUPPORTEDCLIENTSENTRY._serialized_start = 24498 - _GETCLUSTERINFORESPONSE_SUPPORTEDCLIENTSENTRY._serialized_end = 24553 - _GETSYSTEMINFOREQUEST._serialized_start = 24555 - _GETSYSTEMINFOREQUEST._serialized_end = 24577 - _GETSYSTEMINFORESPONSE._serialized_start = 24580 - _GETSYSTEMINFORESPONSE._serialized_end = 25157 - _GETSYSTEMINFORESPONSE_CAPABILITIES._serialized_start = 24721 - _GETSYSTEMINFORESPONSE_CAPABILITIES._serialized_end = 25157 - _LISTTASKQUEUEPARTITIONSREQUEST._serialized_start = 25159 - _LISTTASKQUEUEPARTITIONSREQUEST._serialized_end = 25268 - _LISTTASKQUEUEPARTITIONSRESPONSE._serialized_start = 25271 - _LISTTASKQUEUEPARTITIONSRESPONSE._serialized_end = 25494 - _CREATESCHEDULEREQUEST._serialized_start = 25497 - _CREATESCHEDULEREQUEST._serialized_end = 25829 - _CREATESCHEDULERESPONSE._serialized_start = 25831 - _CREATESCHEDULERESPONSE._serialized_end = 25879 - _DESCRIBESCHEDULEREQUEST._serialized_start = 25881 - _DESCRIBESCHEDULEREQUEST._serialized_end = 25946 - _DESCRIBESCHEDULERESPONSE._serialized_start = 25949 - _DESCRIBESCHEDULERESPONSE._serialized_end = 26220 - _UPDATESCHEDULEREQUEST._serialized_start = 26223 - _UPDATESCHEDULEREQUEST._serialized_end = 26515 - _UPDATESCHEDULERESPONSE._serialized_start = 26517 - _UPDATESCHEDULERESPONSE._serialized_end = 26541 - _PATCHSCHEDULEREQUEST._serialized_start = 26544 - _PATCHSCHEDULEREQUEST._serialized_end = 26700 - _PATCHSCHEDULERESPONSE._serialized_start = 26702 - _PATCHSCHEDULERESPONSE._serialized_end = 26725 - _LISTSCHEDULEMATCHINGTIMESREQUEST._serialized_start = 26728 - _LISTSCHEDULEMATCHINGTIMESREQUEST._serialized_end = 26896 - _LISTSCHEDULEMATCHINGTIMESRESPONSE._serialized_start = 26898 - _LISTSCHEDULEMATCHINGTIMESRESPONSE._serialized_end = 26981 - _DELETESCHEDULEREQUEST._serialized_start = 26983 - _DELETESCHEDULEREQUEST._serialized_end = 27064 - _DELETESCHEDULERESPONSE._serialized_start = 27066 - _DELETESCHEDULERESPONSE._serialized_end = 27090 - _LISTSCHEDULESREQUEST._serialized_start = 27092 - _LISTSCHEDULESREQUEST._serialized_end = 27200 - _LISTSCHEDULESRESPONSE._serialized_start = 27202 - _LISTSCHEDULESRESPONSE._serialized_end = 27314 - _COUNTSCHEDULESREQUEST._serialized_start = 27316 - _COUNTSCHEDULESREQUEST._serialized_end = 27373 - _COUNTSCHEDULESRESPONSE._serialized_start = 27376 - _COUNTSCHEDULESRESPONSE._serialized_end = 27595 - _COUNTSCHEDULESRESPONSE_AGGREGATIONGROUP._serialized_start = 20134 - _COUNTSCHEDULESRESPONSE_AGGREGATIONGROUP._serialized_end = 20222 - _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_start = 27598 - _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_end = 28244 - _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_ADDNEWCOMPATIBLEVERSION._serialized_start = 28045 + _REGISTERNAMESPACEREQUEST._serialized_start = 1684 + _REGISTERNAMESPACEREQUEST._serialized_end = 2332 + _REGISTERNAMESPACEREQUEST_DATAENTRY._serialized_start = 2289 + _REGISTERNAMESPACEREQUEST_DATAENTRY._serialized_end = 2332 + _REGISTERNAMESPACERESPONSE._serialized_start = 2334 + _REGISTERNAMESPACERESPONSE._serialized_end = 2361 + _LISTNAMESPACESREQUEST._serialized_start = 2364 + _LISTNAMESPACESREQUEST._serialized_end = 2501 + _LISTNAMESPACESRESPONSE._serialized_start = 2504 + _LISTNAMESPACESRESPONSE._serialized_end = 2633 + _DESCRIBENAMESPACEREQUEST._serialized_start = 2635 + _DESCRIBENAMESPACEREQUEST._serialized_end = 2718 + _DESCRIBENAMESPACERESPONSE._serialized_start = 2721 + _DESCRIBENAMESPACERESPONSE._serialized_end = 3234 + _UPDATENAMESPACEREQUEST._serialized_start = 3237 + _UPDATENAMESPACEREQUEST._serialized_end = 3572 + _UPDATENAMESPACERESPONSE._serialized_start = 3575 + _UPDATENAMESPACERESPONSE._serialized_end = 3866 + _DEPRECATENAMESPACEREQUEST._serialized_start = 3868 + _DEPRECATENAMESPACEREQUEST._serialized_end = 3938 + _DEPRECATENAMESPACERESPONSE._serialized_start = 3940 + _DEPRECATENAMESPACERESPONSE._serialized_end = 3968 + _STARTWORKFLOWEXECUTIONREQUEST._serialized_start = 3971 + _STARTWORKFLOWEXECUTIONREQUEST._serialized_end = 5588 + _STARTWORKFLOWEXECUTIONRESPONSE._serialized_start = 5591 + _STARTWORKFLOWEXECUTIONRESPONSE._serialized_end = 5889 + _GETWORKFLOWEXECUTIONHISTORYREQUEST._serialized_start = 5892 + _GETWORKFLOWEXECUTIONHISTORYREQUEST._serialized_end = 6190 + _GETWORKFLOWEXECUTIONHISTORYRESPONSE._serialized_start = 6193 + _GETWORKFLOWEXECUTIONHISTORYRESPONSE._serialized_end = 6379 + _GETWORKFLOWEXECUTIONHISTORYREVERSEREQUEST._serialized_start = 6382 + _GETWORKFLOWEXECUTIONHISTORYREVERSEREQUEST._serialized_end = 6558 + _GETWORKFLOWEXECUTIONHISTORYREVERSERESPONSE._serialized_start = 6560 + _GETWORKFLOWEXECUTIONHISTORYREVERSERESPONSE._serialized_end = 6680 + _POLLWORKFLOWTASKQUEUEREQUEST._serialized_start = 6683 + _POLLWORKFLOWTASKQUEUEREQUEST._serialized_end = 7123 + _POLLWORKFLOWTASKQUEUERESPONSE._serialized_start = 7126 + _POLLWORKFLOWTASKQUEUERESPONSE._serialized_end = 8273 + _POLLWORKFLOWTASKQUEUERESPONSE_QUERIESENTRY._serialized_start = 8189 + _POLLWORKFLOWTASKQUEUERESPONSE_QUERIESENTRY._serialized_end = 8273 + _RESPONDWORKFLOWTASKCOMPLETEDREQUEST._serialized_start = 8276 + _RESPONDWORKFLOWTASKCOMPLETEDREQUEST._serialized_end = 9614 + _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_QUERYRESULTSENTRY._serialized_start = 9448 + _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_QUERYRESULTSENTRY._serialized_end = 9543 + _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_CAPABILITIES._serialized_start = 9545 + _RESPONDWORKFLOWTASKCOMPLETEDREQUEST_CAPABILITIES._serialized_end = 9614 + _RESPONDWORKFLOWTASKCOMPLETEDRESPONSE._serialized_start = 9617 + _RESPONDWORKFLOWTASKCOMPLETEDRESPONSE._serialized_end = 9862 + _RESPONDWORKFLOWTASKFAILEDREQUEST._serialized_start = 9865 + _RESPONDWORKFLOWTASKFAILEDREQUEST._serialized_end = 10390 + _RESPONDWORKFLOWTASKFAILEDRESPONSE._serialized_start = 10392 + _RESPONDWORKFLOWTASKFAILEDRESPONSE._serialized_end = 10427 + _POLLACTIVITYTASKQUEUEREQUEST._serialized_start = 10430 + _POLLACTIVITYTASKQUEUEREQUEST._serialized_end = 10916 + _POLLACTIVITYTASKQUEUERESPONSE._serialized_start = 10919 + _POLLACTIVITYTASKQUEUERESPONSE._serialized_end = 12100 + _RECORDACTIVITYTASKHEARTBEATREQUEST._serialized_start = 12103 + _RECORDACTIVITYTASKHEARTBEATREQUEST._serialized_end = 12268 + _RECORDACTIVITYTASKHEARTBEATRESPONSE._serialized_start = 12270 + _RECORDACTIVITYTASKHEARTBEATRESPONSE._serialized_end = 12382 + _RECORDACTIVITYTASKHEARTBEATBYIDREQUEST._serialized_start = 12385 + _RECORDACTIVITYTASKHEARTBEATBYIDREQUEST._serialized_end = 12592 + _RECORDACTIVITYTASKHEARTBEATBYIDRESPONSE._serialized_start = 12594 + _RECORDACTIVITYTASKHEARTBEATBYIDRESPONSE._serialized_end = 12710 + _RESPONDACTIVITYTASKCOMPLETEDREQUEST._serialized_start = 12713 + _RESPONDACTIVITYTASKCOMPLETEDREQUEST._serialized_end = 13095 + _RESPONDACTIVITYTASKCOMPLETEDRESPONSE._serialized_start = 13097 + _RESPONDACTIVITYTASKCOMPLETEDRESPONSE._serialized_end = 13135 + _RESPONDACTIVITYTASKCOMPLETEDBYIDREQUEST._serialized_start = 13138 + _RESPONDACTIVITYTASKCOMPLETEDBYIDREQUEST._serialized_end = 13345 + _RESPONDACTIVITYTASKCOMPLETEDBYIDRESPONSE._serialized_start = 13347 + _RESPONDACTIVITYTASKCOMPLETEDBYIDRESPONSE._serialized_end = 13389 + _RESPONDACTIVITYTASKFAILEDREQUEST._serialized_start = 13392 + _RESPONDACTIVITYTASKFAILEDREQUEST._serialized_end = 13838 + _RESPONDACTIVITYTASKFAILEDRESPONSE._serialized_start = 13840 + _RESPONDACTIVITYTASKFAILEDRESPONSE._serialized_end = 13927 + _RESPONDACTIVITYTASKFAILEDBYIDREQUEST._serialized_start = 13930 + _RESPONDACTIVITYTASKFAILEDBYIDREQUEST._serialized_end = 14201 + _RESPONDACTIVITYTASKFAILEDBYIDRESPONSE._serialized_start = 14203 + _RESPONDACTIVITYTASKFAILEDBYIDRESPONSE._serialized_end = 14294 + _RESPONDACTIVITYTASKCANCELEDREQUEST._serialized_start = 14297 + _RESPONDACTIVITYTASKCANCELEDREQUEST._serialized_end = 14679 + _RESPONDACTIVITYTASKCANCELEDRESPONSE._serialized_start = 14681 + _RESPONDACTIVITYTASKCANCELEDRESPONSE._serialized_end = 14718 + _RESPONDACTIVITYTASKCANCELEDBYIDREQUEST._serialized_start = 14721 + _RESPONDACTIVITYTASKCANCELEDBYIDREQUEST._serialized_end = 15009 + _RESPONDACTIVITYTASKCANCELEDBYIDRESPONSE._serialized_start = 15011 + _RESPONDACTIVITYTASKCANCELEDBYIDRESPONSE._serialized_end = 15052 + _REQUESTCANCELWORKFLOWEXECUTIONREQUEST._serialized_start = 15055 + _REQUESTCANCELWORKFLOWEXECUTIONREQUEST._serialized_end = 15315 + _REQUESTCANCELWORKFLOWEXECUTIONRESPONSE._serialized_start = 15317 + _REQUESTCANCELWORKFLOWEXECUTIONRESPONSE._serialized_end = 15357 + _SIGNALWORKFLOWEXECUTIONREQUEST._serialized_start = 15360 + _SIGNALWORKFLOWEXECUTIONREQUEST._serialized_end = 15710 + _SIGNALWORKFLOWEXECUTIONRESPONSE._serialized_start = 15712 + _SIGNALWORKFLOWEXECUTIONRESPONSE._serialized_end = 15789 + _SIGNALWITHSTARTWORKFLOWEXECUTIONREQUEST._serialized_start = 15792 + _SIGNALWITHSTARTWORKFLOWEXECUTIONREQUEST._serialized_end = 17131 + _SIGNALWITHSTARTWORKFLOWEXECUTIONRESPONSE._serialized_start = 17134 + _SIGNALWITHSTARTWORKFLOWEXECUTIONRESPONSE._serialized_end = 17292 + _RESETWORKFLOWEXECUTIONREQUEST._serialized_start = 17295 + _RESETWORKFLOWEXECUTIONREQUEST._serialized_end = 17744 + _RESETWORKFLOWEXECUTIONRESPONSE._serialized_start = 17746 + _RESETWORKFLOWEXECUTIONRESPONSE._serialized_end = 17794 + _TERMINATEWORKFLOWEXECUTIONREQUEST._serialized_start = 17797 + _TERMINATEWORKFLOWEXECUTIONREQUEST._serialized_end = 18084 + _TERMINATEWORKFLOWEXECUTIONRESPONSE._serialized_start = 18086 + _TERMINATEWORKFLOWEXECUTIONRESPONSE._serialized_end = 18122 + _DELETEWORKFLOWEXECUTIONREQUEST._serialized_start = 18124 + _DELETEWORKFLOWEXECUTIONREQUEST._serialized_end = 18246 + _DELETEWORKFLOWEXECUTIONRESPONSE._serialized_start = 18248 + _DELETEWORKFLOWEXECUTIONRESPONSE._serialized_end = 18281 + _LISTOPENWORKFLOWEXECUTIONSREQUEST._serialized_start = 18284 + _LISTOPENWORKFLOWEXECUTIONSREQUEST._serialized_end = 18613 + _LISTOPENWORKFLOWEXECUTIONSRESPONSE._serialized_start = 18616 + _LISTOPENWORKFLOWEXECUTIONSRESPONSE._serialized_end = 18746 + _LISTCLOSEDWORKFLOWEXECUTIONSREQUEST._serialized_start = 18749 + _LISTCLOSEDWORKFLOWEXECUTIONSREQUEST._serialized_end = 19143 + _LISTCLOSEDWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19146 + _LISTCLOSEDWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19278 + _LISTWORKFLOWEXECUTIONSREQUEST._serialized_start = 19280 + _LISTWORKFLOWEXECUTIONSREQUEST._serialized_end = 19389 + _LISTWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19391 + _LISTWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19517 + _LISTARCHIVEDWORKFLOWEXECUTIONSREQUEST._serialized_start = 19519 + _LISTARCHIVEDWORKFLOWEXECUTIONSREQUEST._serialized_end = 19636 + _LISTARCHIVEDWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19639 + _LISTARCHIVEDWORKFLOWEXECUTIONSRESPONSE._serialized_end = 19773 + _SCANWORKFLOWEXECUTIONSREQUEST._serialized_start = 19775 + _SCANWORKFLOWEXECUTIONSREQUEST._serialized_end = 19884 + _SCANWORKFLOWEXECUTIONSRESPONSE._serialized_start = 19886 + _SCANWORKFLOWEXECUTIONSRESPONSE._serialized_end = 20012 + _COUNTWORKFLOWEXECUTIONSREQUEST._serialized_start = 20014 + _COUNTWORKFLOWEXECUTIONSREQUEST._serialized_end = 20080 + _COUNTWORKFLOWEXECUTIONSRESPONSE._serialized_start = 20083 + _COUNTWORKFLOWEXECUTIONSRESPONSE._serialized_end = 20320 + _COUNTWORKFLOWEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_start = 20232 + _COUNTWORKFLOWEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_end = 20320 + _GETSEARCHATTRIBUTESREQUEST._serialized_start = 20322 + _GETSEARCHATTRIBUTESREQUEST._serialized_end = 20350 + _GETSEARCHATTRIBUTESRESPONSE._serialized_start = 20353 + _GETSEARCHATTRIBUTESRESPONSE._serialized_end = 20554 + _GETSEARCHATTRIBUTESRESPONSE_KEYSENTRY._serialized_start = 20470 + _GETSEARCHATTRIBUTESRESPONSE_KEYSENTRY._serialized_end = 20554 + _RESPONDQUERYTASKCOMPLETEDREQUEST._serialized_start = 20557 + _RESPONDQUERYTASKCOMPLETEDREQUEST._serialized_end = 20918 + _RESPONDQUERYTASKCOMPLETEDRESPONSE._serialized_start = 20920 + _RESPONDQUERYTASKCOMPLETEDRESPONSE._serialized_end = 20955 + _RESETSTICKYTASKQUEUEREQUEST._serialized_start = 20957 + _RESETSTICKYTASKQUEUEREQUEST._serialized_end = 21067 + _RESETSTICKYTASKQUEUERESPONSE._serialized_start = 21069 + _RESETSTICKYTASKQUEUERESPONSE._serialized_end = 21099 + _SHUTDOWNWORKERREQUEST._serialized_start = 21102 + _SHUTDOWNWORKERREQUEST._serialized_end = 21385 + _SHUTDOWNWORKERRESPONSE._serialized_start = 21387 + _SHUTDOWNWORKERRESPONSE._serialized_end = 21411 + _QUERYWORKFLOWREQUEST._serialized_start = 21414 + _QUERYWORKFLOWREQUEST._serialized_end = 21647 + _QUERYWORKFLOWRESPONSE._serialized_start = 21650 + _QUERYWORKFLOWRESPONSE._serialized_end = 21835 + _DESCRIBEWORKFLOWEXECUTIONREQUEST._serialized_start = 21837 + _DESCRIBEWORKFLOWEXECUTIONREQUEST._serialized_end = 21952 + _DESCRIBEWORKFLOWEXECUTIONRESPONSE._serialized_start = 21955 + _DESCRIBEWORKFLOWEXECUTIONRESPONSE._serialized_end = 22620 + _DESCRIBETASKQUEUEREQUEST._serialized_start = 22623 + _DESCRIBETASKQUEUEREQUEST._serialized_end = 23151 + _DESCRIBETASKQUEUERESPONSE._serialized_start = 23154 + _DESCRIBETASKQUEUERESPONSE._serialized_end = 24158 + _DESCRIBETASKQUEUERESPONSE_STATSBYPRIORITYKEYENTRY._serialized_start = 23838 + _DESCRIBETASKQUEUERESPONSE_STATSBYPRIORITYKEYENTRY._serialized_end = 23938 + _DESCRIBETASKQUEUERESPONSE_EFFECTIVERATELIMIT._serialized_start = 23940 + _DESCRIBETASKQUEUERESPONSE_EFFECTIVERATELIMIT._serialized_end = 24056 + _DESCRIBETASKQUEUERESPONSE_VERSIONSINFOENTRY._serialized_start = 24058 + _DESCRIBETASKQUEUERESPONSE_VERSIONSINFOENTRY._serialized_end = 24158 + _GETCLUSTERINFOREQUEST._serialized_start = 24160 + _GETCLUSTERINFOREQUEST._serialized_end = 24183 + _GETCLUSTERINFORESPONSE._serialized_start = 24186 + _GETCLUSTERINFORESPONSE._serialized_end = 24651 + _GETCLUSTERINFORESPONSE_SUPPORTEDCLIENTSENTRY._serialized_start = 24596 + _GETCLUSTERINFORESPONSE_SUPPORTEDCLIENTSENTRY._serialized_end = 24651 + _GETSYSTEMINFOREQUEST._serialized_start = 24653 + _GETSYSTEMINFOREQUEST._serialized_end = 24675 + _GETSYSTEMINFORESPONSE._serialized_start = 24678 + _GETSYSTEMINFORESPONSE._serialized_end = 25255 + _GETSYSTEMINFORESPONSE_CAPABILITIES._serialized_start = 24819 + _GETSYSTEMINFORESPONSE_CAPABILITIES._serialized_end = 25255 + _LISTTASKQUEUEPARTITIONSREQUEST._serialized_start = 25257 + _LISTTASKQUEUEPARTITIONSREQUEST._serialized_end = 25366 + _LISTTASKQUEUEPARTITIONSRESPONSE._serialized_start = 25369 + _LISTTASKQUEUEPARTITIONSRESPONSE._serialized_end = 25592 + _CREATESCHEDULEREQUEST._serialized_start = 25595 + _CREATESCHEDULEREQUEST._serialized_end = 25927 + _CREATESCHEDULERESPONSE._serialized_start = 25929 + _CREATESCHEDULERESPONSE._serialized_end = 25977 + _DESCRIBESCHEDULEREQUEST._serialized_start = 25979 + _DESCRIBESCHEDULEREQUEST._serialized_end = 26044 + _DESCRIBESCHEDULERESPONSE._serialized_start = 26047 + _DESCRIBESCHEDULERESPONSE._serialized_end = 26318 + _UPDATESCHEDULEREQUEST._serialized_start = 26321 + _UPDATESCHEDULEREQUEST._serialized_end = 26613 + _UPDATESCHEDULERESPONSE._serialized_start = 26615 + _UPDATESCHEDULERESPONSE._serialized_end = 26639 + _PATCHSCHEDULEREQUEST._serialized_start = 26642 + _PATCHSCHEDULEREQUEST._serialized_end = 26798 + _PATCHSCHEDULERESPONSE._serialized_start = 26800 + _PATCHSCHEDULERESPONSE._serialized_end = 26823 + _LISTSCHEDULEMATCHINGTIMESREQUEST._serialized_start = 26826 + _LISTSCHEDULEMATCHINGTIMESREQUEST._serialized_end = 26994 + _LISTSCHEDULEMATCHINGTIMESRESPONSE._serialized_start = 26996 + _LISTSCHEDULEMATCHINGTIMESRESPONSE._serialized_end = 27079 + _DELETESCHEDULEREQUEST._serialized_start = 27081 + _DELETESCHEDULEREQUEST._serialized_end = 27162 + _DELETESCHEDULERESPONSE._serialized_start = 27164 + _DELETESCHEDULERESPONSE._serialized_end = 27188 + _LISTSCHEDULESREQUEST._serialized_start = 27190 + _LISTSCHEDULESREQUEST._serialized_end = 27298 + _LISTSCHEDULESRESPONSE._serialized_start = 27300 + _LISTSCHEDULESRESPONSE._serialized_end = 27412 + _COUNTSCHEDULESREQUEST._serialized_start = 27414 + _COUNTSCHEDULESREQUEST._serialized_end = 27471 + _COUNTSCHEDULESRESPONSE._serialized_start = 27474 + _COUNTSCHEDULESRESPONSE._serialized_end = 27693 + _COUNTSCHEDULESRESPONSE_AGGREGATIONGROUP._serialized_start = 20232 + _COUNTSCHEDULESRESPONSE_AGGREGATIONGROUP._serialized_end = 20320 + _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_start = 27696 + _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_end = 28342 + _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_ADDNEWCOMPATIBLEVERSION._serialized_start = 28143 _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_ADDNEWCOMPATIBLEVERSION._serialized_end = ( - 28156 + 28254 ) - _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_MERGESETS._serialized_start = 28158 - _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_MERGESETS._serialized_end = 28231 - _UPDATEWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_start = 28246 - _UPDATEWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_end = 28310 - _GETWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_start = 28312 - _GETWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_end = 28407 - _GETWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_start = 28409 - _GETWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_end = 28525 - _UPDATEWORKERVERSIONINGRULESREQUEST._serialized_start = 28528 - _UPDATEWORKERVERSIONINGRULESREQUEST._serialized_end = 30245 - _UPDATEWORKERVERSIONINGRULESREQUEST_INSERTBUILDIDASSIGNMENTRULE._serialized_start = 29580 + _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_MERGESETS._serialized_start = 28256 + _UPDATEWORKERBUILDIDCOMPATIBILITYREQUEST_MERGESETS._serialized_end = 28329 + _UPDATEWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_start = 28344 + _UPDATEWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_end = 28408 + _GETWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_start = 28410 + _GETWORKERBUILDIDCOMPATIBILITYREQUEST._serialized_end = 28505 + _GETWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_start = 28507 + _GETWORKERBUILDIDCOMPATIBILITYRESPONSE._serialized_end = 28623 + _UPDATEWORKERVERSIONINGRULESREQUEST._serialized_start = 28626 + _UPDATEWORKERVERSIONINGRULESREQUEST._serialized_end = 30343 + _UPDATEWORKERVERSIONINGRULESREQUEST_INSERTBUILDIDASSIGNMENTRULE._serialized_start = 29678 _UPDATEWORKERVERSIONINGRULESREQUEST_INSERTBUILDIDASSIGNMENTRULE._serialized_end = ( - 29693 + 29791 ) - _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACEBUILDIDASSIGNMENTRULE._serialized_start = 29696 + _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACEBUILDIDASSIGNMENTRULE._serialized_start = 29794 _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACEBUILDIDASSIGNMENTRULE._serialized_end = ( - 29825 + 29923 ) - _UPDATEWORKERVERSIONINGRULESREQUEST_DELETEBUILDIDASSIGNMENTRULE._serialized_start = 29827 + _UPDATEWORKERVERSIONINGRULESREQUEST_DELETEBUILDIDASSIGNMENTRULE._serialized_start = 29925 _UPDATEWORKERVERSIONINGRULESREQUEST_DELETEBUILDIDASSIGNMENTRULE._serialized_end = ( - 29891 + 29989 ) - _UPDATEWORKERVERSIONINGRULESREQUEST_ADDCOMPATIBLEBUILDIDREDIRECTRULE._serialized_start = 29893 - _UPDATEWORKERVERSIONINGRULESREQUEST_ADDCOMPATIBLEBUILDIDREDIRECTRULE._serialized_end = 29999 - _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACECOMPATIBLEBUILDIDREDIRECTRULE._serialized_start = 30001 - _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACECOMPATIBLEBUILDIDREDIRECTRULE._serialized_end = 30111 - _UPDATEWORKERVERSIONINGRULESREQUEST_DELETECOMPATIBLEBUILDIDREDIRECTRULE._serialized_start = 30113 - _UPDATEWORKERVERSIONINGRULESREQUEST_DELETECOMPATIBLEBUILDIDREDIRECTRULE._serialized_end = 30175 - _UPDATEWORKERVERSIONINGRULESREQUEST_COMMITBUILDID._serialized_start = 30177 - _UPDATEWORKERVERSIONINGRULESREQUEST_COMMITBUILDID._serialized_end = 30232 - _UPDATEWORKERVERSIONINGRULESRESPONSE._serialized_start = 30248 - _UPDATEWORKERVERSIONINGRULESRESPONSE._serialized_end = 30500 - _GETWORKERVERSIONINGRULESREQUEST._serialized_start = 30502 - _GETWORKERVERSIONINGRULESREQUEST._serialized_end = 30574 - _GETWORKERVERSIONINGRULESRESPONSE._serialized_start = 30577 - _GETWORKERVERSIONINGRULESRESPONSE._serialized_end = 30826 - _GETWORKERTASKREACHABILITYREQUEST._serialized_start = 30829 - _GETWORKERTASKREACHABILITYREQUEST._serialized_end = 30985 - _GETWORKERTASKREACHABILITYRESPONSE._serialized_start = 30987 - _GETWORKERTASKREACHABILITYRESPONSE._serialized_end = 31101 - _UPDATEWORKFLOWEXECUTIONREQUEST._serialized_start = 31104 - _UPDATEWORKFLOWEXECUTIONREQUEST._serialized_end = 31365 - _UPDATEWORKFLOWEXECUTIONRESPONSE._serialized_start = 31368 - _UPDATEWORKFLOWEXECUTIONRESPONSE._serialized_end = 31627 - _STARTBATCHOPERATIONREQUEST._serialized_start = 31630 - _STARTBATCHOPERATIONREQUEST._serialized_end = 32996 - _STARTBATCHOPERATIONRESPONSE._serialized_start = 32998 - _STARTBATCHOPERATIONRESPONSE._serialized_end = 33027 - _STOPBATCHOPERATIONREQUEST._serialized_start = 33029 - _STOPBATCHOPERATIONREQUEST._serialized_end = 33125 - _STOPBATCHOPERATIONRESPONSE._serialized_start = 33127 - _STOPBATCHOPERATIONRESPONSE._serialized_end = 33155 - _DESCRIBEBATCHOPERATIONREQUEST._serialized_start = 33157 - _DESCRIBEBATCHOPERATIONREQUEST._serialized_end = 33223 - _DESCRIBEBATCHOPERATIONRESPONSE._serialized_start = 33226 - _DESCRIBEBATCHOPERATIONRESPONSE._serialized_end = 33698 - _LISTBATCHOPERATIONSREQUEST._serialized_start = 33700 - _LISTBATCHOPERATIONSREQUEST._serialized_end = 33791 - _LISTBATCHOPERATIONSRESPONSE._serialized_start = 33793 - _LISTBATCHOPERATIONSRESPONSE._serialized_end = 33914 - _POLLWORKFLOWEXECUTIONUPDATEREQUEST._serialized_start = 33917 - _POLLWORKFLOWEXECUTIONUPDATEREQUEST._serialized_end = 34102 - _POLLWORKFLOWEXECUTIONUPDATERESPONSE._serialized_start = 34105 - _POLLWORKFLOWEXECUTIONUPDATERESPONSE._serialized_end = 34324 - _POLLNEXUSTASKQUEUEREQUEST._serialized_start = 34327 - _POLLNEXUSTASKQUEUEREQUEST._serialized_end = 34743 - _POLLNEXUSTASKQUEUERESPONSE._serialized_start = 34746 - _POLLNEXUSTASKQUEUERESPONSE._serialized_end = 35100 - _RESPONDNEXUSTASKCOMPLETEDREQUEST._serialized_start = 35103 - _RESPONDNEXUSTASKCOMPLETEDREQUEST._serialized_end = 35270 - _RESPONDNEXUSTASKCOMPLETEDRESPONSE._serialized_start = 35272 - _RESPONDNEXUSTASKCOMPLETEDRESPONSE._serialized_end = 35307 - _RESPONDNEXUSTASKFAILEDREQUEST._serialized_start = 35310 - _RESPONDNEXUSTASKFAILEDREQUEST._serialized_end = 35530 - _RESPONDNEXUSTASKFAILEDRESPONSE._serialized_start = 35532 - _RESPONDNEXUSTASKFAILEDRESPONSE._serialized_end = 35564 - _EXECUTEMULTIOPERATIONREQUEST._serialized_start = 35567 - _EXECUTEMULTIOPERATIONREQUEST._serialized_end = 35939 - _EXECUTEMULTIOPERATIONREQUEST_OPERATION._serialized_start = 35733 - _EXECUTEMULTIOPERATIONREQUEST_OPERATION._serialized_end = 35939 - _EXECUTEMULTIOPERATIONRESPONSE._serialized_start = 35942 - _EXECUTEMULTIOPERATIONRESPONSE._serialized_end = 36274 - _EXECUTEMULTIOPERATIONRESPONSE_RESPONSE._serialized_start = 36068 - _EXECUTEMULTIOPERATIONRESPONSE_RESPONSE._serialized_end = 36274 - _UPDATEACTIVITYOPTIONSREQUEST._serialized_start = 36277 - _UPDATEACTIVITYOPTIONSREQUEST._serialized_end = 36613 - _UPDATEACTIVITYEXECUTIONOPTIONSREQUEST._serialized_start = 36616 - _UPDATEACTIVITYEXECUTIONOPTIONSREQUEST._serialized_end = 36935 - _UPDATEACTIVITYOPTIONSRESPONSE._serialized_start = 36937 - _UPDATEACTIVITYOPTIONSRESPONSE._serialized_end = 37037 - _UPDATEACTIVITYEXECUTIONOPTIONSRESPONSE._serialized_start = 37039 - _UPDATEACTIVITYEXECUTIONOPTIONSRESPONSE._serialized_end = 37148 - _PAUSEACTIVITYREQUEST._serialized_start = 37151 - _PAUSEACTIVITYREQUEST._serialized_end = 37350 - _PAUSEACTIVITYEXECUTIONREQUEST._serialized_start = 37353 - _PAUSEACTIVITYEXECUTIONREQUEST._serialized_end = 37536 - _PAUSEACTIVITYRESPONSE._serialized_start = 37538 - _PAUSEACTIVITYRESPONSE._serialized_end = 37561 - _PAUSEACTIVITYEXECUTIONRESPONSE._serialized_start = 37563 - _PAUSEACTIVITYEXECUTIONRESPONSE._serialized_end = 37595 - _UNPAUSEACTIVITYREQUEST._serialized_start = 37598 - _UNPAUSEACTIVITYREQUEST._serialized_end = 37878 - _UNPAUSEACTIVITYEXECUTIONREQUEST._serialized_start = 37881 - _UNPAUSEACTIVITYEXECUTIONREQUEST._serialized_end = 38154 - _UNPAUSEACTIVITYRESPONSE._serialized_start = 38156 - _UNPAUSEACTIVITYRESPONSE._serialized_end = 38181 - _UNPAUSEACTIVITYEXECUTIONRESPONSE._serialized_start = 38183 - _UNPAUSEACTIVITYEXECUTIONRESPONSE._serialized_end = 38217 - _RESETACTIVITYREQUEST._serialized_start = 38220 - _RESETACTIVITYREQUEST._serialized_end = 38527 - _RESETACTIVITYEXECUTIONREQUEST._serialized_start = 38530 - _RESETACTIVITYEXECUTIONREQUEST._serialized_end = 38820 - _RESETACTIVITYRESPONSE._serialized_start = 38822 - _RESETACTIVITYRESPONSE._serialized_end = 38845 - _RESETACTIVITYEXECUTIONRESPONSE._serialized_start = 38847 - _RESETACTIVITYEXECUTIONRESPONSE._serialized_end = 38879 - _UPDATEWORKFLOWEXECUTIONOPTIONSREQUEST._serialized_start = 38882 - _UPDATEWORKFLOWEXECUTIONOPTIONSREQUEST._serialized_end = 39166 - _UPDATEWORKFLOWEXECUTIONOPTIONSRESPONSE._serialized_start = 39169 - _UPDATEWORKFLOWEXECUTIONOPTIONSRESPONSE._serialized_end = 39346 - _DESCRIBEDEPLOYMENTREQUEST._serialized_start = 39348 - _DESCRIBEDEPLOYMENTREQUEST._serialized_end = 39454 - _DESCRIBEDEPLOYMENTRESPONSE._serialized_start = 39456 - _DESCRIBEDEPLOYMENTRESPONSE._serialized_end = 39553 - _DESCRIBEWORKERDEPLOYMENTVERSIONREQUEST._serialized_start = 39556 - _DESCRIBEWORKERDEPLOYMENTVERSIONREQUEST._serialized_end = 39750 - _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_start = 39753 - _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_end = 40405 - _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE._serialized_start = 40014 - _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE._serialized_end = 40405 - _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE_STATSBYPRIORITYKEYENTRY._serialized_start = 23740 - _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE_STATSBYPRIORITYKEYENTRY._serialized_end = 23840 - _DESCRIBEWORKERDEPLOYMENTREQUEST._serialized_start = 40407 - _DESCRIBEWORKERDEPLOYMENTREQUEST._serialized_end = 40484 - _DESCRIBEWORKERDEPLOYMENTRESPONSE._serialized_start = 40487 - _DESCRIBEWORKERDEPLOYMENTRESPONSE._serialized_end = 40627 - _LISTDEPLOYMENTSREQUEST._serialized_start = 40629 - _LISTDEPLOYMENTSREQUEST._serialized_end = 40737 - _LISTDEPLOYMENTSRESPONSE._serialized_start = 40739 - _LISTDEPLOYMENTSRESPONSE._serialized_end = 40858 - _SETCURRENTDEPLOYMENTREQUEST._serialized_start = 40861 - _SETCURRENTDEPLOYMENTREQUEST._serialized_end = 41066 - _SETCURRENTDEPLOYMENTRESPONSE._serialized_start = 41069 - _SETCURRENTDEPLOYMENTRESPONSE._serialized_end = 41254 - _SETWORKERDEPLOYMENTCURRENTVERSIONREQUEST._serialized_start = 41257 - _SETWORKERDEPLOYMENTCURRENTVERSIONREQUEST._serialized_end = 41486 - _SETWORKERDEPLOYMENTCURRENTVERSIONRESPONSE._serialized_start = 41489 - _SETWORKERDEPLOYMENTCURRENTVERSIONRESPONSE._serialized_end = 41680 - _SETWORKERDEPLOYMENTRAMPINGVERSIONREQUEST._serialized_start = 41683 - _SETWORKERDEPLOYMENTRAMPINGVERSIONREQUEST._serialized_end = 41932 - _SETWORKERDEPLOYMENTRAMPINGVERSIONRESPONSE._serialized_start = 41935 - _SETWORKERDEPLOYMENTRAMPINGVERSIONRESPONSE._serialized_end = 42159 - _CREATEWORKERDEPLOYMENTREQUEST._serialized_start = 42161 - _CREATEWORKERDEPLOYMENTREQUEST._serialized_end = 42274 - _CREATEWORKERDEPLOYMENTRESPONSE._serialized_start = 42276 - _CREATEWORKERDEPLOYMENTRESPONSE._serialized_end = 42332 - _LISTWORKERDEPLOYMENTSREQUEST._serialized_start = 42334 - _LISTWORKERDEPLOYMENTSREQUEST._serialized_end = 42427 - _LISTWORKERDEPLOYMENTSRESPONSE._serialized_start = 42430 - _LISTWORKERDEPLOYMENTSRESPONSE._serialized_end = 43101 - _LISTWORKERDEPLOYMENTSRESPONSE_WORKERDEPLOYMENTSUMMARY._serialized_start = 42605 - _LISTWORKERDEPLOYMENTSRESPONSE_WORKERDEPLOYMENTSUMMARY._serialized_end = 43101 - _CREATEWORKERDEPLOYMENTVERSIONREQUEST._serialized_start = 43104 - _CREATEWORKERDEPLOYMENTVERSIONREQUEST._serialized_end = 43344 - _CREATEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_start = 43346 - _CREATEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_end = 43385 - _DELETEWORKERDEPLOYMENTVERSIONREQUEST._serialized_start = 43388 - _DELETEWORKERDEPLOYMENTVERSIONREQUEST._serialized_end = 43588 - _DELETEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_start = 43590 - _DELETEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_end = 43629 - _DELETEWORKERDEPLOYMENTREQUEST._serialized_start = 43631 - _DELETEWORKERDEPLOYMENTREQUEST._serialized_end = 43724 - _DELETEWORKERDEPLOYMENTRESPONSE._serialized_start = 43726 - _DELETEWORKERDEPLOYMENTRESPONSE._serialized_end = 43758 - _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_start = 43761 - _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_end = 44277 - _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_start = 44154 - _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_end = 44277 - _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_start = 44279 - _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_end = 44331 - _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_start = 44334 - _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_end = 44834 - _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_start = 44154 - _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_end = 44277 - _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_start = 44836 - _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_end = 44890 - _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST._serialized_start = 44893 - _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST._serialized_end = 45311 - _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST_UPSERTENTRIESENTRY._serialized_start = 45226 + _UPDATEWORKERVERSIONINGRULESREQUEST_ADDCOMPATIBLEBUILDIDREDIRECTRULE._serialized_start = 29991 + _UPDATEWORKERVERSIONINGRULESREQUEST_ADDCOMPATIBLEBUILDIDREDIRECTRULE._serialized_end = 30097 + _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACECOMPATIBLEBUILDIDREDIRECTRULE._serialized_start = 30099 + _UPDATEWORKERVERSIONINGRULESREQUEST_REPLACECOMPATIBLEBUILDIDREDIRECTRULE._serialized_end = 30209 + _UPDATEWORKERVERSIONINGRULESREQUEST_DELETECOMPATIBLEBUILDIDREDIRECTRULE._serialized_start = 30211 + _UPDATEWORKERVERSIONINGRULESREQUEST_DELETECOMPATIBLEBUILDIDREDIRECTRULE._serialized_end = 30273 + _UPDATEWORKERVERSIONINGRULESREQUEST_COMMITBUILDID._serialized_start = 30275 + _UPDATEWORKERVERSIONINGRULESREQUEST_COMMITBUILDID._serialized_end = 30330 + _UPDATEWORKERVERSIONINGRULESRESPONSE._serialized_start = 30346 + _UPDATEWORKERVERSIONINGRULESRESPONSE._serialized_end = 30598 + _GETWORKERVERSIONINGRULESREQUEST._serialized_start = 30600 + _GETWORKERVERSIONINGRULESREQUEST._serialized_end = 30672 + _GETWORKERVERSIONINGRULESRESPONSE._serialized_start = 30675 + _GETWORKERVERSIONINGRULESRESPONSE._serialized_end = 30924 + _GETWORKERTASKREACHABILITYREQUEST._serialized_start = 30927 + _GETWORKERTASKREACHABILITYREQUEST._serialized_end = 31083 + _GETWORKERTASKREACHABILITYRESPONSE._serialized_start = 31085 + _GETWORKERTASKREACHABILITYRESPONSE._serialized_end = 31199 + _UPDATEWORKFLOWEXECUTIONREQUEST._serialized_start = 31202 + _UPDATEWORKFLOWEXECUTIONREQUEST._serialized_end = 31463 + _UPDATEWORKFLOWEXECUTIONRESPONSE._serialized_start = 31466 + _UPDATEWORKFLOWEXECUTIONRESPONSE._serialized_end = 31725 + _STARTBATCHOPERATIONREQUEST._serialized_start = 31728 + _STARTBATCHOPERATIONREQUEST._serialized_end = 33094 + _STARTBATCHOPERATIONRESPONSE._serialized_start = 33096 + _STARTBATCHOPERATIONRESPONSE._serialized_end = 33125 + _STOPBATCHOPERATIONREQUEST._serialized_start = 33127 + _STOPBATCHOPERATIONREQUEST._serialized_end = 33223 + _STOPBATCHOPERATIONRESPONSE._serialized_start = 33225 + _STOPBATCHOPERATIONRESPONSE._serialized_end = 33253 + _DESCRIBEBATCHOPERATIONREQUEST._serialized_start = 33255 + _DESCRIBEBATCHOPERATIONREQUEST._serialized_end = 33321 + _DESCRIBEBATCHOPERATIONRESPONSE._serialized_start = 33324 + _DESCRIBEBATCHOPERATIONRESPONSE._serialized_end = 33796 + _LISTBATCHOPERATIONSREQUEST._serialized_start = 33798 + _LISTBATCHOPERATIONSREQUEST._serialized_end = 33889 + _LISTBATCHOPERATIONSRESPONSE._serialized_start = 33891 + _LISTBATCHOPERATIONSRESPONSE._serialized_end = 34012 + _POLLWORKFLOWEXECUTIONUPDATEREQUEST._serialized_start = 34015 + _POLLWORKFLOWEXECUTIONUPDATEREQUEST._serialized_end = 34200 + _POLLWORKFLOWEXECUTIONUPDATERESPONSE._serialized_start = 34203 + _POLLWORKFLOWEXECUTIONUPDATERESPONSE._serialized_end = 34422 + _POLLNEXUSTASKQUEUEREQUEST._serialized_start = 34425 + _POLLNEXUSTASKQUEUEREQUEST._serialized_end = 34841 + _POLLNEXUSTASKQUEUERESPONSE._serialized_start = 34844 + _POLLNEXUSTASKQUEUERESPONSE._serialized_end = 35198 + _RESPONDNEXUSTASKCOMPLETEDREQUEST._serialized_start = 35201 + _RESPONDNEXUSTASKCOMPLETEDREQUEST._serialized_end = 35368 + _RESPONDNEXUSTASKCOMPLETEDRESPONSE._serialized_start = 35370 + _RESPONDNEXUSTASKCOMPLETEDRESPONSE._serialized_end = 35405 + _RESPONDNEXUSTASKFAILEDREQUEST._serialized_start = 35408 + _RESPONDNEXUSTASKFAILEDREQUEST._serialized_end = 35628 + _RESPONDNEXUSTASKFAILEDRESPONSE._serialized_start = 35630 + _RESPONDNEXUSTASKFAILEDRESPONSE._serialized_end = 35662 + _EXECUTEMULTIOPERATIONREQUEST._serialized_start = 35665 + _EXECUTEMULTIOPERATIONREQUEST._serialized_end = 36037 + _EXECUTEMULTIOPERATIONREQUEST_OPERATION._serialized_start = 35831 + _EXECUTEMULTIOPERATIONREQUEST_OPERATION._serialized_end = 36037 + _EXECUTEMULTIOPERATIONRESPONSE._serialized_start = 36040 + _EXECUTEMULTIOPERATIONRESPONSE._serialized_end = 36372 + _EXECUTEMULTIOPERATIONRESPONSE_RESPONSE._serialized_start = 36166 + _EXECUTEMULTIOPERATIONRESPONSE_RESPONSE._serialized_end = 36372 + _UPDATEACTIVITYOPTIONSREQUEST._serialized_start = 36375 + _UPDATEACTIVITYOPTIONSREQUEST._serialized_end = 36711 + _UPDATEACTIVITYEXECUTIONOPTIONSREQUEST._serialized_start = 36714 + _UPDATEACTIVITYEXECUTIONOPTIONSREQUEST._serialized_end = 37033 + _UPDATEACTIVITYOPTIONSRESPONSE._serialized_start = 37035 + _UPDATEACTIVITYOPTIONSRESPONSE._serialized_end = 37135 + _UPDATEACTIVITYEXECUTIONOPTIONSRESPONSE._serialized_start = 37137 + _UPDATEACTIVITYEXECUTIONOPTIONSRESPONSE._serialized_end = 37246 + _PAUSEACTIVITYREQUEST._serialized_start = 37249 + _PAUSEACTIVITYREQUEST._serialized_end = 37448 + _PAUSEACTIVITYEXECUTIONREQUEST._serialized_start = 37451 + _PAUSEACTIVITYEXECUTIONREQUEST._serialized_end = 37634 + _PAUSEACTIVITYRESPONSE._serialized_start = 37636 + _PAUSEACTIVITYRESPONSE._serialized_end = 37659 + _PAUSEACTIVITYEXECUTIONRESPONSE._serialized_start = 37661 + _PAUSEACTIVITYEXECUTIONRESPONSE._serialized_end = 37693 + _UNPAUSEACTIVITYREQUEST._serialized_start = 37696 + _UNPAUSEACTIVITYREQUEST._serialized_end = 37976 + _UNPAUSEACTIVITYEXECUTIONREQUEST._serialized_start = 37979 + _UNPAUSEACTIVITYEXECUTIONREQUEST._serialized_end = 38252 + _UNPAUSEACTIVITYRESPONSE._serialized_start = 38254 + _UNPAUSEACTIVITYRESPONSE._serialized_end = 38279 + _UNPAUSEACTIVITYEXECUTIONRESPONSE._serialized_start = 38281 + _UNPAUSEACTIVITYEXECUTIONRESPONSE._serialized_end = 38315 + _RESETACTIVITYREQUEST._serialized_start = 38318 + _RESETACTIVITYREQUEST._serialized_end = 38625 + _RESETACTIVITYEXECUTIONREQUEST._serialized_start = 38628 + _RESETACTIVITYEXECUTIONREQUEST._serialized_end = 38918 + _RESETACTIVITYRESPONSE._serialized_start = 38920 + _RESETACTIVITYRESPONSE._serialized_end = 38943 + _RESETACTIVITYEXECUTIONRESPONSE._serialized_start = 38945 + _RESETACTIVITYEXECUTIONRESPONSE._serialized_end = 38977 + _UPDATEWORKFLOWEXECUTIONOPTIONSREQUEST._serialized_start = 38980 + _UPDATEWORKFLOWEXECUTIONOPTIONSREQUEST._serialized_end = 39264 + _UPDATEWORKFLOWEXECUTIONOPTIONSRESPONSE._serialized_start = 39267 + _UPDATEWORKFLOWEXECUTIONOPTIONSRESPONSE._serialized_end = 39444 + _DESCRIBEDEPLOYMENTREQUEST._serialized_start = 39446 + _DESCRIBEDEPLOYMENTREQUEST._serialized_end = 39552 + _DESCRIBEDEPLOYMENTRESPONSE._serialized_start = 39554 + _DESCRIBEDEPLOYMENTRESPONSE._serialized_end = 39651 + _DESCRIBEWORKERDEPLOYMENTVERSIONREQUEST._serialized_start = 39654 + _DESCRIBEWORKERDEPLOYMENTVERSIONREQUEST._serialized_end = 39848 + _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_start = 39851 + _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_end = 40503 + _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE._serialized_start = 40112 + _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE._serialized_end = 40503 + _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE_STATSBYPRIORITYKEYENTRY._serialized_start = 23838 + _DESCRIBEWORKERDEPLOYMENTVERSIONRESPONSE_VERSIONTASKQUEUE_STATSBYPRIORITYKEYENTRY._serialized_end = 23938 + _DESCRIBEWORKERDEPLOYMENTREQUEST._serialized_start = 40505 + _DESCRIBEWORKERDEPLOYMENTREQUEST._serialized_end = 40582 + _DESCRIBEWORKERDEPLOYMENTRESPONSE._serialized_start = 40585 + _DESCRIBEWORKERDEPLOYMENTRESPONSE._serialized_end = 40725 + _LISTDEPLOYMENTSREQUEST._serialized_start = 40727 + _LISTDEPLOYMENTSREQUEST._serialized_end = 40835 + _LISTDEPLOYMENTSRESPONSE._serialized_start = 40837 + _LISTDEPLOYMENTSRESPONSE._serialized_end = 40956 + _SETCURRENTDEPLOYMENTREQUEST._serialized_start = 40959 + _SETCURRENTDEPLOYMENTREQUEST._serialized_end = 41164 + _SETCURRENTDEPLOYMENTRESPONSE._serialized_start = 41167 + _SETCURRENTDEPLOYMENTRESPONSE._serialized_end = 41352 + _SETWORKERDEPLOYMENTCURRENTVERSIONREQUEST._serialized_start = 41355 + _SETWORKERDEPLOYMENTCURRENTVERSIONREQUEST._serialized_end = 41584 + _SETWORKERDEPLOYMENTCURRENTVERSIONRESPONSE._serialized_start = 41587 + _SETWORKERDEPLOYMENTCURRENTVERSIONRESPONSE._serialized_end = 41778 + _SETWORKERDEPLOYMENTRAMPINGVERSIONREQUEST._serialized_start = 41781 + _SETWORKERDEPLOYMENTRAMPINGVERSIONREQUEST._serialized_end = 42030 + _SETWORKERDEPLOYMENTRAMPINGVERSIONRESPONSE._serialized_start = 42033 + _SETWORKERDEPLOYMENTRAMPINGVERSIONRESPONSE._serialized_end = 42257 + _CREATEWORKERDEPLOYMENTREQUEST._serialized_start = 42259 + _CREATEWORKERDEPLOYMENTREQUEST._serialized_end = 42372 + _CREATEWORKERDEPLOYMENTRESPONSE._serialized_start = 42374 + _CREATEWORKERDEPLOYMENTRESPONSE._serialized_end = 42430 + _LISTWORKERDEPLOYMENTSREQUEST._serialized_start = 42432 + _LISTWORKERDEPLOYMENTSREQUEST._serialized_end = 42525 + _LISTWORKERDEPLOYMENTSRESPONSE._serialized_start = 42528 + _LISTWORKERDEPLOYMENTSRESPONSE._serialized_end = 43199 + _LISTWORKERDEPLOYMENTSRESPONSE_WORKERDEPLOYMENTSUMMARY._serialized_start = 42703 + _LISTWORKERDEPLOYMENTSRESPONSE_WORKERDEPLOYMENTSUMMARY._serialized_end = 43199 + _CREATEWORKERDEPLOYMENTVERSIONREQUEST._serialized_start = 43202 + _CREATEWORKERDEPLOYMENTVERSIONREQUEST._serialized_end = 43442 + _CREATEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_start = 43444 + _CREATEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_end = 43483 + _DELETEWORKERDEPLOYMENTVERSIONREQUEST._serialized_start = 43486 + _DELETEWORKERDEPLOYMENTVERSIONREQUEST._serialized_end = 43686 + _DELETEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_start = 43688 + _DELETEWORKERDEPLOYMENTVERSIONRESPONSE._serialized_end = 43727 + _DELETEWORKERDEPLOYMENTREQUEST._serialized_start = 43729 + _DELETEWORKERDEPLOYMENTREQUEST._serialized_end = 43822 + _DELETEWORKERDEPLOYMENTRESPONSE._serialized_start = 43824 + _DELETEWORKERDEPLOYMENTRESPONSE._serialized_end = 43856 + _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_start = 43859 + _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_end = 44375 + _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_start = 44252 + _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_end = 44375 + _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_start = 44377 + _UPDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_end = 44429 + _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_start = 44432 + _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST._serialized_end = 44932 + _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_start = 44252 + _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGREQUEST_COMPUTECONFIGSCALINGGROUPSENTRY._serialized_end = 44375 + _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_start = 44934 + _VALIDATEWORKERDEPLOYMENTVERSIONCOMPUTECONFIGRESPONSE._serialized_end = 44988 + _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST._serialized_start = 44991 + _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST._serialized_end = 45409 + _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST_UPSERTENTRIESENTRY._serialized_start = 45324 _UPDATEWORKERDEPLOYMENTVERSIONMETADATAREQUEST_UPSERTENTRIESENTRY._serialized_end = ( - 45311 + 45409 ) - _UPDATEWORKERDEPLOYMENTVERSIONMETADATARESPONSE._serialized_start = 45313 - _UPDATEWORKERDEPLOYMENTVERSIONMETADATARESPONSE._serialized_end = 45423 - _SETWORKERDEPLOYMENTMANAGERREQUEST._serialized_start = 45426 - _SETWORKERDEPLOYMENTMANAGERREQUEST._serialized_end = 45615 - _SETWORKERDEPLOYMENTMANAGERRESPONSE._serialized_start = 45617 - _SETWORKERDEPLOYMENTMANAGERRESPONSE._serialized_end = 45716 - _GETCURRENTDEPLOYMENTREQUEST._serialized_start = 45718 - _GETCURRENTDEPLOYMENTREQUEST._serialized_end = 45787 - _GETCURRENTDEPLOYMENTRESPONSE._serialized_start = 45789 - _GETCURRENTDEPLOYMENTRESPONSE._serialized_end = 45896 - _GETDEPLOYMENTREACHABILITYREQUEST._serialized_start = 45898 - _GETDEPLOYMENTREACHABILITYREQUEST._serialized_end = 46011 - _GETDEPLOYMENTREACHABILITYRESPONSE._serialized_start = 46014 - _GETDEPLOYMENTREACHABILITYRESPONSE._serialized_end = 46241 - _CREATEWORKFLOWRULEREQUEST._serialized_start = 46244 - _CREATEWORKFLOWRULEREQUEST._serialized_end = 46424 - _CREATEWORKFLOWRULERESPONSE._serialized_start = 46426 - _CREATEWORKFLOWRULERESPONSE._serialized_end = 46521 - _DESCRIBEWORKFLOWRULEREQUEST._serialized_start = 46523 - _DESCRIBEWORKFLOWRULEREQUEST._serialized_end = 46588 - _DESCRIBEWORKFLOWRULERESPONSE._serialized_start = 46590 - _DESCRIBEWORKFLOWRULERESPONSE._serialized_end = 46671 - _DELETEWORKFLOWRULEREQUEST._serialized_start = 46673 - _DELETEWORKFLOWRULEREQUEST._serialized_end = 46736 - _DELETEWORKFLOWRULERESPONSE._serialized_start = 46738 - _DELETEWORKFLOWRULERESPONSE._serialized_end = 46766 - _LISTWORKFLOWRULESREQUEST._serialized_start = 46768 - _LISTWORKFLOWRULESREQUEST._serialized_end = 46838 - _LISTWORKFLOWRULESRESPONSE._serialized_start = 46840 - _LISTWORKFLOWRULESRESPONSE._serialized_end = 46944 - _TRIGGERWORKFLOWRULEREQUEST._serialized_start = 46947 - _TRIGGERWORKFLOWRULEREQUEST._serialized_end = 47153 - _TRIGGERWORKFLOWRULERESPONSE._serialized_start = 47155 - _TRIGGERWORKFLOWRULERESPONSE._serialized_end = 47201 - _RECORDWORKERHEARTBEATREQUEST._serialized_start = 47204 - _RECORDWORKERHEARTBEATREQUEST._serialized_end = 47359 - _RECORDWORKERHEARTBEATRESPONSE._serialized_start = 47361 - _RECORDWORKERHEARTBEATRESPONSE._serialized_end = 47392 - _LISTWORKERSREQUEST._serialized_start = 47395 - _LISTWORKERSREQUEST._serialized_end = 47525 - _LISTWORKERSRESPONSE._serialized_start = 47528 - _LISTWORKERSRESPONSE._serialized_end = 47693 - _UPDATETASKQUEUECONFIGREQUEST._serialized_start = 47696 - _UPDATETASKQUEUECONFIGREQUEST._serialized_end = 48421 - _UPDATETASKQUEUECONFIGREQUEST_RATELIMITUPDATE._serialized_start = 48263 - _UPDATETASKQUEUECONFIGREQUEST_RATELIMITUPDATE._serialized_end = 48354 + _UPDATEWORKERDEPLOYMENTVERSIONMETADATARESPONSE._serialized_start = 45411 + _UPDATEWORKERDEPLOYMENTVERSIONMETADATARESPONSE._serialized_end = 45521 + _SETWORKERDEPLOYMENTMANAGERREQUEST._serialized_start = 45524 + _SETWORKERDEPLOYMENTMANAGERREQUEST._serialized_end = 45713 + _SETWORKERDEPLOYMENTMANAGERRESPONSE._serialized_start = 45715 + _SETWORKERDEPLOYMENTMANAGERRESPONSE._serialized_end = 45814 + _GETCURRENTDEPLOYMENTREQUEST._serialized_start = 45816 + _GETCURRENTDEPLOYMENTREQUEST._serialized_end = 45885 + _GETCURRENTDEPLOYMENTRESPONSE._serialized_start = 45887 + _GETCURRENTDEPLOYMENTRESPONSE._serialized_end = 45994 + _GETDEPLOYMENTREACHABILITYREQUEST._serialized_start = 45996 + _GETDEPLOYMENTREACHABILITYREQUEST._serialized_end = 46109 + _GETDEPLOYMENTREACHABILITYRESPONSE._serialized_start = 46112 + _GETDEPLOYMENTREACHABILITYRESPONSE._serialized_end = 46339 + _CREATEWORKFLOWRULEREQUEST._serialized_start = 46342 + _CREATEWORKFLOWRULEREQUEST._serialized_end = 46522 + _CREATEWORKFLOWRULERESPONSE._serialized_start = 46524 + _CREATEWORKFLOWRULERESPONSE._serialized_end = 46619 + _DESCRIBEWORKFLOWRULEREQUEST._serialized_start = 46621 + _DESCRIBEWORKFLOWRULEREQUEST._serialized_end = 46686 + _DESCRIBEWORKFLOWRULERESPONSE._serialized_start = 46688 + _DESCRIBEWORKFLOWRULERESPONSE._serialized_end = 46769 + _DELETEWORKFLOWRULEREQUEST._serialized_start = 46771 + _DELETEWORKFLOWRULEREQUEST._serialized_end = 46834 + _DELETEWORKFLOWRULERESPONSE._serialized_start = 46836 + _DELETEWORKFLOWRULERESPONSE._serialized_end = 46864 + _LISTWORKFLOWRULESREQUEST._serialized_start = 46866 + _LISTWORKFLOWRULESREQUEST._serialized_end = 46936 + _LISTWORKFLOWRULESRESPONSE._serialized_start = 46938 + _LISTWORKFLOWRULESRESPONSE._serialized_end = 47042 + _TRIGGERWORKFLOWRULEREQUEST._serialized_start = 47045 + _TRIGGERWORKFLOWRULEREQUEST._serialized_end = 47251 + _TRIGGERWORKFLOWRULERESPONSE._serialized_start = 47253 + _TRIGGERWORKFLOWRULERESPONSE._serialized_end = 47299 + _RECORDWORKERHEARTBEATREQUEST._serialized_start = 47302 + _RECORDWORKERHEARTBEATREQUEST._serialized_end = 47457 + _RECORDWORKERHEARTBEATRESPONSE._serialized_start = 47459 + _RECORDWORKERHEARTBEATRESPONSE._serialized_end = 47490 + _LISTWORKERSREQUEST._serialized_start = 47493 + _LISTWORKERSREQUEST._serialized_end = 47623 + _LISTWORKERSRESPONSE._serialized_start = 47626 + _LISTWORKERSRESPONSE._serialized_end = 47791 + _UPDATETASKQUEUECONFIGREQUEST._serialized_start = 47794 + _UPDATETASKQUEUECONFIGREQUEST._serialized_end = 48519 + _UPDATETASKQUEUECONFIGREQUEST_RATELIMITUPDATE._serialized_start = 48361 + _UPDATETASKQUEUECONFIGREQUEST_RATELIMITUPDATE._serialized_end = 48452 _UPDATETASKQUEUECONFIGREQUEST_SETFAIRNESSWEIGHTOVERRIDESENTRY._serialized_start = ( - 48356 + 48454 ) _UPDATETASKQUEUECONFIGREQUEST_SETFAIRNESSWEIGHTOVERRIDESENTRY._serialized_end = ( - 48421 + 48519 ) - _UPDATETASKQUEUECONFIGRESPONSE._serialized_start = 48423 - _UPDATETASKQUEUECONFIGRESPONSE._serialized_end = 48514 - _FETCHWORKERCONFIGREQUEST._serialized_start = 48517 - _FETCHWORKERCONFIGREQUEST._serialized_end = 48675 - _FETCHWORKERCONFIGRESPONSE._serialized_start = 48677 - _FETCHWORKERCONFIGRESPONSE._serialized_end = 48762 - _UPDATEWORKERCONFIGREQUEST._serialized_start = 48765 - _UPDATEWORKERCONFIGREQUEST._serialized_end = 49031 - _UPDATEWORKERCONFIGRESPONSE._serialized_start = 49033 - _UPDATEWORKERCONFIGRESPONSE._serialized_end = 49133 - _DESCRIBEWORKERREQUEST._serialized_start = 49135 - _DESCRIBEWORKERREQUEST._serialized_end = 49206 - _DESCRIBEWORKERRESPONSE._serialized_start = 49208 - _DESCRIBEWORKERRESPONSE._serialized_end = 49289 - _COUNTWORKERSREQUEST._serialized_start = 49291 - _COUNTWORKERSREQUEST._serialized_end = 49378 - _COUNTWORKERSRESPONSE._serialized_start = 49380 - _COUNTWORKERSRESPONSE._serialized_end = 49417 - _PAUSEWORKFLOWEXECUTIONREQUEST._serialized_start = 49420 - _PAUSEWORKFLOWEXECUTIONREQUEST._serialized_end = 49561 - _PAUSEWORKFLOWEXECUTIONRESPONSE._serialized_start = 49563 - _PAUSEWORKFLOWEXECUTIONRESPONSE._serialized_end = 49595 - _UNPAUSEWORKFLOWEXECUTIONREQUEST._serialized_start = 49598 - _UNPAUSEWORKFLOWEXECUTIONREQUEST._serialized_end = 49741 - _UNPAUSEWORKFLOWEXECUTIONRESPONSE._serialized_start = 49743 - _UNPAUSEWORKFLOWEXECUTIONRESPONSE._serialized_end = 49777 - _STARTACTIVITYEXECUTIONREQUEST._serialized_start = 49780 - _STARTACTIVITYEXECUTIONREQUEST._serialized_end = 50957 - _STARTACTIVITYEXECUTIONRESPONSE._serialized_start = 50959 - _STARTACTIVITYEXECUTIONRESPONSE._serialized_end = 51068 - _DESCRIBEACTIVITYEXECUTIONREQUEST._serialized_start = 51071 - _DESCRIBEACTIVITYEXECUTIONREQUEST._serialized_end = 51299 - _DESCRIBEACTIVITYEXECUTIONRESPONSE._serialized_start = 51302 - _DESCRIBEACTIVITYEXECUTIONRESPONSE._serialized_end = 51618 - _POLLACTIVITYEXECUTIONREQUEST._serialized_start = 51620 - _POLLACTIVITYEXECUTIONREQUEST._serialized_end = 51706 - _POLLACTIVITYEXECUTIONRESPONSE._serialized_start = 51708 - _POLLACTIVITYEXECUTIONRESPONSE._serialized_end = 51824 - _LISTACTIVITYEXECUTIONSREQUEST._serialized_start = 51826 - _LISTACTIVITYEXECUTIONSREQUEST._serialized_end = 51935 - _LISTACTIVITYEXECUTIONSRESPONSE._serialized_start = 51938 - _LISTACTIVITYEXECUTIONSRESPONSE._serialized_end = 52068 - _STARTNEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 52071 - _STARTNEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 52920 - _STARTNEXUSOPERATIONEXECUTIONREQUEST_NEXUSHEADERENTRY._serialized_start = 52870 - _STARTNEXUSOPERATIONEXECUTIONREQUEST_NEXUSHEADERENTRY._serialized_end = 52920 - _STARTNEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 52922 - _STARTNEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 52993 - _DESCRIBENEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 52996 - _DESCRIBENEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 53166 - _DESCRIBENEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 53169 - _DESCRIBENEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 53480 - _POLLNEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 53483 - _POLLNEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 53644 - _POLLNEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 53647 - _POLLNEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 53908 - _LISTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_start = 53910 - _LISTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_end = 54025 - _LISTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_start = 54028 - _LISTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_end = 54167 - _COUNTACTIVITYEXECUTIONSREQUEST._serialized_start = 54169 - _COUNTACTIVITYEXECUTIONSREQUEST._serialized_end = 54235 - _COUNTACTIVITYEXECUTIONSRESPONSE._serialized_start = 54238 - _COUNTACTIVITYEXECUTIONSRESPONSE._serialized_end = 54475 - _COUNTACTIVITYEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_start = 20134 - _COUNTACTIVITYEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_end = 20222 - _COUNTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_start = 54477 - _COUNTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_end = 54549 - _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_start = 54552 - _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_end = 54801 - _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_start = 20134 - _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_end = 20222 - _REQUESTCANCELACTIVITYEXECUTIONREQUEST._serialized_start = 54804 - _REQUESTCANCELACTIVITYEXECUTIONREQUEST._serialized_end = 54953 - _REQUESTCANCELACTIVITYEXECUTIONRESPONSE._serialized_start = 54955 - _REQUESTCANCELACTIVITYEXECUTIONRESPONSE._serialized_end = 54995 - _TERMINATEACTIVITYEXECUTIONREQUEST._serialized_start = 54998 - _TERMINATEACTIVITYEXECUTIONREQUEST._serialized_end = 55143 - _TERMINATEACTIVITYEXECUTIONRESPONSE._serialized_start = 55145 - _TERMINATEACTIVITYEXECUTIONRESPONSE._serialized_end = 55181 - _DELETEACTIVITYEXECUTIONREQUEST._serialized_start = 55183 - _DELETEACTIVITYEXECUTIONREQUEST._serialized_end = 55271 - _DELETEACTIVITYEXECUTIONRESPONSE._serialized_start = 55273 - _DELETEACTIVITYEXECUTIONRESPONSE._serialized_end = 55306 - _REQUESTCANCELNEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 55309 - _REQUESTCANCELNEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 55465 - _REQUESTCANCELNEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 55467 - _REQUESTCANCELNEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 55513 - _TERMINATENEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 55516 - _TERMINATENEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 55668 - _TERMINATENEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 55670 - _TERMINATENEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 55712 - _DELETENEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 55714 - _DELETENEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 55809 - _DELETENEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 55811 - _DELETENEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 55850 - _POLLWORKFLOWEXECUTIONTIMESKIPPINGREQUEST._serialized_start = 55853 - _POLLWORKFLOWEXECUTIONTIMESKIPPINGREQUEST._serialized_end = 56010 - _POLLWORKFLOWEXECUTIONTIMESKIPPINGRESPONSE._serialized_start = 56013 - _POLLWORKFLOWEXECUTIONTIMESKIPPINGRESPONSE._serialized_end = 56245 + _UPDATETASKQUEUECONFIGRESPONSE._serialized_start = 48521 + _UPDATETASKQUEUECONFIGRESPONSE._serialized_end = 48612 + _FETCHWORKERCONFIGREQUEST._serialized_start = 48615 + _FETCHWORKERCONFIGREQUEST._serialized_end = 48773 + _FETCHWORKERCONFIGRESPONSE._serialized_start = 48775 + _FETCHWORKERCONFIGRESPONSE._serialized_end = 48860 + _UPDATEWORKERCONFIGREQUEST._serialized_start = 48863 + _UPDATEWORKERCONFIGREQUEST._serialized_end = 49129 + _UPDATEWORKERCONFIGRESPONSE._serialized_start = 49131 + _UPDATEWORKERCONFIGRESPONSE._serialized_end = 49231 + _DESCRIBEWORKERREQUEST._serialized_start = 49233 + _DESCRIBEWORKERREQUEST._serialized_end = 49304 + _DESCRIBEWORKERRESPONSE._serialized_start = 49306 + _DESCRIBEWORKERRESPONSE._serialized_end = 49387 + _COUNTWORKERSREQUEST._serialized_start = 49389 + _COUNTWORKERSREQUEST._serialized_end = 49476 + _COUNTWORKERSRESPONSE._serialized_start = 49478 + _COUNTWORKERSRESPONSE._serialized_end = 49515 + _PAUSEWORKFLOWEXECUTIONREQUEST._serialized_start = 49518 + _PAUSEWORKFLOWEXECUTIONREQUEST._serialized_end = 49659 + _PAUSEWORKFLOWEXECUTIONRESPONSE._serialized_start = 49661 + _PAUSEWORKFLOWEXECUTIONRESPONSE._serialized_end = 49693 + _UNPAUSEWORKFLOWEXECUTIONREQUEST._serialized_start = 49696 + _UNPAUSEWORKFLOWEXECUTIONREQUEST._serialized_end = 49839 + _UNPAUSEWORKFLOWEXECUTIONRESPONSE._serialized_start = 49841 + _UNPAUSEWORKFLOWEXECUTIONRESPONSE._serialized_end = 49875 + _STARTACTIVITYEXECUTIONREQUEST._serialized_start = 49878 + _STARTACTIVITYEXECUTIONREQUEST._serialized_end = 51055 + _STARTACTIVITYEXECUTIONRESPONSE._serialized_start = 51057 + _STARTACTIVITYEXECUTIONRESPONSE._serialized_end = 51166 + _DESCRIBEACTIVITYEXECUTIONREQUEST._serialized_start = 51169 + _DESCRIBEACTIVITYEXECUTIONREQUEST._serialized_end = 51397 + _DESCRIBEACTIVITYEXECUTIONRESPONSE._serialized_start = 51400 + _DESCRIBEACTIVITYEXECUTIONRESPONSE._serialized_end = 51716 + _POLLACTIVITYEXECUTIONREQUEST._serialized_start = 51718 + _POLLACTIVITYEXECUTIONREQUEST._serialized_end = 51804 + _POLLACTIVITYEXECUTIONRESPONSE._serialized_start = 51806 + _POLLACTIVITYEXECUTIONRESPONSE._serialized_end = 51922 + _LISTACTIVITYEXECUTIONSREQUEST._serialized_start = 51924 + _LISTACTIVITYEXECUTIONSREQUEST._serialized_end = 52033 + _LISTACTIVITYEXECUTIONSRESPONSE._serialized_start = 52036 + _LISTACTIVITYEXECUTIONSRESPONSE._serialized_end = 52166 + _STARTNEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 52169 + _STARTNEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 53018 + _STARTNEXUSOPERATIONEXECUTIONREQUEST_NEXUSHEADERENTRY._serialized_start = 52968 + _STARTNEXUSOPERATIONEXECUTIONREQUEST_NEXUSHEADERENTRY._serialized_end = 53018 + _STARTNEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 53020 + _STARTNEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 53091 + _DESCRIBENEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 53094 + _DESCRIBENEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 53264 + _DESCRIBENEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 53267 + _DESCRIBENEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 53578 + _POLLNEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 53581 + _POLLNEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 53742 + _POLLNEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 53745 + _POLLNEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 54006 + _LISTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_start = 54008 + _LISTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_end = 54123 + _LISTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_start = 54126 + _LISTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_end = 54265 + _COUNTACTIVITYEXECUTIONSREQUEST._serialized_start = 54267 + _COUNTACTIVITYEXECUTIONSREQUEST._serialized_end = 54333 + _COUNTACTIVITYEXECUTIONSRESPONSE._serialized_start = 54336 + _COUNTACTIVITYEXECUTIONSRESPONSE._serialized_end = 54573 + _COUNTACTIVITYEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_start = 20232 + _COUNTACTIVITYEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_end = 20320 + _COUNTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_start = 54575 + _COUNTNEXUSOPERATIONEXECUTIONSREQUEST._serialized_end = 54647 + _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_start = 54650 + _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE._serialized_end = 54899 + _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_start = 20232 + _COUNTNEXUSOPERATIONEXECUTIONSRESPONSE_AGGREGATIONGROUP._serialized_end = 20320 + _REQUESTCANCELACTIVITYEXECUTIONREQUEST._serialized_start = 54902 + _REQUESTCANCELACTIVITYEXECUTIONREQUEST._serialized_end = 55051 + _REQUESTCANCELACTIVITYEXECUTIONRESPONSE._serialized_start = 55053 + _REQUESTCANCELACTIVITYEXECUTIONRESPONSE._serialized_end = 55093 + _TERMINATEACTIVITYEXECUTIONREQUEST._serialized_start = 55096 + _TERMINATEACTIVITYEXECUTIONREQUEST._serialized_end = 55241 + _TERMINATEACTIVITYEXECUTIONRESPONSE._serialized_start = 55243 + _TERMINATEACTIVITYEXECUTIONRESPONSE._serialized_end = 55279 + _DELETEACTIVITYEXECUTIONREQUEST._serialized_start = 55281 + _DELETEACTIVITYEXECUTIONREQUEST._serialized_end = 55369 + _DELETEACTIVITYEXECUTIONRESPONSE._serialized_start = 55371 + _DELETEACTIVITYEXECUTIONRESPONSE._serialized_end = 55404 + _REQUESTCANCELNEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 55407 + _REQUESTCANCELNEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 55563 + _REQUESTCANCELNEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 55565 + _REQUESTCANCELNEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 55611 + _TERMINATENEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 55614 + _TERMINATENEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 55766 + _TERMINATENEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 55768 + _TERMINATENEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 55810 + _DELETENEXUSOPERATIONEXECUTIONREQUEST._serialized_start = 55812 + _DELETENEXUSOPERATIONEXECUTIONREQUEST._serialized_end = 55907 + _DELETENEXUSOPERATIONEXECUTIONRESPONSE._serialized_start = 55909 + _DELETENEXUSOPERATIONEXECUTIONRESPONSE._serialized_end = 55948 + _POLLWORKFLOWEXECUTIONTIMESKIPPINGREQUEST._serialized_start = 55951 + _POLLWORKFLOWEXECUTIONTIMESKIPPINGREQUEST._serialized_end = 56108 + _POLLWORKFLOWEXECUTIONTIMESKIPPINGRESPONSE._serialized_start = 56111 + _POLLWORKFLOWEXECUTIONTIMESKIPPINGRESPONSE._serialized_end = 56343 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/api/workflowservice/v1/request_response_pb2.pyi b/temporalio/api/workflowservice/v1/request_response_pb2.pyi index eb9243716..e66c90384 100644 --- a/temporalio/api/workflowservice/v1/request_response_pb2.pyi +++ b/temporalio/api/workflowservice/v1/request_response_pb2.pyi @@ -46,6 +46,7 @@ import temporalio.api.schedule.v1.message_pb2 import temporalio.api.sdk.v1.task_complete_metadata_pb2 import temporalio.api.sdk.v1.user_metadata_pb2 import temporalio.api.sdk.v1.worker_config_pb2 +import temporalio.api.stream.v1.message_pb2 import temporalio.api.taskqueue.v1.message_pb2 import temporalio.api.update.v1.message_pb2 import temporalio.api.version.v1.message_pb2 @@ -1278,6 +1279,7 @@ class PollWorkflowTaskQueueResponse(google.protobuf.message.Message): POLLER_GROUP_ID_FIELD_NUMBER: builtins.int POLLER_GROUP_INFOS_FIELD_NUMBER: builtins.int POLLER_GROUPS_INFO_FIELD_NUMBER: builtins.int + STREAM_SLICES_FIELD_NUMBER: builtins.int task_token: builtins.bytes """A unique identifier for this task""" @property @@ -1392,6 +1394,15 @@ class PollWorkflowTaskQueueResponse(google.protobuf.message.Message): 3. If every group has some pending polls, assign the next poll to a group randomly according to the weights. """ + @property + def stream_slices( + self, + ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[ + temporalio.api.stream.v1.message_pb2.StreamSlice + ]: + """Stream data attached to this task. Delivered out of band so the payloads + never enter History; only the offset ranges are recorded there. + """ def __init__( self, *, @@ -1427,6 +1438,10 @@ class PollWorkflowTaskQueueResponse(google.protobuf.message.Message): | None = ..., poller_groups_info: temporalio.api.taskqueue.v1.message_pb2.PollerGroupsInfo | None = ..., + stream_slices: collections.abc.Iterable[ + temporalio.api.stream.v1.message_pb2.StreamSlice + ] + | None = ..., ) -> None: ... def HasField( self, @@ -1484,6 +1499,8 @@ class PollWorkflowTaskQueueResponse(google.protobuf.message.Message): b"started_event_id", "started_time", b"started_time", + "stream_slices", + b"stream_slices", "task_token", b"task_token", "workflow_execution", From 1effd48cccc5c317f9cae308a5482d4720c3db33 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 01:54:17 -0700 Subject: [PATCH 25/51] Split the stream provider in two and made the proto the record. The registry, its string names and the private frame envelope go. A provider is an object that serves workers as a plugin and hands out handles outside them, and every store keeps the StreamRecord proto. --- temporalio/streams/__init__.py | 204 ++------- temporalio/streams/_frame.py | 72 --- temporalio/streams/_handles.py | 211 --------- temporalio/streams/_ids.py | 19 +- temporalio/streams/_policy.py | 33 +- temporalio/streams/_provider.py | 487 +++++++------------- temporalio/streams/_record.py | 58 ++- temporalio/streams/_wire.py | 181 ++++++++ temporalio/streams/providers/__init__.py | 79 +++- temporalio/streams/providers/memory.py | 545 +++++++++++++---------- 10 files changed, 832 insertions(+), 1057 deletions(-) delete mode 100644 temporalio/streams/_frame.py delete mode 100644 temporalio/streams/_handles.py create mode 100644 temporalio/streams/_wire.py diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index 0b43830cb..30d1f9a98 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -1,69 +1,58 @@ -"""A stream a workflow can read, decide on, and write. +"""Streams: a channel a workflow reads, decides on, and writes. + +.. warning:: + This module is experimental and may change in future versions. The + design is meant to be the shape that goes GA; the label is the SDK's + release convention, not a licence to break it. The contract, in five statements: -1. **A workflow publishes only to its own stream, and it publishes - transactionally.** :meth:`StreamWriter.publish` returns without the record - being visible. The record appears when the workflow task is accepted, and - never if the task fails, so no reader can see a decision the workflow did - not commit. +1. **A workflow publishes only to topics of its own stream, and it publishes + transactionally.** :meth:`temporalio.workflow.StreamWriter.publish` + returns at once. The record is visible when the Workflow Task is accepted, + and never if the task fails, so no reader can see a decision the workflow + did not commit. 2. **Reading is an observation, and the SDK records it.** What - :class:`StreamReader` handed to workflow code, including the boundary where - it found nothing, is committed with the commands that reading produced. - Recovery re-supplies the same records in the same order. -3. **Anything that does I/O publishes on its own account.** An activity, a - local activity, or an outside process writes through :func:`producer`, - either into one of the workflow's inbound streams or onto a topic of the - stream the workflow publishes, and its records are visible as soon as they - are written. It carries a producer id, an attempt and a sequence so a retry - can be told from a new generation. + :class:`temporalio.workflow.StreamReader` handed to workflow code, + including the boundary where it found nothing, is committed with the + commands that reading produced. Recovery re-supplies the same records in + the same order. +3. **Anything that does I/O publishes on its own account.** An activity or an + outside process writes through a :class:`StreamProducer` with a producer + id, an attempt and a sequence, and its records are visible as soon as the + store accepts them. Those three let a reader tell a retry from a new + generation. 4. **A cursor is opaque and belongs to its provider.** Hand it back to resume - after the record it names. Do not compare two cursors or do arithmetic on - one: one provider numbers records with integers and another with a - millisecond-and-sequence pair. A reader that wants to follow from now asks - the consumer for :meth:`Consumer.latest` instead of guessing a position. -5. **A workflow names its streams relative to itself, and the provider - resolves them.** ``reader("inputs")`` is this workflow's inbound stream - called ``inputs``; ``writer("decisions")`` is a topic it publishes on. One - provider stores that as a namespace-level stream id and another as a name - under the run's chain key, and workflow code does not have to know which. - The provider itself is chosen when the worker is built. - -Outside a workflow there is no worker to carry the choice, so a process calls -:func:`configure` once before it opens a :func:`producer` or a -:func:`consumer`, and passes :func:`worker_options` to its ``Worker`` and -``Replayer``. Those two calls are where a provider is named. Nothing else in -this module mentions one. Code that needs a second provider next to the -process default, such as a handler that serves one store while its process -talks to another, holds one from :func:`instance`. - -Three lifecycle hooks let a provider borrow the caller's lifetime, and each -is a no-op on a provider that needs nothing, so portable code calls all -three unconditionally: :func:`prepare` from the workflow's constructor, for a -transport that registers handlers on the workflow; :func:`drain` before the -workflow returns, for one that parks readers against the run; and -:func:`close`, awaited when the process is done with streams, for one that -holds connections. - -Reading somebody else's stream is out of scope for the first release. It is -the topology no provider has evidence for, and leaving it out is what lets -every provider implement the rest. + strictly after the record it names; :meth:`StreamHandle.latest` positions a + follower. Do not compare two cursors or do arithmetic on one. +5. **A workflow addresses its streams relative to itself, by topic.** A topic + can be written by the workflow and by outside producers, and read by the + workflow and by outside consumers; which of those happen is the + application's business. + +Workflow-side entry points live in :mod:`temporalio.workflow`: +:func:`temporalio.workflow.stream_reader` and +:func:`temporalio.workflow.stream_writer`. Outside a workflow, a handle comes +from a provider instance: ``provider.get_stream_handle(client, workflow_id)``. +A provider is an object; when it serves workers it is also a +:class:`temporalio.worker.Plugin`, passed as ``Worker(plugins=[provider])`` +and ``Replayer(plugins=[provider])``. This module keeps the shared types, the +errors and the protocols a provider implements; nothing here that workflow +code imports does I/O. What the contract does not promise: that a :attr:`RecordKind.FINISH` record means the writing activity succeeded, that a superseded attempt's records can be withdrawn, or that a stream outlives the retention its provider is -configured for. +configured for. Reading somebody else's stream is out of scope for this +release. -The public names are the proposal; providers live under -:mod:`temporalio.streams.providers`, one module each, registered by name and -chosen by :func:`configure`. Everything else is shared. +The record on the wire is ``temporal.api.stream.v1.StreamRecord`` on every +provider, with the user's value in ``body`` as an ordinary payload, so a +reader in any language decodes the same bytes and a payload codec applies. """ from __future__ import annotations -from datetime import timedelta -from typing import Any, TypeVar, overload - from temporalio.streams._errors import ( StreamCursorError, StreamError, @@ -71,27 +60,13 @@ StreamProducerError, StreamUnsupportedError, ) -from temporalio.streams._handles import ( - ReadSource, - StreamReader, - StreamWriter, - WriteSink, -) from temporalio.streams._provider import ( - Consumer, - Producer, + ReadSource, + StreamHandle, + StreamProducer, StreamProvider, - StreamProviderLifecycle, - close, - configure, - consumer, - drain, - instance, - open_read, - open_write, - prepare, - producer, - worker_options, + WorkflowStreamProvider, + WriteSink, ) from temporalio.streams._record import ( BEGINNING, @@ -103,100 +78,19 @@ __all__ = [ "BEGINNING", - "Consumer", "Cursor", - "Producer", "ReadSource", "RecordKind", "StreamCursorError", "StreamError", + "StreamHandle", "StreamNotFoundError", + "StreamProducer", "StreamProducerError", "StreamProvider", - "StreamProviderLifecycle", - "StreamReader", "StreamRecord", "StreamUnsupportedError", - "StreamWriter", "Supersession", + "WorkflowStreamProvider", "WriteSink", - "close", - "configure", - "consumer", - "drain", - "instance", - "prepare", - "producer", - "reader", - "worker_options", - "writer", ] - -T = TypeVar("T") - - -@overload -def reader( - stream: str, - *, - type: type[T], - after: Cursor = ..., - idle_timeout: timedelta | None = ..., -) -> StreamReader[T]: ... - - -@overload -def reader( - stream: str, - *, - type: None = None, - after: Cursor = ..., - idle_timeout: timedelta | None = ..., -) -> StreamReader[Any]: ... - - -def reader( - stream: str, - *, - type: type | None = None, - after: Cursor = BEGINNING, - idle_timeout: timedelta | None = None, -) -> StreamReader[Any]: - """Subscribe this workflow to its inbound stream ``stream``. - - Each call is a separate subscription with its own cursor, so adding, - removing or reordering one renumbers the waits after it. Gate a change - behind :func:`temporalio.workflow.patched` as you would for a timer. - - An inbound stream has no topics: its name is the whole address, and - every record on it arrives with an empty ``topic``. Topics belong to the - stream the workflow publishes, which :func:`consumer` reads from outside. - - Args: - stream: The inbound stream's name, relative to this workflow. - type: The value type, used as the decode hint. - after: Resume after this record. Only honoured on the first - subscription of a run, because after that the recorded cursor - decides. - idle_timeout: How long the workflow waits with nothing arriving before - the provider is allowed to release the worker. ``None`` takes the - provider's default. - """ - return StreamReader( - open_read(stream, after=after, idle_timeout=idle_timeout), type=type - ) - - -def writer(topic: str) -> StreamWriter[Any]: - """Publish to ``topic`` on the stream this workflow owns. - - Args: - topic: The topic name. Encoding follows each published value. - """ - return StreamWriter(open_write(topic), topic) - - -# Importing the package registers every provider whose dependencies are -# present in this tree. Import order matters: the registry above must exist -# before a provider module can register with it. -from temporalio.streams import providers as providers # noqa: E402 diff --git a/temporalio/streams/_frame.py b/temporalio/streams/_frame.py deleted file mode 100644 index df4b4dbd6..000000000 --- a/temporalio/streams/_frame.py +++ /dev/null @@ -1,72 +0,0 @@ -"""The record envelope every provider puts on the wire. - -A provider stores an opaque body. The contract needs more than a body: which -topic a record belongs to, whether it is data or a terminal marker, and which -producer attempt wrote it. No provider carries all of that in a channel of -its own, so the interface carries it here and each provider stores the result -as an ordinary body. - -Encoding is synchronous and deterministic because a workflow publishes on the -workflow thread. The header is JSON with sorted keys for that reason, and -because a stored record that a person can read is worth more during an -incident than a few saved bytes. -""" - -from __future__ import annotations - -import json -from typing import Any - -from temporalio.streams._record import RecordKind - -__all__ = ["decode", "encode"] - -_MAGIC = b"tsf1" - - -def encode( - *, - topic: str, - kind: RecordKind, - producer: str, - attempt: int, - sequence: int, - body: bytes, -) -> bytes: - """Wrap one already-encoded body with the contract's metadata.""" - header: dict[str, Any] = {"k": int(kind), "t": topic} - # Omitted rather than written as a default, so a workflow's own publish - # does not carry three fields that only mean something for a producer. - if producer: - header["p"] = producer - if attempt: - header["a"] = attempt - if sequence >= 0: - header["s"] = sequence - raw = json.dumps(header, sort_keys=True, separators=(",", ":")).encode() - return _MAGIC + len(raw).to_bytes(4, "big") + raw + body - - -def decode(frame: bytes) -> tuple[RecordKind, str, str, int, int, bytes]: - """Split a frame into ``(kind, topic, producer, attempt, sequence, body)``. - - Raises: - ValueError: The bytes are not a frame this interface wrote. Reading a - stream someone else populated is a real case, so it fails with a - name rather than an index error. - """ - if len(frame) < 8 or frame[:4] != _MAGIC: - raise ValueError( - "this record was not written through the stream interface, so its " - "topic and producer are unknown" - ) - size = int.from_bytes(frame[4:8], "big") - header = json.loads(frame[8 : 8 + size]) - return ( - RecordKind(header.get("k", int(RecordKind.DATA))), - header.get("t", ""), - header.get("p", ""), - int(header.get("a", 0)), - int(header.get("s", -1)), - frame[8 + size :], - ) diff --git a/temporalio/streams/_handles.py b/temporalio/streams/_handles.py deleted file mode 100644 index 6d821f32c..000000000 --- a/temporalio/streams/_handles.py +++ /dev/null @@ -1,211 +0,0 @@ -"""The handles workflow code holds. - -Everything provider-specific sits behind the two protocols at the top. A -handle converts values, frames records and synthesizes supersession; a -provider only moves bytes. -""" - -from __future__ import annotations - -from collections.abc import AsyncIterator -from typing import Any, Generic, Protocol, TypeVar, cast - -from temporalio import workflow -from temporalio.api.common.v1 import Payload -from temporalio.streams import _frame -from temporalio.streams._policy import AttemptTracker -from temporalio.streams._record import Cursor, RecordKind, StreamRecord - -__all__ = ["ReadSource", "StreamReader", "StreamWriter", "WriteSink"] - -T = TypeVar("T") - - -class ReadSource(Protocol): - """One subscription, as a provider supplies it.""" - - async def next_batch(self) -> list[tuple[Cursor, bytes]]: - """The next records, waiting until there is at least one. - - A batch rather than a record because delivery boundaries are what a - provider actually records, and flattening them here keeps that out of - the contract. - - Raises: - StopAsyncIteration: This subscription has ended. - """ - ... - - def close(self) -> None: - """End the subscription. Idempotent.""" - ... - - -class WriteSink(Protocol): - """One topic on the stream the running workflow owns.""" - - async def publish(self, frame: bytes) -> None: - """Accept one framed record into this workflow task's output. - - Awaitable because a provider may hold the publisher back when its - batch is full. It does not mean the record is visible: it becomes - visible when the workflow task is accepted. - """ - ... - - -def _encode_value(value: Any) -> bytes: - converter = workflow.payload_converter() - payload = value if isinstance(value, Payload) else converter.to_payloads([value])[0] - return payload.SerializeToString() - - -def _decode_value(body: bytes, as_type: type | None) -> Any: - converter = workflow.payload_converter() - payload = Payload() - payload.ParseFromString(body) - if as_type is None: - return converter.from_payloads([payload])[0] - return converter.from_payloads([payload], [as_type])[0] - - -class StreamWriter(Generic[T]): - """Publishes to a topic on the stream this workflow owns. - - A workflow can only publish transactionally to a stream it owns, on - every provider. Writing to somebody else's stream is an activity's job, - and it gets the weaker guarantee that goes with doing I/O. - """ - - def __init__(self, sink: WriteSink, topic: str) -> None: - """Prefer :func:`temporalio.streams.writer`.""" - self._sink = sink - self._topic = topic - self._finished = False - - @property - def topic(self) -> str: - """The topic this writer is bound to.""" - return self._topic - - async def publish(self, value: T) -> None: - """Append ``value`` to this topic. - - Returning does not mean the record is visible. It becomes visible when - this workflow task is accepted, and never at all if the task fails, so - a reader cannot see a decision the workflow did not commit. - """ - if self._finished: - raise RuntimeError(f"topic {self._topic!r} was already finished") - await self._sink.publish( - _frame.encode( - topic=self._topic, - kind=RecordKind.DATA, - producer="", - attempt=0, - sequence=-1, - body=_encode_value(value), - ) - ) - - async def finish(self) -> None: - """Declare this topic complete. - - Says the writer has nothing more to send. It does not say the workflow - or the activity behind it succeeded, and a reader that treats it that - way will accept output from an attempt that later timed out. - """ - if self._finished: - return - self._finished = True - await self._sink.publish( - _frame.encode( - topic=self._topic, - kind=RecordKind.FINISH, - producer="", - attempt=0, - sequence=-1, - body=b"", - ) - ) - - -class StreamReader(Generic[T]): - """Reads an inbound stream from inside workflow code. - - Iterating yields every kind of record, including the supersession the - reader synthesizes when a producer's newer attempt appears. Check - ``record.kind``, or use :meth:`values` when the workflow genuinely only - wants data. - """ - - def __init__(self, source: ReadSource, *, type: type | None = None) -> None: - """Prefer :func:`temporalio.streams.reader`.""" - self._source = source - self._type = type - self._pending: list[StreamRecord[Any]] = [] - self._attempts = AttemptTracker() - self._closed = False - - def __aiter__(self) -> AsyncIterator[StreamRecord[T]]: - """Iterate records until the reader is closed.""" - return self._iterate() - - async def _iterate(self) -> AsyncIterator[StreamRecord[T]]: - while not self._closed: - try: - record = await self._next() - except StopAsyncIteration: - # The provider ended the subscription. Iteration stops rather - # than raising, so a workflow that reads to the end of a - # finished stream leaves the loop instead of failing its task. - return - yield record - - async def values(self) -> AsyncIterator[T]: - """Iterate the data values, dropping control records.""" - async for record in self: - if record.kind is RecordKind.DATA: - yield cast("T", record.value) - - async def _next(self) -> StreamRecord[T]: - while not self._pending: - await self._fill() - return self._pending.pop(0) - - async def _fill(self) -> None: - for cursor, frame in await self._source.next_batch(): - try: - kind, topic, producer, attempt, sequence, body = _frame.decode(frame) - except ValueError as error: - # Skipped rather than raised: a poisoned record would - # otherwise fail this task on every retry and pin the - # workflow, while an outside reader of the same stream - # skips it. The two readers agree on the answer. - workflow.logger.warning( - "skipping stream record at %s: %s", cursor, error - ) - continue - superseded = self._attempts.note(producer, attempt, cursor) - if superseded is not None: - self._pending.append(superseded) - self._pending.append( - StreamRecord( - value=( - _decode_value(body, self._type) - if kind is RecordKind.DATA - else None - ), - cursor=cursor, - kind=kind, - topic=topic, - producer=producer, - attempt=attempt, - sequence=sequence, - ) - ) - - def close(self) -> None: - """End the subscription. Idempotent.""" - self._closed = True - self._source.close() diff --git a/temporalio/streams/_ids.py b/temporalio/streams/_ids.py index 5f4161053..2a76dcf19 100644 --- a/temporalio/streams/_ids.py +++ b/temporalio/streams/_ids.py @@ -1,14 +1,14 @@ -"""The store key a provider derives from a workflow id and a stream name. +"""The store key a provider derives from a workflow id and a topic. A workflow id may contain any character, ``:`` included, so joining the pair with a bare ``:`` is ambiguous: ``("a:b", "c")`` and ``("a", "b:c")`` would land in one store. Every provider that keys a store by the pair goes through -:func:`inbound_stream_id`, so they all agree and none of them collides. +:func:`topic_key`, so they all agree and none of them collides. """ from __future__ import annotations -__all__ = ["inbound_stream_id"] +__all__ = ["topic_key"] def _escape(component: str) -> str: @@ -17,15 +17,10 @@ def _escape(component: str) -> str: return component.replace("%", "%25").replace(":", "%3A") -def inbound_stream_id(workflow_id: str, stream: str) -> str: - """The store id for inbound ``stream`` of ``workflow_id``. - - With an empty ``stream`` it is the id of the stream the workflow itself - publishes, so one function keys both. +def topic_key(workflow_id: str, topic: str) -> str: + """The store key for ``topic`` of ``workflow_id``'s stream. Both components are percent-encoded before joining, so the only bare ``:`` - in the result is the separator, and an owner-stream key has none. + in the result is the separator. """ - if not stream: - return _escape(workflow_id) - return f"{_escape(workflow_id)}:{_escape(stream)}" + return f"{_escape(workflow_id)}:{_escape(topic)}" diff --git a/temporalio/streams/_policy.py b/temporalio/streams/_policy.py index 73114bbdb..81949e4fc 100644 --- a/temporalio/streams/_policy.py +++ b/temporalio/streams/_policy.py @@ -12,6 +12,8 @@ from __future__ import annotations +from typing import Any + from temporalio.streams._record import ( Cursor, RecordKind, @@ -30,28 +32,35 @@ def __init__(self) -> None: self._attempts: dict[str, int] = {} def note( - self, producer: str, attempt: int, cursor: Cursor - ) -> StreamRecord[Supersession] | None: + self, producer_id: str, attempt: int, *, topic: str, previous: Cursor + ) -> StreamRecord[Any] | None: """A supersession record when this record starts a newer attempt. + ``previous`` is the cursor of the last record delivered before the one + being noted, or the cursor the read started from. The synthesized + record carries it, so a consumer that checkpoints the supersession and + resumes after it is handed the new attempt's first record next rather + than skipping it. + A producer that declares no attempt supersedes nothing, because there is no generation to compare. That is the same answer as an unnumbered record: the interface reports what it was told and invents nothing. """ - if not producer or attempt <= 0: + if not producer_id or attempt <= 0: return None - previous = self._attempts.get(producer, 0) - if attempt <= previous: + seen = self._attempts.get(producer_id, 0) + if attempt <= seen: return None - self._attempts[producer] = attempt - if previous == 0: + self._attempts[producer_id] = attempt + if seen == 0: return None return StreamRecord( - value=Supersession( - producer=producer, previous_attempt=previous, attempt=attempt - ), - cursor=cursor, kind=RecordKind.SUPERSEDED, - producer=producer, + cursor=previous, + topic=topic, + producer_id=producer_id, attempt=attempt, + supersession=Supersession( + producer_id=producer_id, previous_attempt=seen, attempt=attempt + ), ) diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 89e32a2c7..6992f0a14 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -1,418 +1,253 @@ -"""The provider registry: where a process names its stream provider. - -A provider only moves bytes. The handles, records, framing and supersession -around it are shared, so every provider module is small: it implements -:class:`StreamProvider` and registers a factory under a short name when it is -imported. One :func:`configure` call decides which factory serves this -process; :func:`worker_options` makes the same choice for a worker when -exactly one provider is registered. +"""What a provider implements, in two halves. + +:class:`WorkflowStreamProvider` runs on the workflow thread and must keep the +contract's first two rules: publishes commit with the Workflow Task, and reads +are recorded observations. Nothing it needs may do I/O. :class:`StreamProvider` +is the half a process holds: it makes the workflow half for a worker and hands +out :class:`StreamHandle` objects to code outside a workflow. A Python provider +usually implements both on one class; the split is what lets a language whose +workflow code is bundled separately name the two halves in two packages. + +A provider only moves ``temporal.api.stream.v1.StreamRecord`` protos. The +handles around it convert values, synthesize supersession and mint cursors. """ from __future__ import annotations from collections.abc import AsyncGenerator -from datetime import timedelta -from typing import Any, Callable, Protocol, TypeVar, overload +from typing import TYPE_CHECKING, Any, Protocol, TypeVar, overload -from temporalio import activity -from temporalio.streams._handles import ReadSource, WriteSink +from temporalio.api.stream.v1 import StreamRecord as WireRecord from temporalio.streams._record import BEGINNING, Cursor, StreamRecord +if TYPE_CHECKING: + from temporalio.client import Client + __all__ = [ - "Consumer", - "Producer", + "ReadSource", + "StreamHandle", + "StreamProducer", "StreamProvider", - "StreamProviderLifecycle", - "check_topic", - "close", - "configure", - "consumer", - "drain", - "instance", - "open_read", - "open_write", - "prepare", - "producer", - "register", - "registered", - "worker_options", + "WorkflowStreamProvider", + "WriteSink", ] T = TypeVar("T") -class Producer(Protocol): - """Appends to a stream from outside workflow code. +class StreamProducer(Protocol): + """Appends to one topic from outside workflow code. - Every append is visible as soon as the provider accepts it, and carries - the producer id, attempt and sequence that let a reader tell a retried - append from a new generation. + Every append is visible as soon as the store accepts it, and carries the + producer id, attempt and sequence that let a reader tell a retried append + from a new generation. """ + @property + def producer_id(self) -> str: + """Who this producer writes as.""" + ... + @property def attempt(self) -> int: - """The generation this producer is writing.""" + """The generation this producer is writing, or 0 when undeclared.""" ... async def append(self, *values: Any) -> Cursor | None: - """Append values and return the cursor of the last one written. - - The last rather than the first, so ``read(after=appended)`` yields - only what came later. ``None`` when nothing was written, because the - batch was empty or a repeat the provider dropped, and on a transport - that learns positions only at read time; a caller that needs to - position itself on such a transport asks :meth:`Consumer.latest`. + """Append ``values`` and return the cursor of the last record as the store holds it. + + A repeat of an earlier append (same producer, attempt and sequence) is + written once and returns the position the original landed at. An + empty call writes nothing and returns the same value a repeat would: + the position of this producer's last record, or ``BEGINNING`` when it + has written none. ``None`` means one thing only: this provider learns + positions at read time, and a caller that needs one positions itself + with :meth:`StreamHandle.latest`. + + Raises: + StreamProducerError: The attempt or sequence conflicts with what + the store holds. """ ... async def finish(self) -> None: - """Declare this producer's output complete.""" + """Write ``FINISH`` for this producer on this topic. + + Says this producer has nothing more to send. It does not say the + activity behind it succeeded, and it does not end anyone's read. + """ ... -class Consumer(Protocol): - """Reads a stream from outside workflow code, resumably.""" +class StreamHandle(Protocol): + """One workflow's stream, addressed by topic, from outside workflow code. + + A handle follows the workflow's execution chain unless it was opened with + a ``run_id``, in which case it is pinned to that run. A transport failure + surfaces as :class:`temporalio.service.RPCError`, never as the transport's + own exception type. + """ @overload def read( - self, - *, - after: Cursor = ..., - topic: str | None = ..., - type: type[T], + self, *, topic: str, after: Cursor = ..., result_type: type[T] ) -> AsyncGenerator[StreamRecord[T], None]: ... @overload def read( - self, - *, - after: Cursor = ..., - topic: str | None = ..., - type: None = None, + self, *, topic: str, after: Cursor = ..., result_type: None = None ) -> AsyncGenerator[StreamRecord[Any], None]: ... def read( self, *, + topic: str, after: Cursor = BEGINNING, - topic: str | None = None, - type: type | None = None, + result_type: type | None = None, ) -> AsyncGenerator[StreamRecord[Any], None]: - """Yield the records after ``after`` as they arrive. - - ``BEGINNING`` yields everything the stream retains. Any other cursor - came from a record this or another reader saw, and reading resumes - just past it, so a reader that stores the last cursor it handled and - hands it back sees every record exactly once. ``topic`` filters the - stream the workflow publishes; an inbound stream has no topics, and - naming one there raises ``ValueError``. The result is a generator so - a caller that stops early can ``aclose()`` it and release whatever - the provider parked against the store. + """Yield the records on ``topic`` after ``after`` as they arrive. + + ``BEGINNING`` yields everything the topic retains. Any other cursor + came from a record a reader saw, and reading resumes just past it, so + a reader that stores the last cursor it handled and hands it back + sees every record exactly once. The read ends when the owning + execution, or its chain, is closed and every retained record after + ``after`` has been delivered; until then it waits. The result is a + generator, so a caller that stops early can ``aclose()`` it and + release whatever the provider parked against the store. + + Raises: + StreamCursorError: ``after`` came from another provider or names + a record no longer retained. Raised by this call, not by the + first iteration. + StreamNotFoundError: The workflow or topic does not exist or is + past retention. """ ... - async def latest(self, *, topic: str | None = None) -> Cursor: - """The cursor of the newest record, or ``BEGINNING`` when there is none. + async def latest(self, *, topic: str) -> Cursor: + """The cursor of the newest record on ``topic``, or ``BEGINNING`` when empty. For a reader that wants to follow from now: ``read(after=latest())`` yields only what is published after this call returned, which is how a client that is about to send a message positions itself before - sending, without the workflow having to report a position. ``topic`` - is for the provider that keeps each topic in its own store. + sending, without the workflow having to report a position. """ ... + def producer( + self, *, topic: str, producer_id: str = "", attempt: int = 0 + ) -> StreamProducer: + """A producer on ``topic``. -class StreamProvider(Protocol): - """What a provider module implements. + Inside an activity, leave ``producer_id`` and ``attempt`` unset: the + activity's own id and attempt are the right answer, and they are what + let a reader tell a retry from a new generation. Outside one, + ``producer_id`` is required and an empty one raises ``ValueError``. + """ + ... - The workflow-side pair (:meth:`open_read`, :meth:`open_write`) runs inside - workflow code and must keep the contract's first two rules: publishes - commit with the workflow task, and reads are recorded observations. The - outside pair (:meth:`producer`, :meth:`consumer`) runs anywhere and moves - framed bytes. A transport-only provider may serve just the outside pair - and raise on the workflow side, naming the provider a worker should use. - A provider whose transport parks something against the running workflow - also implements :class:`StreamProviderLifecycle`. - """ +class ReadSource(Protocol): + """One subscription, as a provider supplies it to the workflow thread.""" - name: str + async def next_batch(self) -> list[tuple[Cursor, WireRecord]]: + """The next records with their positions, waiting until there is at least one. - def configure(self, **options: Any) -> None: - """Accept this provider's process-level options.""" - ... + A batch rather than a record because delivery boundaries are what a + provider actually records, and flattening them here keeps that out of + the contract. A record that cannot be parsed into a ``StreamRecord`` + proto is the provider's to skip. - def worker_options(self) -> dict[str, Any]: - """What a ``Worker`` or ``Replayer`` needs to serve this provider.""" + Raises: + StopAsyncIteration: This subscription has ended. + """ ... - def open_read( - self, - stream: str, - *, - after: Cursor = BEGINNING, - idle_timeout: timedelta | None = None, - ) -> ReadSource: - """Subscribe the running workflow to its inbound stream ``stream``.""" + def close(self) -> None: + """End the subscription. Idempotent.""" ... - def open_write(self, topic: str) -> WriteSink: - """Bind ``topic`` on the stream the running workflow owns.""" - ... - async def producer( - self, - client: Any, - *, - workflow_id: str, - stream: str = "", - topic: str = "", - producer_id: str = "", - attempt: int = 0, - ) -> Producer: - """Open a producer that appends on ``workflow_id``'s account. - - ``stream`` names one of the workflow's inbound streams. With no - ``stream``, ``topic`` names a topic on the stream the workflow itself - publishes, which is how an activity puts its live output next to the - workflow's own records for the same outside reader. ``producer_id`` - is never empty here: the package resolved it, from the activity - context when the caller left it unset. - """ - ... +class WriteSink(Protocol): + """One topic of the running workflow's stream, as a provider binds it.""" + + def publish(self, record: WireRecord) -> None: + """Take one record into this Workflow Task's output. - async def consumer( - self, client: Any, *, workflow_id: str, stream: str = "" - ) -> Consumer: - """Open a reader on ``workflow_id``'s own stream, or its inbound ``stream``.""" + Synchronous: there is nothing to wait for inside a task, because the + task is the visibility boundary. The provider commits what it buffered + when the task completes and drops it when the task fails. A record + the provider cannot stage raises :class:`temporalio.streams.StreamError` + and fails the task, loudly. + """ ... -class StreamProviderLifecycle(Protocol): - """The hooks a provider adds when it needs the workflow's own lifetime. +class WorkflowStreamProvider(Protocol): + """The half of a provider that runs on the workflow thread. - Separate from :class:`StreamProvider` because most transports need none - of them, and a provider is not asked to carry empty methods to say so. - :func:`prepare`, :func:`drain` and :func:`close` each call the hook when - the provider defines it. + Imports nothing that does I/O. The worker creates one per workflow + instance through :meth:`StreamProvider.workflow_provider`, so state kept + here dies with the instance the way handlers do. """ - def prepare(self) -> None: - """Install whatever this provider needs before the workflow runs. + def open_reader(self, topic: str, *, after: Cursor) -> ReadSource: + """Subscribe the running workflow to ``topic`` of its own stream. - A provider that serves outside readers through handlers on the - workflow itself has to register them before the first task completes, - or a reader that arrives early finds nothing to talk to. + Raises: + StreamCursorError: ``after`` was minted by another provider. """ ... - def drain(self) -> None: - """Release anything this provider parked on the workflow's behalf. - - A provider that parks an outside reader against the running workflow, - as the Workflow Streams transport does with its long-poll update, has - to let go before the workflow can return. - """ + def open_writer(self, topic: str) -> WriteSink: + """Bind ``topic`` of the running workflow's stream for publishing.""" ... - async def close(self) -> None: - """Release what this provider holds for the process. + def on_workflow_start(self) -> None: + """Called before the workflow function runs. - A provider that keeps a connection pool or an HTTP session open needs - a moment where the process says it is done; this is it. + A provider that serves outside readers through handlers on the + workflow registers them here, before the first task completes. """ ... + async def on_workflow_finish(self) -> None: + """Called after the workflow function returns, raises or continues as new. -_factories: dict[str, Callable[[], StreamProvider]] = {} -_active: StreamProvider | None = None - - -def register(name: str, factory: Callable[[], StreamProvider]) -> None: - """Make ``factory`` selectable as ``configure(provider=name)``.""" - _factories[name] = factory - - -def registered() -> list[str]: - """The provider names this process can configure.""" - return sorted(_factories) - - -def _make(name: str | None) -> StreamProvider: - if name is None: - if len(_factories) == 1: - name = next(iter(_factories)) - else: - raise RuntimeError( - f"name a provider: configure(provider=...) with one of {registered()}" - ) - factory = _factories.get(name) - if factory is None: - raise RuntimeError( - f"no stream provider {name!r} is registered; available: {registered()}" - ) - return factory() - - -def configure(provider: str | None = None, **options: Any) -> None: - """Name the provider for this process and hand it its options. - - ``provider`` may be omitted when exactly one provider is registered. - """ - global _active - _active = instance(provider, **options) - - -def instance(provider: str | None = None, **options: Any) -> StreamProvider: - """A configured provider that is not installed as the process default. - - For code that serves one provider while the process is configured with - another, such as a Nexus stream handler delegating to its store. - """ - chosen = _make(provider) - chosen.configure(**options) - return chosen - - -def _current() -> StreamProvider: - if _active is None: - # Building a provider is process setup. Doing it on the first - # workflow's thread would race a second workflow thread for the - # global and hide the choice inside workflow code. - raise RuntimeError( - "no stream provider is configured; call streams.configure() or " - "streams.worker_options() before opening a stream" - ) - return _active - - -def worker_options() -> dict[str, Any]: - """What a ``Worker`` or ``Replayer`` needs to serve this provider. - - Every worker calls this, so it is where the default is resolved when - :func:`configure` was not called and exactly one provider is registered. - """ - if _active is None: - configure() - return _current().worker_options() - - -def open_read( - stream: str, - *, - after: Cursor = BEGINNING, - idle_timeout: timedelta | None = None, -) -> ReadSource: - """Subscribe the running workflow to its inbound stream ``stream``.""" - return _current().open_read(stream, after=after, idle_timeout=idle_timeout) - - -def open_write(topic: str) -> WriteSink: - """Bind ``topic`` on the stream the running workflow owns.""" - return _current().open_write(topic) - - -def prepare() -> None: - """Let the provider install what it needs, before the workflow runs. - - Call it from the workflow's constructor. It is a no-op on providers that - need nothing, so workflow code can call it unconditionally and stay - portable. - """ - provider = _current() - install = getattr(provider, "prepare", None) - if install is not None: - install() + A provider that parked an outside reader against the run lets go + here, so the workflow can close. + """ + ... -def drain() -> None: - """Release anything the provider parked on this workflow's behalf. +class StreamProvider(Protocol): + """What a store ships. Also a :class:`temporalio.worker.Plugin` when it serves workers. - Call it before a workflow that read a stream returns. It is a no-op on - providers that park nothing, so workflow code can call it unconditionally - and stay portable. + Construct one, pass it to ``Worker(plugins=[provider])`` and + ``Replayer(plugins=[provider])``, and open handles from it anywhere else. + Nothing is global: two workers in one process may hold two providers. """ - provider = _current() - release = getattr(provider, "drain", None) - if release is not None: - release() - -async def close() -> None: - """Release what the provider holds for this process. + def workflow_provider(self) -> WorkflowStreamProvider: + """The half that serves one workflow instance on its thread.""" + ... - Await it when the process is done with streams. It is a no-op on - providers that hold nothing, and on a process that never configured one, - so a shutdown path can call it unconditionally. - """ - if _active is None: - return - release = getattr(_active, "close", None) - if release is not None: - await release() + def get_stream_handle( + self, client: Client, workflow_id: str, *, run_id: str | None = None + ) -> StreamHandle: + """A handle on ``workflow_id``'s stream. + Without ``run_id`` it follows the execution chain, so a consumer keeps + reading across continue-as-new; with one it is pinned to that run. + """ + ... -def check_topic(stream: str, topic: str | None) -> None: - """Reject a topic filter on an inbound stream. + async def close(self) -> None: + """Release what this provider holds for the process. - An inbound record carries no topic; the stream's name is its whole - address, so a filter there could only ever match nothing. Every provider - calls this at the top of its ``read`` so the answer is the same on all - of them. - """ - if stream and topic is not None: - raise ValueError( - f"inbound stream {stream!r} has no topics; topic= applies to the " - "stream the workflow publishes" - ) - - -async def producer( - client: Any, - *, - workflow_id: str, - stream: str = "", - topic: str = "", - producer_id: str = "", - attempt: int = 0, -) -> Producer: - """Open a producer that appends on ``workflow_id``'s account. - - Name either an inbound ``stream`` of the workflow, or a ``topic`` on the - stream the workflow publishes. Inside an activity, leave ``producer_id`` - and ``attempt`` unset: the activity's own id and attempt are the right - answer, and they are what let a reader tell a retry from a new generation. - """ - if bool(stream) == bool(topic): - raise ValueError( - "name exactly one of stream (an inbound stream of the workflow) or " - "topic (a topic on the stream the workflow publishes)" - ) - if not producer_id: - if not activity.in_activity(): - raise ValueError( - "producer_id is required outside an activity; inside one it " - "defaults to the activity's id and attempt" - ) - info = activity.info() - producer_id = info.activity_id - attempt = attempt or info.attempt - return await _current().producer( - client, - workflow_id=workflow_id, - stream=stream, - topic=topic, - producer_id=producer_id, - attempt=attempt, - ) - - -async def consumer(client: Any, *, workflow_id: str, stream: str = "") -> Consumer: - """Open a reader on ``workflow_id``'s own stream, or its inbound ``stream``. - - With no ``stream`` the reader follows what the workflow publishes, topic - by topic. With one, it follows the inbound stream of that name, which is - how a process watches what producers hand the workflow. - """ - return await _current().consumer(client, workflow_id=workflow_id, stream=stream) + A provider that keeps a connection pool or an HTTP session open needs + a moment where the process says it is done; this is it. A provider + that holds nothing returns at once. + """ + ... diff --git a/temporalio/streams/_record.py b/temporalio/streams/_record.py index 1f08302a8..fef63e51c 100644 --- a/temporalio/streams/_record.py +++ b/temporalio/streams/_record.py @@ -23,25 +23,38 @@ @enum.unique class RecordKind(enum.IntEnum): - """What a record is.""" + """What a record is. + + Mirrors ``temporal.api.stream.v1.StreamRecordKind`` value for value, so a + record's kind crosses the wire as the integer the proto holds. + """ + + UNSPECIFIED = 0 + """The proto's zero value. + + A stored record whose writer set no kind is read as :attr:`DATA`, as the + proto defines it, so a reader never sees this kind on a record. + """ DATA = 1 """Carries a value published by a workflow or a producer.""" FINISH = 2 - """The writer of this topic declared it complete. + """The producer named in ``producer_id`` will write nothing more on this topic. - Separate from the activity or workflow that wrote it having succeeded. A - reader that treats it as proof of success is wrong: the activity can still - time out after writing it. + An empty ``producer_id`` names the owning workflow. It does not end a + read, which ends when the owning execution or its chain is closed and the + retained tail has been delivered, and it says nothing about the producer's + outcome: an activity can still time out after writing it. """ SUPERSEDED = 3 """A later attempt of the same producer started writing. - Synthesized by the reader from what it observed, so every provider - delivers it identically and replay reproduces it without the provider's - help. + Synthesized by the reader from what it observed, never stored, so every + provider delivers it identically and replay reproduces it without the + provider's help. Its cursor is the position before the new attempt's + first record, so resuming after it delivers that record next. """ @@ -52,7 +65,9 @@ class Cursor: Opaque on purpose. One provider numbers records with integers and another with a millisecond-and-sequence pair, so comparing tokens here would be right for one and wrong for the other. Hand a cursor back to resume after - the record it names; nothing here advances one. + the record it names; nothing here advances one. The token starts with the + name of the provider that minted it, and a provider refuses a token from + another with :class:`temporalio.streams.StreamCursorError`. """ token: str @@ -68,30 +83,33 @@ def __str__(self) -> str: @dataclass(frozen=True) class Supersession: - """The body of a :attr:`RecordKind.SUPERSEDED` record.""" + """What a :attr:`RecordKind.SUPERSEDED` record reports.""" - producer: str + producer_id: str previous_attempt: int attempt: int @dataclass(frozen=True) class StreamRecord(Generic[T]): - """One record as workflow code sees it. + """One record as a reader sees it. - ``value`` follows ``kind``: a data record carries a ``T``, a supersession - carries the :class:`Supersession` it reports, and a finish marker carries - ``None``. Check ``kind`` before reading it. + ``value`` is set on a :attr:`RecordKind.DATA` record and ``supersession`` + on a :attr:`RecordKind.SUPERSEDED` one; every other kind carries neither. + Each field means one thing, so a consumer narrows on ``kind`` and reads + the field that kind promises. """ - value: T | Supersession | None + kind: RecordKind cursor: Cursor - kind: RecordKind = RecordKind.DATA - topic: str = "" - """The topic on the owner's stream, or empty for an inbound record.""" - producer: str = "" + topic: str + producer_id: str = "" """Who wrote it, or empty when the owning workflow wrote it itself.""" attempt: int = 0 """The producer's attempt, or 0 when it did not declare one.""" sequence: int = -1 """The producer's position within its attempt, or -1 when unnumbered.""" + value: T | None = None + """The published value. Set on ``DATA`` only.""" + supersession: Supersession | None = None + """The attempt change being reported. Set on ``SUPERSEDED`` only.""" diff --git a/temporalio/streams/_wire.py b/temporalio/streams/_wire.py new file mode 100644 index 000000000..52299f44e --- /dev/null +++ b/temporalio/streams/_wire.py @@ -0,0 +1,181 @@ +"""How a record crosses a provider: the proto is the record. + +``temporal.api.stream.v1.StreamRecord`` is the wire format on every provider. +A store that keeps bytes keeps ``SerializeToString()`` of it, the native +server stores the proto it is handed, and a reader in any language parses the +same bytes. ``body`` is the user's payload, produced and consumed through the +payload converter, so a codec applies to it like any other payload and a +pre-encoded :class:`temporalio.common.RawValue` passes through untouched. + +Cursors are self-describing: a token starts with the name of the provider that +minted it, so a provider can refuse a foreign one at the call rather than +misreading it deep in a generator. +""" + +from __future__ import annotations + +from collections.abc import Callable +from typing import Any + +import temporalio.converter +from temporalio.api.stream.v1 import StreamRecord as WireRecord +from temporalio.api.stream.v1 import StreamRecordKind +from temporalio.streams._errors import StreamCursorError +from temporalio.streams._policy import AttemptTracker +from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord + +__all__ = [ + "RecordDecoder", + "WireRecord", + "cursor_position", + "from_wire", + "mint_cursor", + "producer_identity", + "to_wire", +] + + +def to_wire( + converter: temporalio.converter.PayloadConverter, + *, + topic: str, + kind: RecordKind, + value: Any = None, + producer_id: str = "", + attempt: int = 0, + sequence: int = -1, +) -> WireRecord: + """Build the record a provider stores or ships. + + Only a ``DATA`` record carries a body; the converter encodes ``value`` + into it, which is where a pre-encoded ``RawValue`` passes through. + """ + record = WireRecord( + topic=topic, + kind=StreamRecordKind.ValueType(int(kind)), + producer_id=producer_id, + attempt=attempt, + sequence=sequence, + ) + if kind is RecordKind.DATA: + record.body.CopyFrom(converter.to_payloads([value])[0]) + return record + + +def from_wire( + converter: temporalio.converter.PayloadConverter, + cursor: Cursor, + wire: WireRecord, + result_type: type | None, +) -> StreamRecord[Any]: + """Turn a stored record into the record a reader yields. + + Raises: + ValueError: The kind is one no store may hold, such as a synthesized + ``SUPERSEDED`` or a value this SDK does not know. + """ + kind = RecordKind(wire.kind) + if kind is RecordKind.SUPERSEDED: + raise ValueError("a SUPERSEDED record is synthesized by readers, never stored") + if kind is RecordKind.UNSPECIFIED: + # The proto defines an unset kind as DATA, so every reader agrees. + kind = RecordKind.DATA + value: Any = None + if kind is RecordKind.DATA and wire.HasField("body"): + hints = [result_type] if result_type is not None else None + value = converter.from_payloads([wire.body], hints)[0] + return StreamRecord( + kind=kind, + cursor=cursor, + topic=wire.topic, + producer_id=wire.producer_id, + attempt=wire.attempt, + sequence=wire.sequence, + value=value, + ) + + +class RecordDecoder: + """Turns the records a provider hands over into the records a reader yields. + + One per read. It synthesizes supersession from the attempts it observes, + positions each synthesized record at the cursor before the record that + triggered it, and skips a record it cannot decode with a warning rather + than raising, so a poisoned record cannot pin a workflow on every retry + while an outside reader of the same stream moves past it. + """ + + def __init__( + self, + converter: temporalio.converter.PayloadConverter, + result_type: type | None, + *, + after: Cursor, + warn: Callable[[str], None], + ) -> None: + """Decode with ``converter`` into ``result_type``, resuming after ``after``.""" + self._converter = converter + self._result_type = result_type + self._previous = after + self._warn = warn + self._attempts = AttemptTracker() + + def decode(self, cursor: Cursor, wire: WireRecord) -> list[StreamRecord[Any]]: + """The records to yield for one stored record, in order.""" + try: + record = from_wire(self._converter, cursor, wire, self._result_type) + except Exception as error: + self._warn(f"skipping stream record at {cursor}: {error}") + # The skipped record still holds its position, so a resume after + # it moves on rather than tripping over it again. + self._previous = cursor + return [] + out: list[StreamRecord[Any]] = [] + superseded = self._attempts.note( + wire.producer_id, wire.attempt, topic=wire.topic, previous=self._previous + ) + if superseded is not None: + out.append(superseded) + out.append(record) + self._previous = cursor + return out + + +def mint_cursor(provider: str, position: str) -> Cursor: + """A cursor that names ``position`` and the provider that understands it.""" + return Cursor(f"{provider}:{position}") + + +def cursor_position(cursor: Cursor, *, provider: str) -> str | None: + """The position inside a cursor ``provider`` minted, or ``None`` for BEGINNING. + + Raises: + StreamCursorError: The cursor came from another provider. + """ + if cursor == BEGINNING: + return None + prefix = f"{provider}:" + if not cursor.token.startswith(prefix): + raise StreamCursorError( + f"cursor {cursor.token!r} was not minted by the {provider} stream provider" + ) + return cursor.token[len(prefix) :] + + +def producer_identity(producer_id: str, attempt: int) -> tuple[str, int]: + """Resolve who a producer is, defaulting to the running activity. + + Imported lazily so the module workflow code imports carries no activity + machinery; the default only means anything inside an activity anyway. + """ + if producer_id: + return producer_id, attempt + import temporalio.activity + + if not temporalio.activity.in_activity(): + raise ValueError( + "producer_id is required outside an activity; inside one it defaults " + "to the activity's id and attempt" + ) + info = temporalio.activity.info() + return info.activity_id, attempt or info.attempt diff --git a/temporalio/streams/providers/__init__.py b/temporalio/streams/providers/__init__.py index c254db0fb..911620e6c 100644 --- a/temporalio/streams/providers/__init__.py +++ b/temporalio/streams/providers/__init__.py @@ -1,25 +1,66 @@ """Stream providers, one module each. -Importing this package registers every provider whose dependencies are -present. A tree that lacks a provider's dependencies simply does not offer -that name; nothing else changes, because everything above the provider is -shared. +A provider that serves workers is a :class:`temporalio.worker.Plugin`. +:class:`ProviderPlugin` is the plugin half the providers in this tree share: +it hands the provider to the worker and the replayer as their +``stream_provider`` and leaves their execution alone. A provider that holds +connections closes them through its own ``close()``, not with the worker, +because the same provider serves handles outside any worker. """ from __future__ import annotations -_KNOWN = ("memory", "workflow_streams", "native", "redis", "nexus") - -for _name in _KNOWN: - try: - __import__(f"{__name__}.{_name}") - except ModuleNotFoundError as error: - # Two things may be missing: the provider module itself, or a - # dependency from outside this package. A name missing inside - # temporalio is a broken provider, and hiding that would turn its - # traceback into "no such provider". - missing = error.name or "" - if missing != f"{__name__}.{_name}" and ( - not missing or missing.startswith("temporalio") - ): - raise +from collections.abc import AsyncIterator, Awaitable, Callable +from contextlib import AbstractAsyncContextManager + +import temporalio.worker +from temporalio.client import WorkflowHistory +from temporalio.streams._provider import StreamProvider +from temporalio.worker import ( + Replayer, + ReplayerConfig, + Worker, + WorkerConfig, + WorkflowReplayResult, +) + +__all__ = ["ProviderPlugin"] + + +class ProviderPlugin(StreamProvider, temporalio.worker.Plugin): + """The worker plugin every provider in this tree is built on. + + Subclasses implement :class:`temporalio.streams.StreamProvider`; this + class supplies the four plugin hooks, so ``Worker(plugins=[provider])`` + and ``Replayer(plugins=[provider])`` reach the provider through their + ``stream_provider`` option and the worker installs the interceptor that + calls the workflow half's lifecycle hooks. + """ + + def configure_worker(self, config: WorkerConfig) -> WorkerConfig: + """Set this provider as the worker's ``stream_provider``.""" + config["stream_provider"] = self + return config + + def configure_replayer(self, config: ReplayerConfig) -> ReplayerConfig: + """Set this provider as the replayer's ``stream_provider``.""" + config["stream_provider"] = self + return config + + async def run_worker( + self, worker: Worker, next: Callable[[Worker], Awaitable[None]] + ) -> None: + """Run the worker unchanged.""" + await next(worker) + + def run_replayer( + self, + replayer: Replayer, + histories: AsyncIterator[WorkflowHistory], + next: Callable[ + [Replayer, AsyncIterator[WorkflowHistory]], + AbstractAsyncContextManager[AsyncIterator[WorkflowReplayResult]], + ], + ) -> AbstractAsyncContextManager[AsyncIterator[WorkflowReplayResult]]: + """Run the replayer unchanged.""" + return next(replayer, histories) diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 4a3cf3298..2a6087b2d 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -1,17 +1,25 @@ """The in-process reference provider. Exists so the conformance suite can exercise the whole surface without a -store, and to document in one file what a provider owes. Two honest limits, -both stated so nobody mistakes this for evidence: +store, and to document in one file what a provider owes. Its limits, stated +so nobody mistakes it for evidence: - It is not replay-safe. Workflow-side state lives in plain process memory, so run it with a warm workflow cache and do not use it to demonstrate recovery. - A workflow's publish becomes visible at ``publish`` time rather than at - task acceptance, so it only approximates rule 1 of the contract. - -The outside surface (producer, consumer, dedupe, supersession, cursors) is -faithful, which is what the conformance tests lean on. + task acceptance, and a failed task's records stay, so it only approximates + rule 1 of the contract. +- Topics are keyed by workflow id rather than by run, so a successor run's + reader from ``BEGINNING`` sees the chain's records. A ``run_id`` on a + handle only decides which run's close ends a read. +- It learns that a workflow closed by describing it, so a handle opened + without a client reads until the caller closes it. + +The outside surface (producer identity, retry deduplication, positions, +supersession, cursors) is faithful, which is what the conformance tests lean +on. One list per topic; a topic is written by the workflow and by outside +producers alike and read from either side. """ from __future__ import annotations @@ -22,16 +30,29 @@ from datetime import timedelta from typing import Any +from google.protobuf.message import DecodeError + import temporalio.converter from temporalio import workflow -from temporalio.api.common.v1 import Payload -from temporalio.streams import _frame, _provider -from temporalio.streams._handles import ReadSource, WriteSink -from temporalio.streams._ids import inbound_stream_id -from temporalio.streams._policy import AttemptTracker +from temporalio.client import Client, WorkflowExecutionStatus +from temporalio.service import RPCError, RPCStatusCode +from temporalio.streams._errors import StreamCursorError +from temporalio.streams._ids import topic_key +from temporalio.streams._provider import ReadSource, WriteSink from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord +from temporalio.streams._wire import ( + RecordDecoder, + WireRecord, + cursor_position, + mint_cursor, + producer_identity, + to_wire, +) +from temporalio.streams.providers import ProviderPlugin + +__all__ = ["MemoryProducer", "MemoryStreamHandle", "MemoryStreams"] -_DEFAULT_POLL = timedelta(milliseconds=100) +_PROVIDER = "memory" logger = logging.getLogger(__name__) @@ -41,12 +62,15 @@ def _wake(future: asyncio.Future[None]) -> None: future.set_result(None) -class _MemoryStream: +class _Topic: + """One topic's records, and the waiters parked on its tail.""" + def __init__(self) -> None: - self.frames: list[bytes] = [] + self.records: list[bytes] = [] # Dedupe identity is (producer#attempt, first sequence of the append), - # the same pair the storage providers use. - self.seen: dict[tuple[str, int], int] = {} + # the same pair the storage providers use, mapped to where the batch + # landed so a repeat can answer with the original position. + self.seen: dict[tuple[str, int], tuple[int, int]] = {} # Each waiter is parked with the loop it belongs to. A workflow's # publish runs on the workflow thread, and waking a foreign loop's # future from there needs call_soon_threadsafe or the loop stays @@ -54,47 +78,50 @@ def __init__(self) -> None: self._waiters: list[tuple[asyncio.AbstractEventLoop, asyncio.Future[None]]] = [] def append( - self, frames: list[bytes], *, producer_id: str, sequence: int - ) -> int | None: - """Store ``frames`` and return the first one's offset, or ``None`` for a repeat.""" - key = (producer_id, sequence) - if key in self.seen: - return None - offset = len(self.frames) - self.frames.extend(frames) - self.seen[key] = offset + self, + wires: list[WireRecord], + *, + writer: str | None = None, + sequence: int = 0, + ) -> tuple[int, int]: + """Store ``wires`` and return where they landed as ``(first offset, count)``. + + With a ``writer``, a repeat of ``(writer, sequence)`` stores nothing + and returns where the original landed. + """ + key = (writer or "", sequence) + if writer is not None and key in self.seen: + return self.seen[key] + first = len(self.records) + self.records.extend(wire.SerializeToString() for wire in wires) + if writer is not None: + self.seen[key] = (first, len(wires)) waiters, self._waiters = self._waiters, [] for loop, future in waiters: loop.call_soon_threadsafe(_wake, future) - return offset - - async def wait_past(self, offset: int) -> None: - while len(self.frames) <= offset: - loop = asyncio.get_running_loop() - future: asyncio.Future[None] = loop.create_future() - self._waiters.append((loop, future)) - await future - - -_streams: dict[str, _MemoryStream] = {} - - -def _stream(stream_id: str) -> _MemoryStream: - found = _streams.get(stream_id) - if found is None: - found = _streams[stream_id] = _MemoryStream() - return found - - -def reset() -> None: - """Drop every stream. For tests.""" - _streams.clear() - - -def _converter(client: Any) -> Any: - if client is None: - return temporalio.converter.DataConverter.default.payload_converter - return client.data_converter.payload_converter + return first, len(wires) + + async def wait_past(self, offset: int, timeout: float | None) -> None: + """Wait until a record exists at ``offset``, or ``timeout`` passes.""" + if len(self.records) > offset: + return + loop = asyncio.get_running_loop() + future: asyncio.Future[None] = loop.create_future() + self._waiters.append((loop, future)) + try: + await asyncio.wait_for(future, timeout) + except asyncio.TimeoutError: + self._waiters = [w for w in self._waiters if w[1] is not future] + + +def _parse(cursor: Cursor, raw: bytes, warn: Any) -> WireRecord | None: + try: + return WireRecord.FromString(raw) + except DecodeError as error: + # Same answer as an undecodable body: skip and say so, so one bad + # record cannot pin a reader. + warn("skipping stream record at %s: %s", cursor, error) + return None class _MemReadSource: @@ -104,22 +131,26 @@ class _MemReadSource: having no delivery path, and it is why this provider is for tests. """ - def __init__(self, store: _MemoryStream, start: int, poll: timedelta) -> None: + def __init__(self, store: _Topic, start: int, poll: timedelta) -> None: self._store = store - self._cursor = start + self._offset = start self._poll = poll self._closed = False - async def next_batch(self) -> list[tuple[Cursor, bytes]]: + async def next_batch(self) -> list[tuple[Cursor, WireRecord]]: while not self._closed: - frames = self._store.frames - if len(frames) > self._cursor: - batch = [ - (Cursor(str(offset)), frames[offset]) - for offset in range(self._cursor, len(frames)) - ] - self._cursor = len(frames) - return batch + records = self._store.records + if len(records) > self._offset: + batch: list[tuple[Cursor, WireRecord]] = [] + for offset in range(self._offset, len(records)): + cursor = mint_cursor(_PROVIDER, str(offset)) + wire = _parse(cursor, records[offset], workflow.logger.warning) + if wire is not None: + batch.append((cursor, wire)) + self._offset = len(records) + if batch: + return batch + continue await workflow.sleep(self._poll) raise StopAsyncIteration @@ -128,18 +159,34 @@ def close(self) -> None: class _MemWriteSink: - def __init__(self, store: _MemoryStream, topic: str) -> None: + def __init__(self, store: _Topic) -> None: self._store = store - self._topic = topic - self._sequence = 0 - async def publish(self, frame: bytes) -> None: - self._store.append( - [frame], - producer_id=f"__workflow__:{self._topic}", - sequence=self._sequence, - ) - self._sequence += 1 + def publish(self, record: WireRecord) -> None: + # Visible at once rather than at task acceptance: the documented gap + # between this provider and rule 1. + self._store.append([record]) + + +class _MemoryWorkflowProvider: + """The workflow half. Nothing to install and nothing to release.""" + + def __init__(self, streams: MemoryStreams) -> None: + self._streams = streams + + def open_reader(self, topic: str, *, after: Cursor) -> ReadSource: + start = self._streams._offset_after(after) + store = self._streams._topic(workflow.info().workflow_id, topic) + return _MemReadSource(store, start, self._streams._poll) + + def open_writer(self, topic: str) -> WriteSink: + return _MemWriteSink(self._streams._topic(workflow.info().workflow_id, topic)) + + def on_workflow_start(self) -> None: + pass + + async def on_workflow_finish(self) -> None: + pass class MemoryProducer: @@ -147,19 +194,25 @@ class MemoryProducer: def __init__( self, - store: _MemoryStream, - converter: Any, + store: _Topic, + converter: temporalio.converter.PayloadConverter, topic: str, producer_id: str, attempt: int, ) -> None: - """Bind this producer to ``topic`` on ``store``.""" + """Bind this producer to ``topic``'s ``store``.""" self._store = store self._converter = converter self._topic = topic self._producer_id = producer_id self._attempt = attempt self._sequence = 0 + self._last = BEGINNING + + @property + def producer_id(self) -> str: + """Who this producer writes as.""" + return self._producer_id @property def attempt(self) -> int: @@ -167,192 +220,224 @@ def attempt(self) -> int: return self._attempt @property - def _provider_id(self) -> str: + def _writer(self) -> str: return ( f"{self._producer_id}#{self._attempt}" if self._attempt else self._producer_id ) - async def append(self, *values: Any) -> Cursor | None: - """Append ``values`` and return the last one's cursor, or ``None`` if nothing landed.""" + async def append(self, *values: Any) -> Cursor: + """Append ``values`` and return the cursor of the last record as stored. + + A repeat returns where the original landed; an empty call returns + the position of this producer's last record. + """ if not values: - return None - frames = [] - for value in values: - frames.append( - _frame.encode( + return self._last + return self._write( + [ + to_wire( + self._converter, topic=self._topic, kind=RecordKind.DATA, - producer=self._producer_id, + value=value, + producer_id=self._producer_id, attempt=self._attempt, - sequence=self._sequence, - body=self._encode(value), + sequence=self._sequence + index, ) - ) - self._sequence += 1 - offset = self._store.append( - frames, - producer_id=self._provider_id, - sequence=self._sequence - len(frames), + for index, value in enumerate(values) + ] ) - if offset is None: - return None - return Cursor(str(offset + len(frames) - 1)) async def finish(self) -> None: - """Mark this producer done, so a reader stops waiting on it.""" - frame = _frame.encode( - topic=self._topic, - kind=RecordKind.FINISH, - producer=self._producer_id, - attempt=self._attempt, - sequence=self._sequence, - body=b"", - ) - self._sequence += 1 - self._store.append( - [frame], producer_id=self._provider_id, sequence=self._sequence - 1 + """Write ``FINISH`` for this producer on this topic.""" + self._write( + [ + to_wire( + self._converter, + topic=self._topic, + kind=RecordKind.FINISH, + producer_id=self._producer_id, + attempt=self._attempt, + sequence=self._sequence, + ) + ] ) - def _encode(self, value: Any) -> bytes: - payload = ( - value - if isinstance(value, Payload) - else self._converter.to_payloads([value])[0] + def _write(self, wires: list[WireRecord]) -> Cursor: + first, count = self._store.append( + wires, writer=self._writer, sequence=self._sequence ) - return payload.SerializeToString() + self._sequence += len(wires) + self._last = mint_cursor(_PROVIDER, str(first + count - 1)) + return self._last -class MemoryConsumer: - """The outside reader, with the shared supersession rule.""" +class MemoryStreamHandle: + """One workflow's stream from outside, with the shared reader rules.""" - def __init__(self, store: _MemoryStream, converter: Any, stream: str) -> None: - """Read whatever ``store`` holds, now and as it grows.""" - self._store = store - self._converter = converter - self._stream = stream + def __init__( + self, + streams: MemoryStreams, + client: Client | None, + workflow_id: str, + run_id: str | None, + ) -> None: + """Address ``workflow_id``'s topics in ``streams``.""" + self._streams = streams + self._client = client + self._workflow_id = workflow_id + self._run_id = run_id + self._converter = ( + client.data_converter.payload_converter + if client is not None + else temporalio.converter.DataConverter.default.payload_converter + ) - async def read( + def read( self, *, + topic: str, after: Cursor = BEGINNING, - topic: str | None = None, - type: type | None = None, + result_type: type | None = None, ) -> AsyncGenerator[StreamRecord[Any], None]: - """Yield records after ``after``, waiting for ones not written yet.""" - _provider.check_topic(self._stream, topic) - attempts = AttemptTracker() - offset = int(after.token) + 1 if after.token else 0 + """Yield records on ``topic`` after ``after`` until the workflow closes.""" + store = self._streams._topic(self._workflow_id, topic) + # Parsed here so a foreign cursor fails this call, not the first + # iteration of the generator. + start = self._streams._offset_after(after) + return self._read(store, start, after, result_type) + + async def _read( + self, + store: _Topic, + offset: int, + after: Cursor, + result_type: type | None, + ) -> AsyncGenerator[StreamRecord[Any], None]: + decoder = RecordDecoder( + self._converter, result_type, after=after, warn=logger.warning + ) + closed = False while True: - await self._store.wait_past(offset) - frames = self._store.frames - while offset < len(frames): - cursor = Cursor(str(offset)) - frame = frames[offset] + records = store.records + while offset < len(records): + cursor = mint_cursor(_PROVIDER, str(offset)) + wire = _parse(cursor, records[offset], logger.warning) offset += 1 - try: - kind, frame_topic, source, attempt, sequence, body = _frame.decode( - frame - ) - except ValueError as error: - # Same answer as the workflow-side reader: skip and say so. - logger.warning("skipping stream record at %s: %s", cursor, error) + if wire is None: continue - if topic is not None and frame_topic != topic: - continue - superseded = attempts.note(source, attempt, cursor) - if superseded is not None: - yield superseded - yield StreamRecord( - value=self._decode(body, type) if kind is RecordKind.DATA else None, - cursor=cursor, - kind=kind, - topic=frame_topic, - producer=source, - attempt=attempt, - sequence=sequence, + for record in decoder.decode(cursor, wire): + yield record + if closed: + return + # One more pass after learning the workflow closed, so a record + # that landed between the scan and the describe is not lost. + closed = await self._closed() + if not closed: + await store.wait_past( + offset, + None + if self._client is None + else self._streams._poll.total_seconds(), ) - async def latest(self, *, topic: str | None = None) -> Cursor: - """The cursor of the last record written, for following from now.""" - del topic # one store per stream, so the position is topic-independent - count = len(self._store.frames) - return Cursor(str(count - 1)) if count else BEGINNING - - def _decode(self, body: bytes, as_type: type | None) -> Any: - payload = Payload() - payload.ParseFromString(body) - if as_type is None: - return self._converter.from_payloads([payload])[0] - return self._converter.from_payloads([payload], [as_type])[0] - - -class _MemoryProvider: - name = "memory" - - def __init__(self) -> None: - self._poll = _DEFAULT_POLL - - def configure(self, **options: Any) -> None: - poll = options.pop("poll_interval", None) - if poll is not None: - self._poll = poll - if options: - raise TypeError( - f"the memory provider takes only poll_interval, got {sorted(options)}" - ) - - def worker_options(self) -> dict[str, Any]: - return {} - - def open_read( - self, - stream: str, - *, - after: Cursor = BEGINNING, - idle_timeout: timedelta | None = None, - ) -> ReadSource: - # Ignored: this provider never releases the worker, it polls. Reading - # idle_timeout as the poll period would give the parameter a second - # meaning that a port copying the reference would copy too. - del idle_timeout - store = _stream(inbound_stream_id(workflow.info().workflow_id, stream)) - return _MemReadSource( - store, int(after.token) + 1 if after.token else 0, self._poll + async def _closed(self) -> bool: + if self._client is None: + return False + handle = self._client.get_workflow_handle( + self._workflow_id, run_id=self._run_id + ) + try: + description = await handle.describe() + except RPCError as error: + if error.status == RPCStatusCode.NOT_FOUND: + # A producer may write before the workflow exists; there is + # nothing to follow yet, so keep waiting. + return False + raise + status = description.status + if status is None or status == WorkflowExecutionStatus.RUNNING: + return False + # Following the chain, a run that continued as new is not the end: + # the next describe without a run id finds its successor. + return not ( + self._run_id is None and status == WorkflowExecutionStatus.CONTINUED_AS_NEW ) - def open_write(self, topic: str) -> WriteSink: - store = _stream(inbound_stream_id(workflow.info().workflow_id, "")) - return _MemWriteSink(store, topic) + async def latest(self, *, topic: str) -> Cursor: + """The cursor of the newest record on ``topic``, for following from now.""" + count = len(self._streams._topic(self._workflow_id, topic).records) + return mint_cursor(_PROVIDER, str(count - 1)) if count else BEGINNING - async def producer( - self, - client: Any, - *, - workflow_id: str, - stream: str = "", - topic: str = "", - producer_id: str = "", - attempt: int = 0, + def producer( + self, *, topic: str, producer_id: str = "", attempt: int = 0 ) -> MemoryProducer: - # With no inbound stream named, the target is the store the workflow's - # own writer appends to, and the frame carries the topic. An inbound - # record carries none: the stream's name is its whole address. - return MemoryProducer( - _stream(inbound_stream_id(workflow_id, stream)), - _converter(client), - topic, - producer_id, - attempt, - ) + """A producer on ``topic``; inside an activity its identity is the activity's.""" + store = self._streams._topic(self._workflow_id, topic) + producer_id, attempt = producer_identity(producer_id, attempt) + return MemoryProducer(store, self._converter, topic, producer_id, attempt) - async def consumer( - self, client: Any, *, workflow_id: str, stream: str = "" - ) -> MemoryConsumer: - return MemoryConsumer( - _stream(inbound_stream_id(workflow_id, stream)), _converter(client), stream - ) +class MemoryStreams(ProviderPlugin): + """The in-memory provider, one list per topic. -_provider.register("memory", _MemoryProvider) + Construct one and pass the same instance to the worker and to the code + that opens handles; two instances share nothing. + """ + + def __init__( + self, *, poll_interval: timedelta = timedelta(milliseconds=100) + ) -> None: + """Create an empty provider. + + Args: + poll_interval: How often a workflow-side reader with nothing to + read checks again, and how often an outside reader asks + whether the workflow closed. + """ + self._poll = poll_interval + self._topics: dict[str, _Topic] = {} + + def reset(self) -> None: + """Drop every topic. For tests.""" + self._topics.clear() + + def workflow_provider(self) -> _MemoryWorkflowProvider: + """The workflow half, over this provider's topics.""" + return _MemoryWorkflowProvider(self) + + def get_stream_handle( + self, client: Client | None, workflow_id: str, *, run_id: str | None = None + ) -> MemoryStreamHandle: + """A handle on ``workflow_id``'s topics. + + ``client`` may be ``None`` here, unlike on a storage provider; then + the handle cannot see the workflow close and a read waits until the + caller closes it. + """ + return MemoryStreamHandle(self, client, workflow_id, run_id) + + async def close(self) -> None: + """Nothing to release: the provider holds no connection.""" + + def _topic(self, workflow_id: str, topic: str) -> _Topic: + if not topic: + raise ValueError("topic must not be empty") + key = topic_key(workflow_id, topic) + found = self._topics.get(key) + if found is None: + found = self._topics[key] = _Topic() + return found + + def _offset_after(self, after: Cursor) -> int: + position = cursor_position(after, provider=_PROVIDER) + if position is None: + return 0 + try: + return int(position) + 1 + except ValueError: + raise StreamCursorError( + f"cursor {after.token!r} does not name a position on the memory provider" + ) from None From ebbdfa2ea70b3929eb3e00a3d1f17d9c9c5c54f0 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 01:54:17 -0700 Subject: [PATCH 26/51] Carried the stream provider from the worker into the workflow runtime. workflow.stream_reader() and stream_writer() reach it the way payload_converter() does, and the worker brackets the workflow function with the provider's lifecycle hooks so no workflow code has to. --- temporalio/worker/_replayer.py | 7 +- temporalio/worker/_worker.py | 9 + temporalio/worker/_workflow.py | 28 +++ temporalio/worker/_workflow_instance.py | 19 ++ temporalio/workflow/__init__.py | 10 + temporalio/workflow/_context.py | 4 + temporalio/workflow/_streams.py | 257 ++++++++++++++++++++++++ 7 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 temporalio/workflow/_streams.py diff --git a/temporalio/worker/_replayer.py b/temporalio/worker/_replayer.py index b3eb1a4d1..c7ae8d59d 100644 --- a/temporalio/worker/_replayer.py +++ b/temporalio/worker/_replayer.py @@ -17,6 +17,7 @@ import temporalio.client import temporalio.converter import temporalio.runtime +import temporalio.streams import temporalio.worker import temporalio.workflow @@ -56,13 +57,14 @@ def __init__( runtime: temporalio.runtime.Runtime | None = None, disable_safe_workflow_eviction: bool = False, header_codec_behavior: HeaderCodecBehavior = HeaderCodecBehavior.NO_CODEC, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> None: """Create a replayer to replay workflows from history. See :py:meth:`temporalio.worker.Worker.__init__` for a description of most of the arguments. Most of the same arguments need to be passed to the replayer that were passed to the worker when the workflow originally - ran. + ran, ``stream_provider`` included when the workflow used streams. Note, unlike the worker, for the replayer the workflow_task_executor will default to a new thread pool executor with no max_workers set that @@ -86,6 +88,7 @@ def __init__( runtime=runtime, disable_safe_workflow_eviction=disable_safe_workflow_eviction, header_codec_behavior=header_codec_behavior, + stream_provider=stream_provider, ) self._initial_config = self._config.copy() self._default_workflow_logic_flags = set(_DEFAULT_ENABLED_WORKFLOW_LOGIC_FLAGS) @@ -287,6 +290,7 @@ def on_eviction_hook( default_workflow_logic_flags=frozenset( self._default_workflow_logic_flags ), + stream_provider=self._config.get("stream_provider"), ) external_storage = data_converter.external_storage storage_driver_types = ( @@ -433,6 +437,7 @@ class ReplayerConfig(TypedDict, total=False): runtime: temporalio.runtime.Runtime | None disable_safe_workflow_eviction: bool header_codec_behavior: HeaderCodecBehavior + stream_provider: temporalio.streams.StreamProvider | None @dataclass(frozen=True) diff --git a/temporalio/worker/_worker.py b/temporalio/worker/_worker.py index 60f824c4d..3adbd7231 100644 --- a/temporalio/worker/_worker.py +++ b/temporalio/worker/_worker.py @@ -24,6 +24,7 @@ import temporalio.common import temporalio.runtime import temporalio.service +import temporalio.streams from temporalio.common import ( HeaderCodecBehavior, VersioningBehavior, @@ -152,6 +153,7 @@ def __init__( ), disable_payload_error_limit: bool = False, max_workflow_task_external_storage_concurrency: int = _DEFAULT_WORKFLOW_TASK_EXTERNAL_STORAGE_CONCURRENCY, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> None: """Create a worker to process workflows and/or activities. @@ -343,6 +345,10 @@ def __init__( Defaults to 3. Adjust this value based on your workload's needs. Please report any issues you encounter with this setting or if you feel the default should be changed. + stream_provider: Experimental. The stream provider that workflows + on this worker read and publish through, see + :py:mod:`temporalio.streams`. A provider that is also a + :py:class:`Plugin` sets this itself when passed in ``plugins``. WARNING: This setting is experimental. """ @@ -392,6 +398,7 @@ def __init__( nexus_task_poller_behavior=nexus_task_poller_behavior, disable_payload_error_limit=disable_payload_error_limit, max_workflow_task_external_storage_concurrency=max_workflow_task_external_storage_concurrency, + stream_provider=stream_provider, ) plugins_from_client = cast( @@ -565,6 +572,7 @@ def check_activity(activity: str): encode_headers=client_config["header_codec_behavior"] != HeaderCodecBehavior.NO_CODEC, max_workflow_task_external_storage_concurrency=max_workflow_task_external_storage_concurrency, + stream_provider=config.get("stream_provider"), ) tuner = config.get("tuner") @@ -1020,6 +1028,7 @@ class WorkerConfig(TypedDict, total=False): nexus_task_poller_behavior: PollerBehavior disable_payload_error_limit: bool max_workflow_task_external_storage_concurrency: int + stream_provider: temporalio.streams.StreamProvider | None def _warn_if_activity_executor_max_workers_is_inconsistent( diff --git a/temporalio/worker/_workflow.py b/temporalio/worker/_workflow.py index 1b217b4a5..b5e4cb411 100644 --- a/temporalio/worker/_workflow.py +++ b/temporalio/worker/_workflow.py @@ -13,6 +13,7 @@ from dataclasses import dataclass from datetime import timezone from types import TracebackType +from typing import Any import temporalio.api.common.v1 import temporalio.bridge.proto.common @@ -24,6 +25,7 @@ import temporalio.converter import temporalio.converter._extstore import temporalio.exceptions +import temporalio.streams import temporalio.workflow from temporalio.bridge.worker import PollShutdownError from temporalio.converter import StorageDriverStoreContext, StorageDriverWorkflowInfo @@ -35,6 +37,7 @@ _relax_sandbox_for_debugger, ) from ._interceptor import ( + ExecuteWorkflowInput, Interceptor, WorkflowInboundInterceptor, WorkflowInterceptorClassInput, @@ -55,6 +58,24 @@ LOG_PROTOS = False +class _StreamHooksInterceptor(WorkflowInboundInterceptor): + """Brackets the workflow function with the stream provider's lifecycle hooks. + + Installed by the worker when it has a stream provider, so no workflow + code has to call anything before it runs or before it returns. The finish + hook runs however the function ends, continue-as-new included, because + a provider that parked a reader against the run has to let go either way. + """ + + async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any: + provider = temporalio.workflow._Runtime.current().workflow_streams().provider + provider.on_workflow_start() + try: + return await self.next.execute_workflow(input) + finally: + await provider.on_workflow_finish() + + # Value was chosen abitrarily as a small number that allows some concurrency and prevents # large numbers of concurrent external storage operations causing resource contention. # This default limit is per workflow task activation and does not limit the total number @@ -104,6 +125,7 @@ def __init__( encode_headers: bool, max_workflow_task_external_storage_concurrency: int, default_workflow_logic_flags: frozenset[_WorkflowLogicFlag] | None = None, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> None: # Debug mode is enabled if specified or if the TEMPORAL_DEBUG env var is truthy debug_mode = debug_mode or bool(os.environ.get("TEMPORAL_DEBUG")) @@ -162,6 +184,11 @@ def __init__( __temporal_assert_local_activity_valid=assert_local_activity_valid, ) ) + self._stream_provider = stream_provider + if stream_provider is not None: + # Innermost, so the lifecycle hooks bracket the workflow function + # itself, after every user interceptor has done its own setup. + self._interceptor_classes.append(_StreamHooksInterceptor) self._workflow_failure_exception_types = workflow_failure_exception_types self._patch_activation_callback = patch_activation_callback @@ -740,6 +767,7 @@ def _create_workflow_instance( last_completion_result=init.last_completion_result, last_failure=last_failure, default_workflow_logic_flags=frozenset(self._default_workflow_logic_flags), + stream_provider=self._stream_provider, ) if defn.sandboxed: return self._workflow_runner.create_instance(det) diff --git a/temporalio/worker/_workflow_instance.py b/temporalio/worker/_workflow_instance.py index 108431021..26f796e57 100644 --- a/temporalio/worker/_workflow_instance.py +++ b/temporalio/worker/_workflow_instance.py @@ -58,7 +58,9 @@ import temporalio.converter import temporalio.exceptions import temporalio.nexus.system +import temporalio.streams import temporalio.workflow +import temporalio.workflow._streams from temporalio.converter import StorageDriverStoreContext, StorageDriverWorkflowInfo from temporalio.converter._payload_converter import ( _TemporalTransferTypePayloadConverter, @@ -179,6 +181,7 @@ class WorkflowInstanceDetails: default_workflow_logic_flags: frozenset[_WorkflowLogicFlag] = field( default_factory=lambda: _DEFAULT_ENABLED_WORKFLOW_LOGIC_FLAGS ) + stream_provider: temporalio.streams.StreamProvider | None = None class WorkflowInstance(ABC): @@ -298,6 +301,8 @@ def __init__(self, det: WorkflowInstanceDetails) -> None: det.worker_level_failure_exception_types ) self._patch_activation_callback = det.patch_activation_callback + self._stream_provider = det.stream_provider + self._streams: temporalio.workflow._streams._WorkflowStreams | None = None self._default_workflow_logic_flags = det.default_workflow_logic_flags self._primary_task: asyncio.Task[None] | None = None self._cancel_primary_task_pending = False @@ -1774,6 +1779,20 @@ async def workflow_start_nexus_operation( ) ) + def workflow_streams(self) -> temporalio.workflow._streams._WorkflowStreams: + if self._streams is None: + if self._stream_provider is None: + raise RuntimeError( + "no stream provider is configured on this worker; pass one with " + "Worker(plugins=[provider]) or stream_provider=" + ) + # The workflow half is made per instance, so whatever it keeps + # dies with the instance the way handlers do. + self._streams = temporalio.workflow._streams._WorkflowStreams( + self._stream_provider.workflow_provider() + ) + return self._streams + def workflow_time_ns(self) -> int: return self._time_ns diff --git a/temporalio/workflow/__init__.py b/temporalio/workflow/__init__.py index fa2681139..f63135bf4 100644 --- a/temporalio/workflow/__init__.py +++ b/temporalio/workflow/__init__.py @@ -147,6 +147,12 @@ logger, unsafe, ) +from ._streams import ( + StreamReader, + StreamWriter, + stream_reader, + stream_writer, +) from ._workflow_ops import ( ChildWorkflowCancellationType, ChildWorkflowConfig, @@ -252,6 +258,10 @@ "SandboxImportNotificationPolicy", "logger", "unsafe", + "StreamReader", + "StreamWriter", + "stream_reader", + "stream_writer", "ChildWorkflowCancellationType", "ChildWorkflowConfig", "ChildWorkflowHandle", diff --git a/temporalio/workflow/_context.py b/temporalio/workflow/_context.py index b33f83150..25523836a 100644 --- a/temporalio/workflow/_context.py +++ b/temporalio/workflow/_context.py @@ -24,6 +24,7 @@ from ._activities import ActivityCancellationType, ActivityHandle from ._exceptions import ContinueAsNewVersioningBehavior, VersioningIntent from ._nexus import NexusOperationCancellationType, NexusOperationHandle + from ._streams import _WorkflowStreams from ._workflow_ops import ( ChildWorkflowCancellationType, ChildWorkflowHandle, @@ -475,6 +476,9 @@ async def workflow_start_nexus_operation( summary: str | None, ) -> NexusOperationHandle[OutputT]: ... + @abstractmethod + def workflow_streams(self) -> _WorkflowStreams: ... + @abstractmethod def workflow_time_ns(self) -> int: ... diff --git a/temporalio/workflow/_streams.py b/temporalio/workflow/_streams.py new file mode 100644 index 000000000..029da59a1 --- /dev/null +++ b/temporalio/workflow/_streams.py @@ -0,0 +1,257 @@ +"""Streams from inside workflow code. + +.. warning:: + This module is experimental and may change in future versions. + +The reader and writer here are the same on every provider. They convert +values, synthesize supersession and buffer nothing the provider did not hand +them; everything provider-specific sits behind the ``ReadSource`` and +``WriteSink`` that the provider's workflow half opens. The provider itself +comes from the worker, the way the payload converter does. +""" + +from __future__ import annotations + +import asyncio +from collections import deque +from collections.abc import AsyncIterator, Callable +from typing import Any, Generic, TypeVar, cast, overload + +from temporalio.streams._provider import ReadSource, WorkflowStreamProvider, WriteSink +from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord +from temporalio.streams._wire import RecordDecoder, to_wire +from temporalio.workflow._context import _Runtime, payload_converter +from temporalio.workflow._sandbox import logger + +__all__ = ["StreamReader", "StreamWriter", "stream_reader", "stream_writer"] + +T = TypeVar("T") + + +class _WorkflowStreams: + """The stream state a workflow instance carries: its provider half and open readers.""" + + def __init__(self, provider: WorkflowStreamProvider) -> None: + self.provider = provider + self.readers: dict[str, StreamReader[Any]] = {} + + +class StreamReader(Generic[T]): + """Reads one topic of this workflow's stream from inside workflow code. + + The reader is the async iterator: ``async for record in reader`` yields + every kind of record, including the supersession the reader synthesizes + when a producer's newer attempt appears. Check ``record.kind``, or + iterate :meth:`values` when the workflow only wants data. Iteration ends + when the reader is closed or the provider ends the subscription. One loop + per reader: two loops on one reader share its buffer and interleave. + """ + + def __init__( + self, + source: ReadSource, + *, + topic: str, + result_type: type | None, + after: Cursor, + on_close: Callable[[], None], + ) -> None: + """Prefer :func:`temporalio.workflow.stream_reader`.""" + self._source = source + self._topic = topic + self._result_type = result_type + self._decoder = RecordDecoder( + payload_converter(), result_type, after=after, warn=logger.warning + ) + self._pending: deque[StreamRecord[T]] = deque() + self._lock = asyncio.Lock() + self._closed = False + self._ended = False + self._on_close = on_close + + @property + def topic(self) -> str: + """The topic this reader is subscribed to.""" + return self._topic + + def __aiter__(self) -> StreamReader[T]: + """The reader is its own iterator.""" + return self + + async def __anext__(self) -> StreamRecord[T]: + """The next record, waiting for one to arrive.""" + while True: + if self._pending: + return self._pending.popleft() + if self._closed or self._ended: + raise StopAsyncIteration + await self._fill() + + async def _fill(self) -> None: + # Two loops on one reader must not race the source, so one batch + # fetch is in flight at a time and the second loop takes what the + # first one buffered. + async with self._lock: + if self._pending or self._closed or self._ended: + return + try: + batch = await self._source.next_batch() + except StopAsyncIteration: + # The provider ended the subscription. Iteration stops rather + # than raising, so a workflow that reads to the end of a + # finished stream leaves the loop instead of failing its task. + self._ended = True + return + for cursor, wire in batch: + self._pending.extend(self._decoder.decode(cursor, wire)) + + async def values(self) -> AsyncIterator[T]: + """Iterate the data values, dropping control records.""" + async for record in self: + if record.kind is RecordKind.DATA: + yield cast("T", record.value) + + def close(self) -> None: + """End the subscription. Idempotent. + + A later :func:`temporalio.workflow.stream_reader` on the same topic + opens a new subscription, which is a new command. + """ + if self._closed: + return + self._closed = True + self._source.close() + self._on_close() + + +class StreamWriter: + """Publishes to one topic of this workflow's stream. + + A workflow can only publish transactionally to its own stream, on every + provider. Writing to somebody else's stream is an activity's job, and it + gets the weaker guarantee that goes with doing I/O. + """ + + def __init__(self, sink: WriteSink, topic: str) -> None: + """Prefer :func:`temporalio.workflow.stream_writer`.""" + self._sink = sink + self._topic = topic + self._finished = False + + @property + def topic(self) -> str: + """The topic this writer is bound to.""" + return self._topic + + def publish(self, value: Any) -> None: + """Append ``value`` to this topic. + + Synchronous, because there is nothing to wait for inside a task: the + record becomes visible when this Workflow Task is accepted, and never + at all if the task fails, so a reader cannot see a decision the + workflow did not commit. A :class:`temporalio.common.RawValue` passes + through pre-encoded. + + Raises: + ValueError: :meth:`finish` was already called on this writer. + """ + if self._finished: + raise ValueError(f"topic {self._topic!r} was already finished") + self._sink.publish( + to_wire( + payload_converter(), + topic=self._topic, + kind=RecordKind.DATA, + value=value, + ) + ) + + def finish(self) -> None: + """Write ``FINISH`` for this workflow on this topic. Idempotent. + + Says this workflow has nothing more to send on the topic. It does not + say the workflow succeeded, and it does not end anyone's read. + """ + if self._finished: + return + self._finished = True + self._sink.publish( + to_wire(payload_converter(), topic=self._topic, kind=RecordKind.FINISH) + ) + + +@overload +def stream_reader( + topic: str, *, result_type: type[T], after: Cursor = ... +) -> StreamReader[T]: ... + + +@overload +def stream_reader( + topic: str, *, result_type: None = None, after: Cursor = ... +) -> StreamReader[Any]: ... + + +def stream_reader( + topic: str, *, result_type: type | None = None, after: Cursor = BEGINNING +) -> StreamReader[Any]: + """Subscribe this workflow to ``topic`` of its own stream. + + One subscription per topic per run. A second call for the same topic + returns the reader already open on it, so records go to whichever loop + pulls first; such a call may pass neither ``after`` nor a different + ``result_type``. Adding a reader on a new topic is a new command, so gate + it with :func:`temporalio.workflow.patched` as you would a timer. A + reader in a successor run starts a new subscription: nothing crosses + continue-as-new implicitly. + + Args: + topic: The topic, relative to this workflow's stream. + result_type: The value type, used as the decode hint. + :class:`temporalio.common.RawValue` returns the payload untouched. + after: Resume strictly after this record. Honoured on the first + subscription of a run, because after that the recorded + observations decide. + + Raises: + ValueError: ``topic`` is empty, or a reader on it is already open and + this call asked for a different position or type. + temporalio.streams.StreamCursorError: ``after`` was minted by another + provider. + """ + if not topic: + raise ValueError("topic must not be empty") + state: _WorkflowStreams = _Runtime.current().workflow_streams() + existing = state.readers.get(topic) + if existing is not None: + if after != BEGINNING or result_type is not existing._result_type: + raise ValueError( + f"topic {topic!r} already has a reader in this run; a second " + "stream_reader shares it and takes no after= or other result_type=" + ) + return existing + source = state.provider.open_reader(topic, after=after) + + def forget() -> None: + state.readers.pop(topic, None) + + reader: StreamReader[Any] = StreamReader( + source, topic=topic, result_type=result_type, after=after, on_close=forget + ) + state.readers[topic] = reader + return reader + + +def stream_writer(topic: str) -> StreamWriter: + """Publish to ``topic`` of this workflow's stream. + + Args: + topic: The topic name. Encoding follows each published value. + + Raises: + ValueError: ``topic`` is empty. + """ + if not topic: + raise ValueError("topic must not be empty") + provider = _Runtime.current().workflow_streams().provider + return StreamWriter(provider.open_writer(topic), topic) From ffae7a40c603596ff10f2bc248d278c7abc263d4 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 01:54:17 -0700 Subject: [PATCH 27/51] Moved the stream conformance suite onto the new surface. Adds the cases for supersession cursors, append positions, a read that ends when the chain closes, chain following, foreign cursors, the lifecycle hooks and a subscription shared by two readers. --- tests/streams/conftest.py | 6 +- tests/streams/test_streams_conformance.py | 492 ++++++++++------------ tests/streams/test_streams_workflow.py | 381 +++++++++++++---- 3 files changed, 537 insertions(+), 342 deletions(-) diff --git a/tests/streams/conftest.py b/tests/streams/conftest.py index 1758f2598..12663fa23 100644 --- a/tests/streams/conftest.py +++ b/tests/streams/conftest.py @@ -4,9 +4,5 @@ def pytest_configure(config: pytest.Config) -> None: config.addinivalue_line( "markers", - "inbound_stream: the case writes a workflow's inbound stream from outside", - ) - config.addinivalue_line( - "markers", - "unfiltered_read: the case reads the owner's stream without naming a topic", + "reports_positions: the case needs append() to return where records landed", ) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 7d76d85d6..50a59bb0f 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -3,16 +3,16 @@ Written against the public surface, parametrised over the providers this tree can stand up. The memory provider always runs, with no server and no store. A storage provider adds itself to ``SETUPS`` behind its own -``STREAMS_LIVE`` gate: its setup configures the provider, hands back the -client the cases should use, and says which capabilities it lacks, so the -cases marked ``inbound_stream`` or ``unfiltered_read`` are skipped with a -reason on a provider that cannot do them. Every other case reads with a -topic, which is what a store that keys by topic needs. - -What this file pins down is the contract: framing, producer identity, retry -deduplication, supersession, topic filtering, cursor resumption, and store -keys that cannot collide. The workflow-side handles and the two rules about -workflow tasks live in ``test_streams_workflow``. +``STREAMS_LIVE`` gate: its setup hands back a provider instance, the client +the cases should use, and says which capabilities it lacks, so the cases +marked ``reports_positions`` are skipped with a reason on a provider whose +``append()`` learns positions at read time. + +What this file pins down is the contract: the record on the wire, producer +identity, retry deduplication, positions, supersession, topic addressing, +cursor resumption, cursor ownership, and store keys that cannot collide. The +workflow-side handles and the two rules about Workflow Tasks live in +``test_streams_workflow``. """ from __future__ import annotations @@ -21,15 +21,27 @@ import uuid from collections.abc import AsyncIterator, Callable from dataclasses import dataclass -from typing import Any +from typing import Any, cast import pytest -from temporalio import streams -from temporalio.streams import _frame, _ids, _provider +from temporalio.api.common.v1 import Payload +from temporalio.client import Client +from temporalio.common import RawValue +from temporalio.converter import DataConverter +from temporalio.streams import ( + BEGINNING, + Cursor, + RecordKind, + StreamCursorError, + StreamHandle, + StreamProvider, + Supersession, + _ids, + _wire, +) from temporalio.streams._policy import AttemptTracker -from temporalio.streams._record import Cursor, RecordKind -from temporalio.streams.providers import memory +from temporalio.streams.providers.memory import MemoryStreams @dataclass @@ -37,35 +49,40 @@ class ProviderCase: """One provider under test, and what the cases may ask of it.""" name: str - client: Any = None - inbound_streams: bool = True - """Outside producers may write a workflow's inbound stream.""" - unfiltered_reads: bool = True - """A consumer may read the owner's stream without naming a topic.""" + provider: StreamProvider + client: Client | None = None + reports_positions: bool = True + """``append()`` returns where the records landed.""" + + def handle(self, workflow_id: str, *, run_id: str | None = None) -> StreamHandle: + # The memory provider takes no client; every storage provider's setup + # supplies one, so the cast only ever lies for the provider that + # does not read it. + return self.provider.get_stream_handle( + cast(Client, self.client), workflow_id, run_id=run_id + ) async def _memory_case() -> AsyncIterator[ProviderCase]: - memory.reset() - streams.configure(provider="memory") - yield ProviderCase("memory") - memory.reset() + provider = MemoryStreams() + yield ProviderCase("memory", provider) + provider.reset() SETUPS: dict[str, Callable[[], AsyncIterator[ProviderCase]]] = {"memory": _memory_case} _CAPABILITIES = { - "inbound_stream": lambda case: case.inbound_streams, - "unfiltered_read": lambda case: case.unfiltered_reads, + "reports_positions": lambda case: case.reports_positions, } @pytest.fixture(params=sorted(SETUPS)) -async def provider(request: pytest.FixtureRequest) -> AsyncIterator[ProviderCase]: - async for case in SETUPS[request.param](): +async def case(request: pytest.FixtureRequest) -> AsyncIterator[ProviderCase]: + async for provider_case in SETUPS[request.param](): for marker, supported in _CAPABILITIES.items(): - if request.node.get_closest_marker(marker) and not supported(case): - pytest.skip(f"the {case.name} provider does not support {marker}") - yield case + if request.node.get_closest_marker(marker) and not supported(provider_case): + pytest.skip(f"the {provider_case.name} provider does not {marker}") + yield provider_case def new_workflow_id() -> str: @@ -87,338 +104,281 @@ async def _collect() -> None: return out -def test_frame_roundtrip(): - frame = _frame.encode( +def test_record_roundtrips_through_the_wire(): + converter = DataConverter.default.payload_converter + wire = _wire.to_wire( + converter, topic="decisions", kind=RecordKind.DATA, - producer="model", + value={"n": 1}, + producer_id="model", attempt=3, sequence=7, - body=b"payload-bytes", - ) - kind, topic, producer, attempt, sequence, body = _frame.decode(frame) - assert (kind, topic, producer, attempt, sequence, body) == ( - RecordKind.DATA, - "decisions", - "model", - 3, - 7, - b"payload-bytes", ) + parsed = _wire.WireRecord.FromString(wire.SerializeToString()) + record = _wire.from_wire(converter, Cursor("memory:0"), parsed, dict) + assert ( + record.kind, + record.topic, + record.producer_id, + record.attempt, + record.sequence, + record.value, + ) == (RecordKind.DATA, "decisions", "model", 3, 7, {"n": 1}) + assert record.supersession is None + finish = _wire.to_wire(converter, topic="decisions", kind=RecordKind.FINISH) + assert not finish.HasField("body") + assert _wire.from_wire(converter, Cursor("memory:1"), finish, dict).value is None + + +def test_a_stored_supersession_is_not_a_record(): + converter = DataConverter.default.payload_converter + wire = _wire.WireRecord(topic="t", kind=int(RecordKind.SUPERSEDED)) # type: ignore[arg-type] + with pytest.raises(ValueError, match="synthesized"): + _wire.from_wire(converter, Cursor("memory:0"), wire, None) + + +def test_an_unset_kind_is_read_as_data(): + converter = DataConverter.default.payload_converter + wire = _wire.WireRecord(topic="t", body=converter.to_payloads([{"n": 1}])[0]) + record = _wire.from_wire(converter, Cursor("memory:0"), wire, dict) + assert record.kind is RecordKind.DATA + assert record.value == {"n": 1} def test_supersession_is_synthesized_from_observations(): attempts = AttemptTracker() - assert attempts.note("model", 1, Cursor("0")) is None - superseded = attempts.note("model", 2, Cursor("1")) + assert attempts.note("model", 1, topic="t", previous=BEGINNING) is None + superseded = attempts.note("model", 2, topic="t", previous=Cursor("memory:0")) assert superseded is not None assert superseded.kind is RecordKind.SUPERSEDED - assert isinstance(superseded.value, streams.Supersession) - assert superseded.value.previous_attempt == 1 + assert superseded.supersession == Supersession("model", 1, 2) + assert superseded.value is None + # Positioned before the triggering record, so a resume after it delivers + # that record next. + assert superseded.cursor == Cursor("memory:0") # The same attempt again is not a new generation. - assert attempts.note("model", 2, Cursor("2")) is None + assert attempts.note("model", 2, topic="t", previous=Cursor("memory:1")) is None -def test_inbound_stream_ids_cannot_collide(): +def test_topic_keys_cannot_collide(): # A colon in a workflow id must not make two addresses one key. - assert _ids.inbound_stream_id("a:b", "c") != _ids.inbound_stream_id("a", "b:c") - assert _ids.inbound_stream_id("a:b", "") != _ids.inbound_stream_id("a", "b") - assert _ids.inbound_stream_id("a%3Ab", "c") != _ids.inbound_stream_id("a:b", "c") - assert _ids.inbound_stream_id("wf", "inputs") == "wf:inputs" + assert _ids.topic_key("a:b", "c") != _ids.topic_key("a", "b:c") + assert _ids.topic_key("a%3Ab", "c") != _ids.topic_key("a:b", "c") + assert _ids.topic_key("wf", "inputs") == "wf:inputs" -async def test_append_read_roundtrip(provider: ProviderCase): +def test_cursors_name_their_provider(): + assert _wire.cursor_position(BEGINNING, provider="memory") is None + assert _wire.cursor_position(Cursor("memory:42"), provider="memory") == "42" + with pytest.raises(StreamCursorError): + _wire.cursor_position(Cursor("redis:1700000000000-0"), provider="memory") + + +async def test_append_read_roundtrip(case: ProviderCase): workflow_id = new_workflow_id() - producer = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) + stream = case.handle(workflow_id) + producer = stream.producer(topic="out", producer_id="model", attempt=1) + assert (producer.producer_id, producer.attempt) == ("model", 1) await producer.append({"id": "r1"}, {"id": "r2"}) await producer.finish() - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - records = await take(consumer.read(type=dict, topic="out"), 3) + records = await take(stream.read(topic="out", result_type=dict), 3) assert [r.kind for r in records] == [ RecordKind.DATA, RecordKind.DATA, RecordKind.FINISH, ] assert [r.value for r in records[:2]] == [{"id": "r1"}, {"id": "r2"}] - assert all(r.producer == "model" and r.attempt == 1 for r in records) + assert records[2].value is None + assert all(r.producer_id == "model" and r.attempt == 1 for r in records) assert [r.sequence for r in records] == [0, 1, 2] assert all(r.topic == "out" for r in records) -@pytest.mark.inbound_stream -async def test_inbound_records_carry_no_topic(provider: ProviderCase): +async def test_raw_values_pass_through_untouched(case: ProviderCase): workflow_id = new_workflow_id() - producer = await streams.producer( - provider.client, - workflow_id=workflow_id, - stream="inputs", - producer_id="model", - attempt=1, - ) - await producer.append({"id": "r1"}) - await producer.finish() + stream = case.handle(workflow_id) + payload = Payload(metadata={"encoding": b"binary/plain"}, data=b"\x00\x01raw") + producer = stream.producer(topic="out", producer_id="model", attempt=1) + await producer.append(RawValue(payload)) - consumer = await streams.consumer( - provider.client, workflow_id=workflow_id, stream="inputs" - ) - records = await take(consumer.read(type=dict), 2) - assert [r.kind for r in records] == [RecordKind.DATA, RecordKind.FINISH] - assert records[0].value == {"id": "r1"} - # An inbound stream has no topics; its name is the whole address. - assert all(r.topic == "" for r in records) - with pytest.raises(ValueError, match="inbound stream 'inputs' has no topics"): - await take(consumer.read(type=dict, topic="inputs"), 1) + records = await take(stream.read(topic="out", result_type=RawValue), 1) + assert isinstance(records[0].value, RawValue) + assert records[0].value.payload == payload -async def test_retried_append_is_deduplicated(provider: ProviderCase): +@pytest.mark.reports_positions +async def test_retried_append_returns_the_original_position(case: ProviderCase): workflow_id = new_workflow_id() - first = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) - await first.append({"id": "r1"}) + stream = case.handle(workflow_id) + first = stream.producer(topic="out", producer_id="model", attempt=1) + landed = await first.append({"id": "r1"}) + assert landed is not None # The retry of the same attempt starts its sequence over and appends the - # same record. The provider must not store it twice, and says so by - # returning no position for what it dropped. - retry = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) - assert await retry.append({"id": "r1"}) is None - - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - records = await take(consumer.read(type=dict, topic="out"), 1) + # same record. The provider stores it once and answers with where the + # original landed, so the retry can checkpoint the same position. + retry = stream.producer(topic="out", producer_id="model", attempt=1) + assert await retry.append({"id": "r1"}) == landed + # An empty call writes nothing and answers the same way. + assert await retry.append() == landed + + records = await take(stream.read(topic="out", result_type=dict), 1) assert records[0].value == {"id": "r1"} + assert records[0].cursor == landed # The store holds exactly the one record: the newest position is its cursor. - assert await consumer.latest(topic="out") == records[0].cursor + assert await stream.latest(topic="out") == landed -async def test_new_attempt_supersedes_the_old_one(provider: ProviderCase): +async def test_retried_append_is_stored_once(case: ProviderCase): workflow_id = new_workflow_id() - first = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) + stream = case.handle(workflow_id) + first = stream.producer(topic="out", producer_id="model", attempt=1) + await first.append({"id": "r1"}) + retry = stream.producer(topic="out", producer_id="model", attempt=1) + await retry.append({"id": "r1"}) + await retry.append({"id": "r2"}) + + records = await take(stream.read(topic="out", result_type=dict), 2) + assert [r.value for r in records] == [{"id": "r1"}, {"id": "r2"}] + + +async def test_new_attempt_supersedes_the_old_one(case: ProviderCase): + workflow_id = new_workflow_id() + stream = case.handle(workflow_id) + first = stream.producer(topic="out", producer_id="model", attempt=1) await first.append({"text": "The capital of"}) - second = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=2, - ) + second = stream.producer(topic="out", producer_id="model", attempt=2) await second.append({"text": "Paris is the capital"}) - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - records = await take(consumer.read(type=dict, topic="out"), 3) + records = await take(stream.read(topic="out", result_type=dict), 3) assert records[0].kind is RecordKind.DATA and records[0].attempt == 1 assert records[1].kind is RecordKind.SUPERSEDED - assert isinstance(records[1].value, streams.Supersession) - assert records[1].value.previous_attempt == 1 + assert records[1].supersession == Supersession("model", 1, 2) + assert records[1].value is None assert records[2].kind is RecordKind.DATA and records[2].attempt == 2 -async def test_topic_filter_on_the_owners_stream(provider: ProviderCase): - # Two producers on two topics of the stream the workflow publishes. The - # filter is only meaningful on a store that mixes topics, which is this - # one; an inbound stream carries none. +async def test_a_superseded_record_resumes_to_the_triggering_record( + case: ProviderCase, +): workflow_id = new_workflow_id() - on_a = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="a", - producer_id="tool-a", - attempt=1, - ) - await on_a.append({"n": 1}) - on_b = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="b", - producer_id="tool-b", - attempt=1, + stream = case.handle(workflow_id) + first = stream.producer(topic="out", producer_id="model", attempt=1) + await first.append({"n": 1}) + second = stream.producer(topic="out", producer_id="model", attempt=2) + await second.append({"n": 2}) + + records = await take(stream.read(topic="out", result_type=dict), 3) + superseded = records[1] + assert superseded.kind is RecordKind.SUPERSEDED + # The synthesized record sits at the position before the new attempt's + # first record, so a consumer that checkpoints it and restarts is handed + # that record rather than skipping it. + assert superseded.cursor == records[0].cursor + resumed = await take( + stream.read(topic="out", result_type=dict, after=superseded.cursor), 1 ) - await on_b.append({"n": 2}) - - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - only_a = await take(consumer.read(type=dict, topic="a"), 1) - assert [(r.topic, r.value) for r in only_a] == [("a", {"n": 1})] - only_b = await take(consumer.read(type=dict, topic="b"), 1) - assert [(r.topic, r.value) for r in only_b] == [("b", {"n": 2})] + assert resumed[0].kind is RecordKind.DATA + assert resumed[0].value == {"n": 2} -@pytest.mark.unfiltered_read -async def test_a_read_without_a_topic_sees_every_topic(provider: ProviderCase): +async def test_topics_are_addressed_by_name(case: ProviderCase): + # Two producers on two topics of the same workflow's stream: each read + # names its topic and sees only that topic's records. workflow_id = new_workflow_id() - on_a = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="a", - producer_id="tool-a", - attempt=1, - ) + stream = case.handle(workflow_id) + on_a = stream.producer(topic="a", producer_id="tool-a", attempt=1) await on_a.append({"n": 1}) - on_b = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="b", - producer_id="tool-b", - attempt=1, - ) + on_b = stream.producer(topic="b", producer_id="tool-b", attempt=1) await on_b.append({"n": 2}) - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - both = await take(consumer.read(type=dict), 2) - assert [(r.topic, r.value) for r in both] == [("a", {"n": 1}), ("b", {"n": 2})] + only_a = await take(stream.read(topic="a", result_type=dict), 1) + assert [(r.topic, r.value) for r in only_a] == [("a", {"n": 1})] + only_b = await take(stream.read(topic="b", result_type=dict), 1) + assert [(r.topic, r.value) for r in only_b] == [("b", {"n": 2})] -async def test_cursor_resumes_where_it_points(provider: ProviderCase): +async def test_cursor_resumes_where_it_points(case: ProviderCase): workflow_id = new_workflow_id() - producer = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) + stream = case.handle(workflow_id) + producer = stream.producer(topic="out", producer_id="model", attempt=1) await producer.append({"n": 1}, {"n": 2}, {"n": 3}) - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - records = await take(consumer.read(type=dict, topic="out"), 3) + records = await take(stream.read(topic="out", result_type=dict), 3) checkpoint = records[0].cursor # Resuming after a record hands back everything past it and nothing # twice, without the reader ever advancing a cursor itself. - resumed = await streams.consumer(provider.client, workflow_id=workflow_id) - again = await take(resumed.read(type=dict, topic="out", after=checkpoint), 2) + again = await take(stream.read(topic="out", result_type=dict, after=checkpoint), 2) assert [r.value for r in again] == [{"n": 2}, {"n": 3}] -async def test_append_cursor_names_the_last_record_of_the_batch( - provider: ProviderCase, -): +@pytest.mark.reports_positions +async def test_append_cursor_names_the_last_record_of_the_batch(case: ProviderCase): workflow_id = new_workflow_id() - producer = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) + stream = case.handle(workflow_id) + producer = stream.producer(topic="out", producer_id="model", attempt=1) appended = await producer.append({"n": 1}, {"n": 2}, {"n": 3}) - if appended is None: - pytest.skip(f"the {provider.name} provider learns positions at read time") - await producer.append({"n": 4}) + assert appended is not None + then = await producer.append({"n": 4}) # A producer that resumes a reader after its own append must see only # what came later, not the tail of the batch it just wrote. - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - records = await take(consumer.read(type=dict, topic="out", after=appended), 1) + records = await take(stream.read(topic="out", result_type=dict, after=appended), 1) assert [r.value for r in records] == [{"n": 4}] - assert await producer.append() is None + assert records[0].cursor == then + assert await producer.append() == then -async def test_latest_positions_a_reader_at_the_end(provider: ProviderCase): +async def test_latest_positions_a_reader_at_the_end(case: ProviderCase): workflow_id = new_workflow_id() - producer = await streams.producer( - provider.client, - workflow_id=workflow_id, - topic="out", - producer_id="model", - attempt=1, - ) - consumer = await streams.consumer(provider.client, workflow_id=workflow_id) - assert await consumer.latest(topic="out") == streams.BEGINNING + stream = case.handle(workflow_id) + producer = stream.producer(topic="out", producer_id="model", attempt=1) + assert await stream.latest(topic="out") == BEGINNING await producer.append({"n": 1}, {"n": 2}) - since = await consumer.latest(topic="out") + since = await stream.latest(topic="out") await producer.append({"n": 3}) # A reader that positioned itself before the last append sees only what # came after, which is how a client follows a turn it is about to start. - records = await take(consumer.read(type=dict, topic="out", after=since), 1) + records = await take(stream.read(topic="out", result_type=dict, after=since), 1) assert [r.value for r in records] == [{"n": 3}] -@pytest.mark.inbound_stream -async def test_stream_addresses_with_colons_do_not_share_a_store( - provider: ProviderCase, -): +async def test_topic_addresses_with_colons_do_not_share_a_store(case: ProviderCase): # ("wf:x", "y") and ("wf", "x:y") differ only in where the colon sits. base = new_workflow_id() - left = await streams.producer( - provider.client, workflow_id=f"{base}:x", stream="y", producer_id="l", attempt=1 - ) - right = await streams.producer( - provider.client, workflow_id=base, stream="x:y", producer_id="r", attempt=1 + left = case.handle(f"{base}:x") + right = case.handle(base) + await left.producer(topic="y", producer_id="l", attempt=1).append({"side": "left"}) + await right.producer(topic="x:y", producer_id="r", attempt=1).append( + {"side": "right"} ) - await left.append({"side": "left"}) - await right.append({"side": "right"}) - seen_left = await streams.consumer( - provider.client, workflow_id=f"{base}:x", stream="y" - ) - only_left = await take(seen_left.read(type=dict), 1) + only_left = await take(left.read(topic="y", result_type=dict), 1) assert [r.value for r in only_left] == [{"side": "left"}] - assert await seen_left.latest() == only_left[0].cursor - seen_right = await streams.consumer(provider.client, workflow_id=base, stream="x:y") - only_right = await take(seen_right.read(type=dict), 1) + assert await left.latest(topic="y") == only_left[0].cursor + only_right = await take(right.read(topic="x:y", result_type=dict), 1) assert [r.value for r in only_right] == [{"side": "right"}] - assert await seen_right.latest() == only_right[0].cursor + assert await right.latest(topic="x:y") == only_right[0].cursor -async def test_producer_needs_exactly_one_address_and_an_identity( - provider: ProviderCase, -): - workflow_id = new_workflow_id() +async def test_a_foreign_cursor_is_refused_at_the_call(case: ProviderCase): + stream = case.handle(new_workflow_id()) + # Refused by read() itself, not by the first iteration of its generator, + # so the caller's except clause is where the mistake surfaces. + with pytest.raises(StreamCursorError): + stream.read(topic="out", after=Cursor("elsewhere:42")) + + +async def test_argument_mistakes_are_value_errors(case: ProviderCase): + stream = case.handle(new_workflow_id()) with pytest.raises(ValueError): - await streams.producer( - provider.client, workflow_id=workflow_id, producer_id="model", attempt=1 - ) + stream.read(topic="") with pytest.raises(ValueError): - await streams.producer( - provider.client, - workflow_id=workflow_id, - stream="inputs", - topic="out", - producer_id="model", - attempt=1, - ) + stream.producer(topic="", producer_id="model", attempt=1) # Outside an activity there is no identity to fall back on. with pytest.raises(ValueError, match="producer_id is required"): - await streams.producer(provider.client, workflow_id=workflow_id, topic="out") - - -def test_unknown_provider_is_a_clear_error(): - with pytest.raises(RuntimeError, match="no stream provider 'nope'"): - streams.configure(provider="nope") - - -async def test_opening_a_stream_needs_a_configured_provider(): - # Building a provider is process setup, so the first workflow's thread - # is not allowed to do it as a side effect of opening a stream. - _provider._active = None - with pytest.raises(RuntimeError, match="streams.configure"): - await streams.consumer(None, workflow_id="wf") - # Closing with nothing configured is allowed, so a shutdown path can - # call it unconditionally. - await streams.close() - streams.configure(provider="memory") - assert await streams.consumer(None, workflow_id="wf") is not None - await streams.close() + stream.producer(topic="out") diff --git a/tests/streams/test_streams_workflow.py b/tests/streams/test_streams_workflow.py index 40487686d..58fb274ef 100644 --- a/tests/streams/test_streams_workflow.py +++ b/tests/streams/test_streams_workflow.py @@ -1,25 +1,37 @@ """Workflow-side conformance for the stream contract. -Runs the reader and writer handles inside a real workflow on the memory -provider with a warm cache, and states the two rules about workflow tasks as -tests: a publish commits with its task (rule 1), and reads are recorded -observations that replay re-supplies (rule 2). The memory provider keeps -neither and says so in its docstring, so those two are strict expected -failures here. A storage provider that runs this module turns them into -passes; that is the measurement they exist for. +Runs the reader and writer inside a real workflow on the memory provider +with a warm cache, and states the two rules about Workflow Tasks as tests: a +publish commits with its task (rule 1), and reads are recorded observations +that replay re-supplies (rule 2). The memory provider keeps neither and says +so in its docstring, so those two are strict expected failures here. A +storage provider that runs this module turns them into passes; that is the +measurement they exist for. + +The rest is what the portable surface promises on every provider: the +lifecycle hooks the worker calls, one subscription per topic per run, a read +that ends when the chain closes, a handle that follows continue-as-new, and +a topic shared by the workflow and an outside producer. """ from __future__ import annotations +import asyncio import uuid from typing import Any import pytest -from temporalio import streams, workflow +from temporalio import workflow from temporalio.client import Client -from temporalio.streams import RecordKind -from temporalio.streams.providers import memory +from temporalio.streams import ( + Cursor, + ReadSource, + RecordKind, + StreamCursorError, + WriteSink, +) +from temporalio.streams.providers.memory import MemoryStreams from temporalio.testing import WorkflowEnvironment from temporalio.worker import Replayer from tests.helpers import new_worker @@ -29,49 +41,46 @@ DECISIONS = "decisions" -@pytest.fixture(autouse=True) -def _fresh_memory_provider(env: WorkflowEnvironment): # pyright: ignore[reportUnusedFunction] +@pytest.fixture +def provider(env: WorkflowEnvironment): # pyright: ignore[reportUnusedFunction] if env.supports_time_skipping: pytest.skip( "the memory provider polls on a timer, which time skipping turns into a spin" ) - memory.reset() - streams.configure(provider="memory") - yield - memory.reset() + streams = MemoryStreams() + yield streams + streams.reset() @workflow.defn class ContractLoop: """Reads ``inputs``, publishes a decision per value, reports control records.""" - def __init__(self) -> None: - streams.prepare() - @workflow.run async def run(self) -> list[dict[str, Any]]: - inputs = streams.reader(INPUTS, type=dict) - decisions = streams.writer(DECISIONS) + inputs = workflow.stream_reader(INPUTS, result_type=dict) + decisions = workflow.stream_writer(DECISIONS) trace: list[dict[str, Any]] = [] try: async for record in inputs: - if isinstance(record.value, streams.Supersession): + if record.kind is RecordKind.SUPERSEDED: + assert record.supersession is not None trace.append( { "kind": "superseded", - "replaced": record.value.previous_attempt, - "attempt": record.value.attempt, + "replaced": record.supersession.previous_attempt, + "attempt": record.supersession.attempt, } ) - await decisions.publish( - {"retracting_attempt": record.value.previous_attempt} + decisions.publish( + {"retracting_attempt": record.supersession.previous_attempt} ) continue if record.kind is RecordKind.FINISH: - trace.append({"kind": "finish", "producer": record.producer}) + trace.append({"kind": "finish", "producer": record.producer_id}) break - assert isinstance(record.value, dict) - await decisions.publish({"decided": record.value["n"]}) + assert record.value is not None + decisions.publish({"decided": record.value["n"]}) trace.append( { "kind": "decision", @@ -81,42 +90,34 @@ async def run(self) -> list[dict[str, Any]]: ) finally: inputs.close() - await decisions.finish() + decisions.finish() # Twice on purpose: a finished topic stays finished, with one marker. - await decisions.finish() - streams.drain() + decisions.finish() return trace -async def _run_the_loop(client: Client) -> tuple[Any, list[dict[str, Any]]]: +async def _run_the_loop( + client: Client, provider: MemoryStreams +) -> tuple[Any, list[dict[str, Any]]]: workflow_id = f"streams-wf-{uuid.uuid4().hex}" - async with new_worker(client, ContractLoop, **streams.worker_options()) as worker: + async with new_worker(client, ContractLoop, plugins=[provider]) as worker: handle = await client.start_workflow( ContractLoop.run, id=workflow_id, task_queue=worker.task_queue ) - first = await streams.producer( - client, - workflow_id=workflow_id, - stream=INPUTS, - producer_id="model", - attempt=1, - ) + stream = provider.get_stream_handle(client, workflow_id) + first = stream.producer(topic=INPUTS, producer_id="model", attempt=1) await first.append({"n": 1}, {"n": 2}) - second = await streams.producer( - client, - workflow_id=workflow_id, - stream=INPUTS, - producer_id="model", - attempt=2, - ) + second = stream.producer(topic=INPUTS, producer_id="model", attempt=2) await second.append({"n": 3}) await second.finish() trace = await handle.result() return handle, trace -async def test_workflow_reads_decides_and_publishes(client: Client): - handle, trace = await _run_the_loop(client) +async def test_workflow_reads_decides_and_publishes( + client: Client, provider: MemoryStreams +): + handle, trace = await _run_the_loop(client, provider) assert trace == [ {"kind": "decision", "n": 1, "attempt": 1}, {"kind": "decision", "n": 2, "attempt": 1}, @@ -126,8 +127,8 @@ async def test_workflow_reads_decides_and_publishes(client: Client): ] # The outside view of what the workflow published, on its own topic. - consumer = await streams.consumer(client, workflow_id=handle.id) - records = await take(consumer.read(type=dict, topic=DECISIONS), 5) + stream = provider.get_stream_handle(client, handle.id) + records = await take(stream.read(topic=DECISIONS, result_type=dict), 5) assert [(r.kind, r.value) for r in records] == [ (RecordKind.DATA, {"decided": 1}), (RecordKind.DATA, {"decided": 2}), @@ -135,9 +136,30 @@ async def test_workflow_reads_decides_and_publishes(client: Client): (RecordKind.DATA, {"decided": 3}), (RecordKind.FINISH, None), ] - assert all(r.producer == "" and r.topic == DECISIONS for r in records) + assert all(r.producer_id == "" and r.topic == DECISIONS for r in records) # The second finish() wrote nothing: the marker is the newest record. - assert await consumer.latest() == records[-1].cursor + assert await stream.latest(topic=DECISIONS) == records[-1].cursor + + +async def test_read_ends_when_the_workflow_closes_and_the_tail_is_delivered( + client: Client, provider: MemoryStreams +): + handle, _ = await _run_the_loop(client, provider) + stream = provider.get_stream_handle(client, handle.id) + + async def read_everything() -> list[Any]: + return [r.value async for r in stream.read(topic=DECISIONS, result_type=dict)] + + # No count and no early break: the read ends by itself once the workflow + # is closed and everything it retained has been handed over. + values = await asyncio.wait_for(read_everything(), 30) + assert values == [ + {"decided": 1}, + {"decided": 2}, + {"retracting_attempt": 1}, + {"decided": 3}, + None, + ] @pytest.mark.xfail( @@ -148,12 +170,14 @@ async def test_workflow_reads_decides_and_publishes(client: Client): "provider reads live process memory instead" ), ) -async def test_replay_without_the_store_resupplies_the_records(client: Client): - handle, _ = await _run_the_loop(client) +async def test_replay_without_the_store_resupplies_the_records( + client: Client, provider: MemoryStreams +): + handle, _ = await _run_the_loop(client, provider) history = await handle.fetch_history() - memory.reset() - replayer = Replayer(workflows=[ContractLoop], **streams.worker_options()) + provider.reset() + replayer = Replayer(workflows=[ContractLoop], plugins=[provider]) await replayer.replay_workflow(history) @@ -167,20 +191,16 @@ async def test_replay_without_the_store_resupplies_the_records(client: Client): class PublishThenFail: """Publishes, then fails its first workflow task; the retry publishes again.""" - def __init__(self) -> None: - streams.prepare() - @workflow.run async def run(self) -> None: - decisions = streams.writer(DECISIONS) + decisions = workflow.stream_writer(DECISIONS) run_id = workflow.info().run_id committed = run_id in _failed_once - await decisions.publish({"committed": committed}) + decisions.publish({"committed": committed}) if not committed: _failed_once.add(run_id) raise RuntimeError("the first task fails after publishing") - await decisions.finish() - streams.drain() + decisions.finish() @pytest.mark.xfail( @@ -191,18 +211,237 @@ async def run(self) -> None: "visible at publish time" ), ) -async def test_a_failed_task_publishes_nothing(client: Client): +async def test_a_failed_task_publishes_nothing(client: Client, provider: MemoryStreams): workflow_id = f"streams-wf-{uuid.uuid4().hex}" - async with new_worker( - client, PublishThenFail, **streams.worker_options() - ) as worker: + async with new_worker(client, PublishThenFail, plugins=[provider]) as worker: handle = await client.start_workflow( PublishThenFail.run, id=workflow_id, task_queue=worker.task_queue ) - consumer = await streams.consumer(client, workflow_id=workflow_id) - records = await take(consumer.read(type=dict, topic=DECISIONS), 2, timeout=30) + stream = provider.get_stream_handle(client, workflow_id) + records = await take( + stream.read(topic=DECISIONS, result_type=dict), 2, timeout=30 + ) await handle.result() assert [(r.kind, r.value) for r in records] == [ (RecordKind.DATA, {"committed": True}), (RecordKind.FINISH, None), ] + + +@workflow.defn +class Relay: + """Publishes one record per run and continues as new once.""" + + @workflow.run + async def run(self, run: int) -> None: + decisions = workflow.stream_writer(DECISIONS) + decisions.publish({"run": run}) + if run == 0: + workflow.continue_as_new(run + 1) + decisions.finish() + + +class _RecordingHalf: + """A workflow half that logs the hooks the worker calls, then delegates.""" + + def __init__(self, inner: Any, calls: list[tuple[str, str]]) -> None: + self._inner = inner + self._calls = calls + + def open_reader(self, topic: str, *, after: Cursor) -> ReadSource: + return self._inner.open_reader(topic, after=after) + + def open_writer(self, topic: str) -> WriteSink: + return self._inner.open_writer(topic) + + def on_workflow_start(self) -> None: + self._calls.append(("start", workflow.info().run_id)) + + async def on_workflow_finish(self) -> None: + self._calls.append(("finish", workflow.info().run_id)) + + +class HookedMemory(MemoryStreams): + """The memory provider with its lifecycle hooks made visible.""" + + def __init__(self) -> None: + super().__init__() + self.calls: list[tuple[str, str]] = [] + + def workflow_provider(self) -> Any: + return _RecordingHalf(super().workflow_provider(), self.calls) + + +@pytest.mark.usefixtures("provider") +async def test_the_worker_calls_the_lifecycle_hooks_around_every_run(client: Client): + hooked = HookedMemory() + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker(client, Relay, plugins=[hooked]) as worker: + handle = await client.start_workflow( + Relay.run, 0, id=workflow_id, task_queue=worker.task_queue + ) + await handle.result() + # Start before the function, finish after it, on both runs: the finish + # hook runs on the continue-as-new exit too, so a provider that parked + # something against the first run can let go before the successor starts. + kinds = [kind for kind, _ in hooked.calls] + assert kinds == ["start", "finish", "start", "finish"] + runs = [run_id for _, run_id in hooked.calls] + assert runs[0] == runs[1] and runs[2] == runs[3] and runs[0] != runs[2] + + +async def test_a_handle_without_a_run_id_reads_across_continue_as_new( + client: Client, provider: MemoryStreams +): + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker(client, Relay, plugins=[provider]) as worker: + handle = await client.start_workflow( + Relay.run, 0, id=workflow_id, task_queue=worker.task_queue + ) + stream = provider.get_stream_handle(client, workflow_id) + + async def read_everything() -> list[Any]: + return [ + (r.kind, r.value) + async for r in stream.read(topic=DECISIONS, result_type=dict) + ] + + records = await asyncio.wait_for(read_everything(), 30) + await handle.result() + # The chain is followed: the successor's records arrive on the same read, + # and the read ends only when the last run of the chain is closed. + assert records == [ + (RecordKind.DATA, {"run": 0}), + (RecordKind.DATA, {"run": 1}), + (RecordKind.FINISH, None), + ] + + +@workflow.defn +class SharedReaders: + """Opens the same topic twice and pulls from both readers in turn.""" + + @workflow.run + async def run(self) -> list[Any]: + first = workflow.stream_reader(INPUTS, result_type=dict) + second = workflow.stream_reader(INPUTS, result_type=dict) + trace: list[Any] = ["shared" if first is second else "separate"] + try: + workflow.stream_reader(INPUTS, result_type=dict, after=Cursor("memory:0")) + except ValueError: + trace.append("after-rejected") + try: + workflow.stream_reader(INPUTS, result_type=list) + except ValueError: + trace.append("type-rejected") + trace.append((await first.__anext__()).value) + trace.append((await second.__anext__()).value) + first.close() + return trace + + +async def test_a_second_reader_on_a_topic_shares_the_subscription( + client: Client, provider: MemoryStreams +): + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker(client, SharedReaders, plugins=[provider]) as worker: + handle = await client.start_workflow( + SharedReaders.run, id=workflow_id, task_queue=worker.task_queue + ) + stream = provider.get_stream_handle(client, workflow_id) + await stream.producer(topic=INPUTS, producer_id="model", attempt=1).append( + {"n": 1}, {"n": 2} + ) + assert await handle.result() == [ + "shared", + "after-rejected", + "type-rejected", + {"n": 1}, + {"n": 2}, + ] + + +@workflow.defn +class ForeignCursor: + """Resumes from a cursor another provider minted.""" + + @workflow.run + async def run(self) -> str: + try: + workflow.stream_reader(INPUTS, after=Cursor("elsewhere:1")) + except StreamCursorError: + return "refused" + return "accepted" + + +async def test_the_workflow_reader_refuses_a_foreign_cursor( + client: Client, provider: MemoryStreams +): + async with new_worker(client, ForeignCursor, plugins=[provider]) as worker: + result = await client.execute_workflow( + ForeignCursor.run, + id=f"streams-wf-{uuid.uuid4().hex}", + task_queue=worker.task_queue, + ) + assert result == "refused" + + +@workflow.defn +class NoProvider: + """Opens a stream on a worker that has no provider.""" + + @workflow.run + async def run(self) -> str: + try: + workflow.stream_reader(INPUTS) + except RuntimeError as error: + return str(error) + return "opened" + + +async def test_a_worker_without_a_provider_says_so(client: Client): + async with new_worker(client, NoProvider) as worker: + result = await client.execute_workflow( + NoProvider.run, + id=f"streams-wf-{uuid.uuid4().hex}", + task_queue=worker.task_queue, + ) + assert "no stream provider is configured" in result + + +@workflow.defn +class OneLine: + """Publishes one record and finishes the topic.""" + + @workflow.run + async def run(self) -> None: + decisions = workflow.stream_writer(DECISIONS) + decisions.publish({"from": "workflow"}) + decisions.finish() + + +async def test_an_outside_producer_and_the_workflow_share_a_topic( + client: Client, provider: MemoryStreams +): + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker(client, OneLine, plugins=[provider]) as worker: + stream = provider.get_stream_handle(client, workflow_id) + await stream.producer(topic=DECISIONS, producer_id="tool", attempt=1).append( + {"from": "producer"} + ) + handle = await client.start_workflow( + OneLine.run, id=workflow_id, task_queue=worker.task_queue + ) + await handle.result() + + async def read_everything() -> list[Any]: + return [r async for r in stream.read(topic=DECISIONS, result_type=dict)] + + records = await asyncio.wait_for(read_everything(), 30) + # Both writers land on one topic in one order, each under its own + # identity: the producer's records carry its id, the workflow's carry none. + assert [(r.producer_id, r.kind, r.value) for r in records] == [ + ("tool", RecordKind.DATA, {"from": "producer"}), + ("", RecordKind.DATA, {"from": "workflow"}), + ("", RecordKind.FINISH, None), + ] From 3f16fd36543d76e21dd09b30f26b32e5d3071b63 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 01:54:17 -0700 Subject: [PATCH 28/51] Moved the stream demo and changelog entry onto the new surface. --- CHANGELOG.md | 8 +++++-- streams_demo/agent_loop.py | 42 +++++++++++++--------------------- streams_demo/provider_setup.py | 27 +++++++++++++--------- streams_demo/run_demo.py | 29 ++++++++++------------- 4 files changed, 50 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 568f64b4b..06eb5da58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,8 +22,12 @@ to include examples, links to docs, or any other relevant information. - Added the `temporalio.contrib.gcp.cloud_run.id` module with the `CloudRunIdPlugin` client plugin to set the worker identity on Cloud Run. - **Experimental**: `temporalio.streams` defines one stream interface a workflow - can read, decide on, and write, with a registry that picks the provider when - the worker is built. `temporalio.streams.providers.memory` is the in-memory + can read, decide on, and write. `workflow.stream_reader()` and + `workflow.stream_writer()` are the workflow-side entry points, a provider is a + worker plugin passed as `Worker(plugins=[provider])`, and + `provider.get_stream_handle()` reads and appends from outside. The record on + the wire is `temporal.api.stream.v1.StreamRecord` on every provider. + `temporalio.streams.providers.memory.MemoryStreams` is the in-memory reference provider the conformance tests run against. ### Changed diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index f6f14b873..330cb54c2 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -14,7 +14,8 @@ from datetime import timedelta from typing import Any -from temporalio import activity, streams, workflow +from temporalio import activity, workflow +from temporalio.streams import RecordKind DECISIONS = "decisions" INPUTS = "inputs" @@ -41,50 +42,42 @@ def decide(token: dict[str, Any]) -> dict[str, Any]: class AgentLoop: """Read, decide, write, until the producer says it has finished.""" - def __init__(self) -> None: - """Let the provider install what it needs before the first task. - - A no-op except on a transport that serves outside readers through - handlers on this workflow, which has to register them before the - first task completes or an early reader finds nothing to talk to. - """ - streams.prepare() - @workflow.run async def run(self, limit: int) -> list[dict[str, Any]]: """Decide on at most ``limit`` inputs, then return the trace.""" - inputs = streams.reader(INPUTS, type=dict, idle_timeout=timedelta(seconds=1)) - decisions = streams.writer(DECISIONS) + inputs = workflow.stream_reader(INPUTS, result_type=dict) + decisions = workflow.stream_writer(DECISIONS) trace: list[dict[str, Any]] = [] accepted = 0 try: async for record in inputs: - if isinstance(record.value, streams.Supersession): + if record.kind is RecordKind.SUPERSEDED: # A newer attempt of the same producer started writing. The # decisions already published stand, so the workflow says so # rather than pretending they can be withdrawn. + assert record.supersession is not None trace.append( { "kind": "superseded", - "producer": record.producer, - "replaced": record.value.previous_attempt, - "attempt": record.value.attempt, + "producer": record.producer_id, + "replaced": record.supersession.previous_attempt, + "attempt": record.supersession.attempt, } ) - await decisions.publish( - {"retracting_attempt": record.value.previous_attempt} + decisions.publish( + {"retracting_attempt": record.supersession.previous_attempt} ) continue - if record.kind is streams.RecordKind.FINISH: + if record.kind is RecordKind.FINISH: # The producer says it is done, which is what ends the loop. # Counting decisions instead would leave the terminal record # unread and let the workflow finish while its producer is # still writing. - trace.append({"kind": "finish", "producer": record.producer}) + trace.append({"kind": "finish", "producer": record.producer_id}) break - assert isinstance(record.value, dict) + assert record.value is not None decision = decide(record.value) - await decisions.publish(decision) + decisions.publish(decision) receipt = await workflow.execute_activity( record_decision, decision, @@ -101,8 +94,5 @@ async def run(self, limit: int) -> list[dict[str, Any]]: break finally: inputs.close() - await decisions.finish() - # Lets go of anything the provider parked against this run, so a - # transport that holds a long poll open can let the workflow return. - streams.drain() + decisions.finish() return trace diff --git a/streams_demo/provider_setup.py b/streams_demo/provider_setup.py index 52ebbd266..2e4bcc350 100644 --- a/streams_demo/provider_setup.py +++ b/streams_demo/provider_setup.py @@ -1,15 +1,17 @@ """Pick the provider for a demo run from the environment. -``STREAMS_PROVIDER`` names any registered provider; this base tree carries -only ``memory``, and each provider branch adds its own name. The demo needs a -Temporal server to run the workflow either way; ``TEMPORAL_ADDRESS`` points -at it. +``STREAMS_PROVIDER`` names a provider; this base tree carries only ``memory``, +and each provider branch adds its own name here. The demo needs a Temporal +server to run the workflow either way; ``TEMPORAL_ADDRESS`` points at it. """ from __future__ import annotations import os +from temporalio.streams.providers import ProviderPlugin +from temporalio.streams.providers.memory import MemoryStreams + NAME = os.environ.get("STREAMS_PROVIDER", "memory") # The memory provider is not replay-safe, so its demo keeps the cache warm. @@ -17,15 +19,18 @@ WORKFLOW_CACHE = int(os.environ.get("STREAMS_WORKFLOW_CACHE", "512")) -async def open() -> tuple[str, dict]: - """The server to connect to and the options :func:`configure` takes.""" - return os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"), {"provider": NAME} +async def open() -> tuple[str, ProviderPlugin]: + """The server to connect to and the provider the worker and the client share.""" + if NAME != "memory": + raise SystemExit(f"this tree carries no stream provider named {NAME!r}") + return os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"), MemoryStreams() -async def close() -> None: +async def close(provider: ProviderPlugin) -> None: """Let go of whatever :func:`open` acquired. - Nothing here: the memory provider holds no connection. A provider branch - that opens one closes it here, so the demo's teardown reads the same on - every provider. + The memory provider holds no connection, so this is its ``close()`` and + nothing more. A provider branch that opens one closes it the same way, so + the demo's teardown reads the same on every provider. """ + await provider.close() diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index c4fc8e042..1238fad11 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -7,7 +7,7 @@ the run as it allows is rebuilt rather than remembered; - a producer whose second attempt supersedes its first, which the reader has to report and the workflow has to act on; -- an outside consumer reading what the workflow published. +- an outside reader following what the workflow published. Byte-identical in every tree. ``provider_setup`` is what differs, and it is the only import here that names a provider. @@ -23,24 +23,23 @@ from pathlib import Path from typing import Any -from temporalio import streams from temporalio.api.enums.v1 import EventType from temporalio.client import Client +from temporalio.streams import StreamHandle from temporalio.worker import Worker sys.path.insert(0, str(Path(__file__).resolve().parent)) import provider_setup # noqa: E402 -from agent_loop import INPUTS, AgentLoop, record_decision # noqa: E402 +from agent_loop import DECISIONS, INPUTS, AgentLoop, record_decision # noqa: E402 DECISION_LIMIT = 8 EXPECTED_OUTPUT = 6 -async def collect_output(client: Client, workflow_id: str, want: int) -> list[dict]: +async def collect_output(stream: StreamHandle, want: int) -> list[dict]: """Read ``want`` decisions off the workflow's stream from outside it.""" - reader = await streams.consumer(client, workflow_id=workflow_id) seen: list[dict] = [] - async for record in reader.read(type=dict, topic="decisions"): + async for record in stream.read(topic=DECISIONS, result_type=dict): seen.append({"kind": record.kind.name, "value": record.value}) if len(seen) >= want: break @@ -51,9 +50,8 @@ async def main() -> int: """Run the demo once and write what happened next to this file.""" out = Path(__file__).resolve().parent / f"results-{provider_setup.NAME}" out.mkdir(exist_ok=True) - target, options = await provider_setup.open() + target, provider = await provider_setup.open() client = await Client.connect(target, namespace="default") - streams.configure(**options) uid = f"ai198-contract-{provider_setup.NAME}-" + uuid.uuid4().hex record: dict[str, Any] = { @@ -69,24 +67,21 @@ async def main() -> int: workflows=[AgentLoop], activities=[record_decision], max_cached_workflows=provider_setup.WORKFLOW_CACHE, - **streams.worker_options(), + plugins=[provider], ): handle = await client.start_workflow( AgentLoop.run, DECISION_LIMIT, id=uid, task_queue=uid ) - output = asyncio.create_task(collect_output(client, uid, EXPECTED_OUTPUT)) + stream = provider.get_stream_handle(client, uid) + output = asyncio.create_task(collect_output(stream, EXPECTED_OUTPUT)) # The first attempt writes two records and then stops, as a failed # activity would. The second writes different inputs under the same # logical producer, which is what the reader has to report. - first = await streams.producer( - client, workflow_id=uid, stream=INPUTS, producer_id="model", attempt=1 - ) + first = stream.producer(topic=INPUTS, producer_id="model", attempt=1) await first.append({"id": "r1", "value": 1}, {"id": "r2", "value": 2}) await asyncio.sleep(0.5) - second = await streams.producer( - client, workflow_id=uid, stream=INPUTS, producer_id="model", attempt=2 - ) + second = stream.producer(topic=INPUTS, producer_id="model", attempt=2) await second.append({"id": "r3", "value": 3}, {"id": "r4", "value": 4}) await second.finish() @@ -146,7 +141,7 @@ async def main() -> int: history = await handle.fetch_history() record["history_events"] = len(history.events) (out / "history.json").write_text(history.to_json()) - await provider_setup.close() + await provider_setup.close(provider) (out / "results.json").write_text(json.dumps(record, indent=2) + "\n") print(json.dumps(record, indent=2)) return 0 if record["outcome"] == "completed" else 1 From e5f21dfc1b82fc5cfb5d2d772f36616c944cf198 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 02:00:38 -0700 Subject: [PATCH 29/51] Let a conformance case start the workflow that owns a stream. A store that lives inside a running workflow has no stream until that workflow runs, so a provider's setup can hand the cases a host that starts it before they open a handle. --- tests/streams/test_streams_conformance.py | 65 ++++++++++++++--------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 50a59bb0f..451fe4391 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -2,11 +2,14 @@ Written against the public surface, parametrised over the providers this tree can stand up. The memory provider always runs, with no server and no -store. A storage provider adds itself to ``SETUPS`` behind its own -``STREAMS_LIVE`` gate: its setup hands back a provider instance, the client -the cases should use, and says which capabilities it lacks, so the cases -marked ``reports_positions`` are skipped with a reason on a provider whose -``append()`` learns positions at read time. +store. A storage provider adds itself to ``SETUPS``, behind its own +``STREAMS_LIVE`` gate when it needs a store the test environment does not +start: its setup receives the environment's client and hands back a provider +instance, the client the cases should use, a ``host`` that starts the +workflow owning a stream when the store lives inside a running workflow, and +which capabilities it lacks, so the cases marked ``reports_positions`` are +skipped with a reason on a provider whose ``append()`` learns positions at +read time. What this file pins down is the contract: the record on the wire, producer identity, retry deduplication, positions, supersession, topic addressing, @@ -19,7 +22,7 @@ import asyncio import uuid -from collections.abc import AsyncIterator, Callable +from collections.abc import AsyncIterator, Awaitable, Callable from dataclasses import dataclass from typing import Any, cast @@ -53,8 +56,14 @@ class ProviderCase: client: Client | None = None reports_positions: bool = True """``append()`` returns where the records landed.""" - - def handle(self, workflow_id: str, *, run_id: str | None = None) -> StreamHandle: + host: Callable[[str], Awaitable[None]] | None = None + """Starts the workflow that owns ``workflow_id``'s stream, when a store needs one.""" + + async def open( + self, workflow_id: str, *, run_id: str | None = None + ) -> StreamHandle: + if self.host is not None: + await self.host(workflow_id) # The memory provider takes no client; every storage provider's setup # supplies one, so the cast only ever lies for the provider that # does not read it. @@ -63,13 +72,15 @@ def handle(self, workflow_id: str, *, run_id: str | None = None) -> StreamHandle ) -async def _memory_case() -> AsyncIterator[ProviderCase]: +async def _memory_case(_client: Client) -> AsyncIterator[ProviderCase]: provider = MemoryStreams() yield ProviderCase("memory", provider) provider.reset() -SETUPS: dict[str, Callable[[], AsyncIterator[ProviderCase]]] = {"memory": _memory_case} +SETUPS: dict[str, Callable[[Client], AsyncIterator[ProviderCase]]] = { + "memory": _memory_case +} _CAPABILITIES = { "reports_positions": lambda case: case.reports_positions, @@ -77,8 +88,10 @@ async def _memory_case() -> AsyncIterator[ProviderCase]: @pytest.fixture(params=sorted(SETUPS)) -async def case(request: pytest.FixtureRequest) -> AsyncIterator[ProviderCase]: - async for provider_case in SETUPS[request.param](): +async def case( + request: pytest.FixtureRequest, client: Client +) -> AsyncIterator[ProviderCase]: + async for provider_case in SETUPS[request.param](client): for marker, supported in _CAPABILITIES.items(): if request.node.get_closest_marker(marker) and not supported(provider_case): pytest.skip(f"the {provider_case.name} provider does not {marker}") @@ -177,7 +190,7 @@ def test_cursors_name_their_provider(): async def test_append_read_roundtrip(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) producer = stream.producer(topic="out", producer_id="model", attempt=1) assert (producer.producer_id, producer.attempt) == ("model", 1) await producer.append({"id": "r1"}, {"id": "r2"}) @@ -198,7 +211,7 @@ async def test_append_read_roundtrip(case: ProviderCase): async def test_raw_values_pass_through_untouched(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) payload = Payload(metadata={"encoding": b"binary/plain"}, data=b"\x00\x01raw") producer = stream.producer(topic="out", producer_id="model", attempt=1) await producer.append(RawValue(payload)) @@ -211,7 +224,7 @@ async def test_raw_values_pass_through_untouched(case: ProviderCase): @pytest.mark.reports_positions async def test_retried_append_returns_the_original_position(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) first = stream.producer(topic="out", producer_id="model", attempt=1) landed = await first.append({"id": "r1"}) assert landed is not None @@ -232,7 +245,7 @@ async def test_retried_append_returns_the_original_position(case: ProviderCase): async def test_retried_append_is_stored_once(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) first = stream.producer(topic="out", producer_id="model", attempt=1) await first.append({"id": "r1"}) retry = stream.producer(topic="out", producer_id="model", attempt=1) @@ -245,7 +258,7 @@ async def test_retried_append_is_stored_once(case: ProviderCase): async def test_new_attempt_supersedes_the_old_one(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) first = stream.producer(topic="out", producer_id="model", attempt=1) await first.append({"text": "The capital of"}) second = stream.producer(topic="out", producer_id="model", attempt=2) @@ -263,7 +276,7 @@ async def test_a_superseded_record_resumes_to_the_triggering_record( case: ProviderCase, ): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) first = stream.producer(topic="out", producer_id="model", attempt=1) await first.append({"n": 1}) second = stream.producer(topic="out", producer_id="model", attempt=2) @@ -287,7 +300,7 @@ async def test_topics_are_addressed_by_name(case: ProviderCase): # Two producers on two topics of the same workflow's stream: each read # names its topic and sees only that topic's records. workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) on_a = stream.producer(topic="a", producer_id="tool-a", attempt=1) await on_a.append({"n": 1}) on_b = stream.producer(topic="b", producer_id="tool-b", attempt=1) @@ -301,7 +314,7 @@ async def test_topics_are_addressed_by_name(case: ProviderCase): async def test_cursor_resumes_where_it_points(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) producer = stream.producer(topic="out", producer_id="model", attempt=1) await producer.append({"n": 1}, {"n": 2}, {"n": 3}) @@ -317,7 +330,7 @@ async def test_cursor_resumes_where_it_points(case: ProviderCase): @pytest.mark.reports_positions async def test_append_cursor_names_the_last_record_of_the_batch(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) producer = stream.producer(topic="out", producer_id="model", attempt=1) appended = await producer.append({"n": 1}, {"n": 2}, {"n": 3}) assert appended is not None @@ -333,7 +346,7 @@ async def test_append_cursor_names_the_last_record_of_the_batch(case: ProviderCa async def test_latest_positions_a_reader_at_the_end(case: ProviderCase): workflow_id = new_workflow_id() - stream = case.handle(workflow_id) + stream = await case.open(workflow_id) producer = stream.producer(topic="out", producer_id="model", attempt=1) assert await stream.latest(topic="out") == BEGINNING @@ -350,8 +363,8 @@ async def test_latest_positions_a_reader_at_the_end(case: ProviderCase): async def test_topic_addresses_with_colons_do_not_share_a_store(case: ProviderCase): # ("wf:x", "y") and ("wf", "x:y") differ only in where the colon sits. base = new_workflow_id() - left = case.handle(f"{base}:x") - right = case.handle(base) + left = await case.open(f"{base}:x") + right = await case.open(base) await left.producer(topic="y", producer_id="l", attempt=1).append({"side": "left"}) await right.producer(topic="x:y", producer_id="r", attempt=1).append( {"side": "right"} @@ -366,7 +379,7 @@ async def test_topic_addresses_with_colons_do_not_share_a_store(case: ProviderCa async def test_a_foreign_cursor_is_refused_at_the_call(case: ProviderCase): - stream = case.handle(new_workflow_id()) + stream = await case.open(new_workflow_id()) # Refused by read() itself, not by the first iteration of its generator, # so the caller's except clause is where the mistake surfaces. with pytest.raises(StreamCursorError): @@ -374,7 +387,7 @@ async def test_a_foreign_cursor_is_refused_at_the_call(case: ProviderCase): async def test_argument_mistakes_are_value_errors(case: ProviderCase): - stream = case.handle(new_workflow_id()) + stream = await case.open(new_workflow_id()) with pytest.raises(ValueError): stream.read(topic="") with pytest.raises(ValueError): From 2799b580273589b0d8ed4ddcefcb8c99a55e5bfd Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 03:45:36 -0700 Subject: [PATCH 30/51] Kept the stream finish hook off evicted runs and collected coroutines. Neither is the workflow ending. An evicted run's state is not to be touched, and at collection time the runtime on the thread belongs to whichever workflow is running, so the hook acted on that one. --- temporalio/worker/_workflow.py | 29 +++++-- tests/streams/test_stream_hooks.py | 133 +++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 tests/streams/test_stream_hooks.py diff --git a/temporalio/worker/_workflow.py b/temporalio/worker/_workflow.py index b5e4cb411..9b94de95a 100644 --- a/temporalio/worker/_workflow.py +++ b/temporalio/worker/_workflow.py @@ -63,17 +63,36 @@ class _StreamHooksInterceptor(WorkflowInboundInterceptor): Installed by the worker when it has a stream provider, so no workflow code has to call anything before it runs or before it returns. The finish - hook runs however the function ends, continue-as-new included, because + hook runs when the function returns, raises or continues as new, because a provider that parked a reader against the run has to let go either way. + It does not run when the run is being evicted from the cache or when the + abandoned coroutine is collected: neither is the workflow ending, the + instance's state is not to be touched during eviction, and at collection + time the runtime on the thread belongs to whichever workflow happens to + be running, so the hook would act on that one. """ async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any: - provider = temporalio.workflow._Runtime.current().workflow_streams().provider + runtime = temporalio.workflow._Runtime.current() + provider = runtime.workflow_streams().provider provider.on_workflow_start() try: - return await self.next.execute_workflow(input) - finally: - await provider.on_workflow_finish() + result = await self.next.execute_workflow(input) + except GeneratorExit: + raise + except BaseException: + if not _evicting(runtime): + await provider.on_workflow_finish() + raise + await provider.on_workflow_finish() + return result + + +def _evicting(runtime: temporalio.workflow._Runtime) -> bool: + # Eviction cancels the primary task the same way a workflow cancellation + # does; the flag the instance sets before cancelling is what tells them + # apart, and only the cancellation is a run ending. + return bool(getattr(runtime, "_deleting", False)) # Value was chosen abitrarily as a small number that allows some concurrency and prevents diff --git a/tests/streams/test_stream_hooks.py b/tests/streams/test_stream_hooks.py new file mode 100644 index 000000000..be7b6e9d4 --- /dev/null +++ b/tests/streams/test_stream_hooks.py @@ -0,0 +1,133 @@ +"""The lifecycle interceptor's rules about when the finish hook runs. + +Driven directly, with a stand-in runtime on the loop, because the two cases +that matter here are the ones a workflow test cannot stage on purpose: a +coroutine collected after its worker went away, and a run evicted from the +cache. Both used to reach the finish hook, and at collection time the hook +acted on whichever workflow was running on the thread. +""" + +from __future__ import annotations + +import asyncio +from typing import Any + +import pytest + +from temporalio import workflow +from temporalio.worker._interceptor import ( + ExecuteWorkflowInput, + WorkflowInboundInterceptor, +) +from temporalio.worker._workflow import _StreamHooksInterceptor + + +class _Provider: + def __init__(self) -> None: + self.calls: list[str] = [] + + def on_workflow_start(self) -> None: + self.calls.append("start") + + async def on_workflow_finish(self) -> None: + self.calls.append("finish") + + +class _Streams: + def __init__(self, provider: _Provider) -> None: + self.provider = provider + + +class _FakeRuntime: + """Only what the interceptor reads: the stream state and the eviction flag.""" + + def __init__(self, provider: _Provider, *, deleting: bool = False) -> None: + self._streams = _Streams(provider) + self._deleting = deleting + + def workflow_streams(self) -> _Streams: + return self._streams + + +class _Body(WorkflowInboundInterceptor): + """The workflow function's stand-in: returns, raises or parks forever.""" + + def __init__(self, outcome: Any) -> None: # type: ignore[reportMissingSuperCall] + self._outcome = outcome + + async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any: + del input + if self._outcome is _PARK: + await asyncio.Event().wait() + if isinstance(self._outcome, BaseException): + raise self._outcome + return self._outcome + + +_PARK = object() +_INPUT = ExecuteWorkflowInput(type=object, run_fn=lambda: None, args=(), headers={}) + + +@pytest.fixture +async def provider() -> Any: + fake = _Provider() + loop = asyncio.get_running_loop() + workflow._Runtime.set_on_loop(loop, _FakeRuntime(fake)) # type: ignore[arg-type] + yield fake + workflow._Runtime.set_on_loop(loop, None) + + +def _evicting(fake: _Provider) -> None: + loop = asyncio.get_running_loop() + workflow._Runtime.set_on_loop(loop, _FakeRuntime(fake, deleting=True)) # type: ignore[arg-type] + + +async def test_the_finish_hook_runs_on_return(provider: _Provider): + assert ( + await _StreamHooksInterceptor(_Body("done")).execute_workflow(_INPUT) == "done" + ) + assert provider.calls == ["start", "finish"] + + +async def test_the_finish_hook_runs_when_the_function_raises(provider: _Provider): + with pytest.raises(RuntimeError, match="boom"): + await _StreamHooksInterceptor(_Body(RuntimeError("boom"))).execute_workflow( + _INPUT + ) + assert provider.calls == ["start", "finish"] + + +async def test_the_finish_hook_runs_on_continue_as_new(provider: _Provider): + error = workflow.ContinueAsNewError.__new__(workflow.ContinueAsNewError) + with pytest.raises(workflow.ContinueAsNewError): + await _StreamHooksInterceptor(_Body(error)).execute_workflow(_INPUT) + assert provider.calls == ["start", "finish"] + + +async def test_the_finish_hook_runs_on_a_workflow_cancellation(provider: _Provider): + # A cancelled primary task is the run ending, so the provider lets go. + with pytest.raises(asyncio.CancelledError): + await _StreamHooksInterceptor(_Body(asyncio.CancelledError())).execute_workflow( + _INPUT + ) + assert provider.calls == ["start", "finish"] + + +async def test_the_finish_hook_does_not_run_when_the_coroutine_is_collected( + provider: _Provider, +): + coroutine = _StreamHooksInterceptor(_Body(_PARK)).execute_workflow(_INPUT) + # Run up to the park, the way a worker that shut down without evicting + # leaves the primary task, then close it as garbage collection would. + coroutine.send(None) + coroutine.close() + assert provider.calls == ["start"] + + +async def test_the_finish_hook_does_not_run_during_eviction(provider: _Provider): + _evicting(provider) + with pytest.raises(asyncio.CancelledError): + await _StreamHooksInterceptor(_Body(asyncio.CancelledError())).execute_workflow( + _INPUT + ) + assert provider.calls == ["start"] From 297d3c59532178c4952638030acc24c2e294e4dc Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 03:46:44 -0700 Subject: [PATCH 31/51] Typed the hook test's workflow input as awaitable. --- tests/streams/test_stream_hooks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/streams/test_stream_hooks.py b/tests/streams/test_stream_hooks.py index be7b6e9d4..9f98f75f6 100644 --- a/tests/streams/test_stream_hooks.py +++ b/tests/streams/test_stream_hooks.py @@ -65,7 +65,13 @@ async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any: _PARK = object() -_INPUT = ExecuteWorkflowInput(type=object, run_fn=lambda: None, args=(), headers={}) + + +async def _unused_run_fn() -> None: + pass + + +_INPUT = ExecuteWorkflowInput(type=object, run_fn=_unused_run_fn, args=(), headers={}) @pytest.fixture From 099c52c2834605bf7dbbb83d92b4c1a3c560f3a5 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 10:24:46 -0700 Subject: [PATCH 32/51] Added activity.stream_handle and Client.get_stream_handle. A provider is registered once, as a plugin on the client, and every context asks for its stream the same way: the worker inherits the client's provider, an activity's handle is its own workflow pinned to its run, and a client's handle mirrors get_workflow_handle. --- temporalio/activity.py | 48 +++++++++ temporalio/client/_client.py | 41 +++++++ temporalio/streams/__init__.py | 23 ++-- temporalio/streams/providers/__init__.py | 45 +++++--- temporalio/worker/_activity.py | 6 ++ temporalio/worker/_worker.py | 8 +- tests/streams/test_stream_accessors.py | 125 ++++++++++++++++++++++ tests/streams/test_streams_conformance.py | 14 ++- 8 files changed, 283 insertions(+), 27 deletions(-) create mode 100644 tests/streams/test_stream_accessors.py diff --git a/temporalio/activity.py b/temporalio/activity.py index 82678d8a1..33f3a90eb 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -29,6 +29,7 @@ import temporalio.bridge.proto.activity_task import temporalio.common import temporalio.converter +import temporalio.streams from temporalio.converter._payload_converter import ( _TemporalTransferTypePayloadConverter, ) @@ -209,6 +210,7 @@ class _Context: runtime_metric_meter: temporalio.common.MetricMeter | None client: Client | None cancellation_details: _ActivityCancellationDetailsHolder + stream_provider: temporalio.streams.StreamProvider | None = None _logger_details: Mapping[str, Any] | None = None _payload_converter: temporalio.converter.PayloadConverter | None = None _metric_meter: temporalio.common.MetricMeter | None = None @@ -298,6 +300,52 @@ def client() -> Client: return client +def stream_handle( + workflow_id: str | None = None, *, run_id: str | None = None +) -> temporalio.streams.StreamHandle: + """Return a stream handle from the provider the worker was given. + + With no arguments the handle is on this activity's own workflow, pinned to + the run the activity belongs to, so a producer opened from it writes onto + that run's stream and a read follows that run. Name a ``workflow_id`` to + address another workflow; ``run_id`` then pins the handle to one run and + its absence follows the execution chain. See :py:mod:`temporalio.streams`. + + Like :py:func:`client`, this is only available in ``async def`` + activities. + + Returns: + :py:class:`temporalio.streams.StreamHandle` for use in the current + activity. + + Raises: + temporalio.streams.StreamUnsupportedError: The worker has no stream + provider. Register one with ``Client.connect(plugins=[provider])`` + or ``Worker(plugins=[provider])``. + RuntimeError: When the client is not available, or when the activity + has no workflow and no ``workflow_id`` was given. + ValueError: ``run_id`` was given without ``workflow_id``. + """ + context = _Context.current() + provider = context.stream_provider + if provider is None: + raise temporalio.streams.StreamUnsupportedError( + "no stream provider is configured on this worker; register one with " + "Client.connect(plugins=[provider]) or Worker(plugins=[provider])" + ) + if workflow_id is None: + if run_id is not None: + raise ValueError("run_id needs a workflow_id") + info = context.info() + if info.workflow_id is None: + raise RuntimeError( + "this activity belongs to no workflow, so name the workflow_id to " + "address" + ) + workflow_id, run_id = info.workflow_id, info.workflow_run_id + return provider.get_stream_handle(client(), workflow_id, run_id=run_id) + + def in_activity() -> bool: """Whether the current code is inside an activity. diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index b5db0c4b7..dc4ef68c4 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -27,6 +27,7 @@ import temporalio.converter import temporalio.runtime import temporalio.service +import temporalio.streams import temporalio.workflow from temporalio.service import ( ConnectConfig, @@ -155,6 +156,7 @@ async def connect( grpc_compression: GrpcCompression = GrpcCompression.GZIP, payload_limits: PayloadLimitsConfig = PayloadLimitsConfig(), header_codec_behavior: HeaderCodecBehavior = HeaderCodecBehavior.NO_CODEC, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> Self: """Connect to a Temporal server. @@ -220,6 +222,11 @@ async def connect( payload_limits: Warning thresholds for outbound payload/memo sizes. Over-threshold fields are logged but still sent. Set a threshold to 0 to disable it. header_codec_behavior: Encoding behavior for headers sent by the client. + stream_provider: Experimental. The stream provider + :py:meth:`get_stream_handle` opens handles from, see + :py:mod:`temporalio.streams`. A provider that is also a + :py:class:`Plugin` sets this itself when passed in ``plugins``, + and workers built from this client inherit it. """ connect_config = temporalio.service.ConnectConfig( target_host=target_host, @@ -256,6 +263,7 @@ def make_lambda( default_workflow_query_reject_condition=default_workflow_query_reject_condition, header_codec_behavior=header_codec_behavior, plugins=plugins, + stream_provider=stream_provider, ) def __init__( @@ -269,6 +277,7 @@ def __init__( default_workflow_query_reject_condition: None | (temporalio.common.QueryRejectCondition) = None, header_codec_behavior: HeaderCodecBehavior = HeaderCodecBehavior.NO_CODEC, + stream_provider: temporalio.streams.StreamProvider | None = None, ): """Create a Temporal client from a service client. @@ -283,6 +292,7 @@ def __init__( interceptors=interceptors, default_workflow_query_reject_condition=default_workflow_query_reject_condition, header_codec_behavior=header_codec_behavior, + stream_provider=stream_provider, ) self._initial_config = config.copy() @@ -886,6 +896,36 @@ def get_workflow_handle( result_type=result_type, ) + def get_stream_handle( + self, workflow_id: str, *, run_id: str | None = None + ) -> temporalio.streams.StreamHandle: + """Get a handle on a workflow's stream from the provider registered on this client. + + Mirrors :py:meth:`get_workflow_handle`: without ``run_id`` the handle + follows the workflow's execution chain across continue-as-new, with + one it is pinned to that run. The provider is the one registered with + ``plugins=[provider]`` at :py:meth:`connect`, or passed as + ``stream_provider``. See :py:mod:`temporalio.streams`. + + Args: + workflow_id: Workflow ID whose stream to get a handle to. + run_id: Run ID to pin the handle to. + + Returns: + The stream handle. + + Raises: + temporalio.streams.StreamUnsupportedError: No stream provider is + registered on this client. + """ + provider = self._config.get("stream_provider") + if provider is None: + raise temporalio.streams.StreamUnsupportedError( + "no stream provider is registered on this client; connect with " + "plugins=[provider]" + ) + return provider.get_stream_handle(self, workflow_id, run_id=run_id) + def get_workflow_handle_for( self, workflow: ( @@ -3032,3 +3072,4 @@ class ClientConfig(TypedDict, total=False): temporalio.common.QueryRejectCondition | None ] header_codec_behavior: Required[HeaderCodecBehavior] + stream_provider: temporalio.streams.StreamProvider | None diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index 30d1f9a98..c185c35ce 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -30,15 +30,20 @@ workflow and by outside consumers; which of those happen is the application's business. -Workflow-side entry points live in :mod:`temporalio.workflow`: -:func:`temporalio.workflow.stream_reader` and -:func:`temporalio.workflow.stream_writer`. Outside a workflow, a handle comes -from a provider instance: ``provider.get_stream_handle(client, workflow_id)``. -A provider is an object; when it serves workers it is also a -:class:`temporalio.worker.Plugin`, passed as ``Worker(plugins=[provider])`` -and ``Replayer(plugins=[provider])``. This module keeps the shared types, the -errors and the protocols a provider implements; nothing here that workflow -code imports does I/O. +A provider is an object, registered once as a plugin: +``Client.connect(plugins=[provider])``; workers built from that client inherit +it, and ``Worker(plugins=[provider])`` or ``Replayer(plugins=[provider])`` +registers it on a worker alone. Each context then asks for its stream the +same way. Workflow code uses :func:`temporalio.workflow.stream_reader` and +:func:`temporalio.workflow.stream_writer`. An activity uses +:func:`temporalio.activity.stream_handle`, which is its own workflow pinned +to its run unless told otherwise. Any process holding a client uses +:meth:`temporalio.client.Client.get_stream_handle`, which mirrors +``get_workflow_handle``. The explicit form, +``provider.get_stream_handle(client, workflow_id)``, stays for a process that +talks to two stores. This module keeps the shared types, the errors and the +protocols a provider implements; nothing here that workflow code imports does +I/O. What the contract does not promise: that a :attr:`RecordKind.FINISH` record means the writing activity succeeded, that a superseded attempt's records can diff --git a/temporalio/streams/providers/__init__.py b/temporalio/streams/providers/__init__.py index 911620e6c..7aaa5a9b1 100644 --- a/temporalio/streams/providers/__init__.py +++ b/temporalio/streams/providers/__init__.py @@ -1,11 +1,14 @@ """Stream providers, one module each. -A provider that serves workers is a :class:`temporalio.worker.Plugin`. +A provider that serves workers is a :class:`temporalio.worker.Plugin`, and +one registered on a client is a :class:`temporalio.client.Plugin` too. :class:`ProviderPlugin` is the plugin half the providers in this tree share: -it hands the provider to the worker and the replayer as their -``stream_provider`` and leaves their execution alone. A provider that holds -connections closes them through its own ``close()``, not with the worker, -because the same provider serves handles outside any worker. +it hands the provider to the client, the worker and the replayer as their +``stream_provider`` and leaves their execution alone, so +``Client.connect(plugins=[provider])`` registers it once and every worker +built from that client inherits it. A provider that holds connections closes +them through its own ``close()``, not with the worker, because the same +provider serves handles outside any worker. """ from __future__ import annotations @@ -13,8 +16,10 @@ from collections.abc import AsyncIterator, Awaitable, Callable from contextlib import AbstractAsyncContextManager +import temporalio.client import temporalio.worker -from temporalio.client import WorkflowHistory +from temporalio.client import ClientConfig, WorkflowHistory +from temporalio.service import ConnectConfig, ServiceClient from temporalio.streams._provider import StreamProvider from temporalio.worker import ( Replayer, @@ -27,16 +32,32 @@ __all__ = ["ProviderPlugin"] -class ProviderPlugin(StreamProvider, temporalio.worker.Plugin): - """The worker plugin every provider in this tree is built on. +class ProviderPlugin( + StreamProvider, temporalio.client.Plugin, temporalio.worker.Plugin +): + """The plugin every provider in this tree is built on. Subclasses implement :class:`temporalio.streams.StreamProvider`; this - class supplies the four plugin hooks, so ``Worker(plugins=[provider])`` - and ``Replayer(plugins=[provider])`` reach the provider through their - ``stream_provider`` option and the worker installs the interceptor that - calls the workflow half's lifecycle hooks. + class supplies the plugin hooks, so ``Client.connect(plugins=[provider])``, + ``Worker(plugins=[provider])`` and ``Replayer(plugins=[provider])`` reach + the provider through their ``stream_provider`` option. A worker built from + a client that carries the plugin inherits it, and the worker installs the + interceptor that calls the workflow half's lifecycle hooks. """ + def configure_client(self, config: ClientConfig) -> ClientConfig: + """Set this provider as the client's ``stream_provider``.""" + config["stream_provider"] = self + return config + + async def connect_service_client( + self, + config: ConnectConfig, + next: Callable[[ConnectConfig], Awaitable[ServiceClient]], + ) -> ServiceClient: + """Connect unchanged.""" + return await next(config) + def configure_worker(self, config: WorkerConfig) -> WorkerConfig: """Set this provider as the worker's ``stream_provider``.""" config["stream_provider"] = self diff --git a/temporalio/worker/_activity.py b/temporalio/worker/_activity.py index ded3047fc..10bf45bd2 100644 --- a/temporalio/worker/_activity.py +++ b/temporalio/worker/_activity.py @@ -33,6 +33,7 @@ import temporalio.common import temporalio.converter import temporalio.exceptions +import temporalio.streams from temporalio.converter import ( StorageDriverActivityInfo, StorageDriverStoreContext, @@ -63,9 +64,11 @@ def __init__( metric_meter: temporalio.common.MetricMeter, client: temporalio.client.Client, encode_headers: bool, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> None: self._bridge_worker = bridge_worker self._task_queue = task_queue + self._stream_provider = stream_provider self._activity_executor = activity_executor self._shared_state_manager = shared_state_manager self._running_activities: dict[bytes, _RunningActivity] = {} @@ -666,6 +669,9 @@ async def _execute_activity( runtime_metric_meter=None if sync_non_threaded else self._metric_meter, client=self._client if not running_activity.sync else None, cancellation_details=running_activity.cancellation_details, + stream_provider=( + self._stream_provider if not running_activity.sync else None + ), ) ) temporalio.activity.logger.debug("Starting activity") diff --git a/temporalio/worker/_worker.py b/temporalio/worker/_worker.py index 3adbd7231..fade69c4d 100644 --- a/temporalio/worker/_worker.py +++ b/temporalio/worker/_worker.py @@ -468,6 +468,11 @@ def _init_from_config(self, client: temporalio.client.Client, config: WorkerConf # Prepend applicable client interceptors to the given ones client_config = config["client"].config(active_config=True) # type: ignore[reportTypedDictNotRequiredAccess] + # A provider registered on the client serves its workers too, so one + # registration covers every context that asks for a stream. + stream_provider = config.get("stream_provider") or client_config.get( + "stream_provider" + ) interceptors_from_client = cast( list[Interceptor], [i for i in client_config["interceptors"] if isinstance(i, Interceptor)], @@ -505,6 +510,7 @@ def _init_from_config(self, client: temporalio.client.Client, config: WorkerConf interceptors=interceptors, metric_meter=self._runtime.metric_meter, client=client, + stream_provider=stream_provider, encode_headers=( client_config["header_codec_behavior"] == HeaderCodecBehavior.CODEC ), @@ -572,7 +578,7 @@ def check_activity(activity: str): encode_headers=client_config["header_codec_behavior"] != HeaderCodecBehavior.NO_CODEC, max_workflow_task_external_storage_concurrency=max_workflow_task_external_storage_concurrency, - stream_provider=config.get("stream_provider"), + stream_provider=stream_provider, ) tuner = config.get("tuner") diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py new file mode 100644 index 000000000..73436dea2 --- /dev/null +++ b/tests/streams/test_stream_accessors.py @@ -0,0 +1,125 @@ +"""The accessors each context asks for its stream, with one registration. + +The provider is registered on the client alone. A worker built from that +client inherits it, an activity on that worker reaches its own workflow's +stream through ``activity.stream_handle()``, and any code holding the client +reaches a stream through ``client.get_stream_handle()``. Without a +registration, both say so with the same error. +""" + +from __future__ import annotations + +import asyncio +import uuid +from datetime import timedelta +from typing import Any + +import pytest + +from temporalio import activity, workflow +from temporalio.client import Client +from temporalio.streams import RecordKind, StreamUnsupportedError +from temporalio.streams.providers.memory import MemoryStreams +from temporalio.testing import ActivityEnvironment, WorkflowEnvironment +from tests.helpers import new_worker + +INPUTS = "inputs" +DECISIONS = "decisions" + + +@pytest.fixture +def provider(env: WorkflowEnvironment): # pyright: ignore[reportUnusedFunction] + if env.supports_time_skipping: + pytest.skip( + "the memory provider polls on a timer, which time skipping turns into a spin" + ) + streams = MemoryStreams() + yield streams + streams.reset() + + +def _with_provider(client: Client, provider: MemoryStreams) -> Client: + # The same connection, with the provider registered the way an + # application registers it: once, on the client. + config = client.config() + config["plugins"] = [provider] + return Client(**config) + + +@activity.defn +async def emit(count: int) -> str: + # No workflow id and no run id: the handle is this activity's own + # workflow, pinned to its run, and the producer's identity is the + # activity's. + model = activity.stream_handle().producer(topic=INPUTS) + for n in range(count): + await model.append({"n": n}) + await model.finish() + return activity.info().activity_id + + +@workflow.defn +class Echo: + """Runs the emitting activity and echoes what arrives on ``inputs``.""" + + @workflow.run + async def run(self, count: int) -> list[Any]: + inputs = workflow.stream_reader(INPUTS, result_type=dict) + decisions = workflow.stream_writer(DECISIONS) + emitting = workflow.start_activity( + emit, count, start_to_close_timeout=timedelta(seconds=30) + ) + seen: list[Any] = [] + async for record in inputs: + if record.kind is RecordKind.FINISH: + seen.append(("finish", record.producer_id)) + break + assert record.value is not None + seen.append(record.value["n"]) + decisions.publish({"echo": record.value["n"]}) + decisions.finish() + producer_id = await emitting + return [*seen, ("activity", producer_id)] + + +async def test_one_registration_on_the_client_serves_every_context( + client: Client, provider: MemoryStreams +): + registered = _with_provider(client, provider) + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + # No plugins on the worker: it inherits the client's provider. + async with new_worker(registered, Echo, activities=[emit]) as worker: + handle = await registered.start_workflow( + Echo.run, 2, id=workflow_id, task_queue=worker.task_queue + ) + result = await handle.result() + # The activity wrote as itself onto its own workflow's topic. + assert result[:2] == [0, 1] + assert result[2] == ["finish", result[3][1]] + + stream = registered.get_stream_handle(workflow_id) + + async def read_everything() -> list[Any]: + return [ + (r.kind, r.value) + async for r in stream.read(topic=DECISIONS, result_type=dict) + ] + + assert await asyncio.wait_for(read_everything(), 30) == [ + (RecordKind.DATA, {"echo": 0}), + (RecordKind.DATA, {"echo": 1}), + (RecordKind.FINISH, None), + ] + + +async def test_get_stream_handle_needs_a_registered_provider(client: Client): + with pytest.raises(StreamUnsupportedError, match="plugins="): + client.get_stream_handle("wf") + + +async def test_stream_handle_needs_a_provider_on_the_worker(): + async def ask() -> None: + activity.stream_handle() + + with pytest.raises(StreamUnsupportedError, match="plugins="): + await ActivityEnvironment().run(ask) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 451fe4391..020250973 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -24,7 +24,7 @@ import uuid from collections.abc import AsyncIterator, Awaitable, Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any import pytest @@ -64,11 +64,15 @@ async def open( ) -> StreamHandle: if self.host is not None: await self.host(workflow_id) - # The memory provider takes no client; every storage provider's setup - # supplies one, so the cast only ever lies for the provider that - # does not read it. + if self.client is not None: + # A storage provider's setup registers the provider on the client, + # so the cases go through the accessor an application uses. + return self.client.get_stream_handle(workflow_id, run_id=run_id) + # Only the memory provider gets here, and it takes no client. return self.provider.get_stream_handle( - cast(Client, self.client), workflow_id, run_id=run_id + None, # type: ignore[arg-type] + workflow_id, + run_id=run_id, ) From 22e38645fda99b06f752f9a1c42b3cc8288b7547 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 10:24:46 -0700 Subject: [PATCH 33/51] Registered the demo's provider on the client and reported from the activity. --- CHANGELOG.md | 12 +++++++----- streams_demo/agent_loop.py | 22 ++++++++++++++++------ streams_demo/run_demo.py | 37 +++++++++++++++++++++++++++++-------- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06eb5da58..a90a9114f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,11 +22,13 @@ to include examples, links to docs, or any other relevant information. - Added the `temporalio.contrib.gcp.cloud_run.id` module with the `CloudRunIdPlugin` client plugin to set the worker identity on Cloud Run. - **Experimental**: `temporalio.streams` defines one stream interface a workflow - can read, decide on, and write. `workflow.stream_reader()` and - `workflow.stream_writer()` are the workflow-side entry points, a provider is a - worker plugin passed as `Worker(plugins=[provider])`, and - `provider.get_stream_handle()` reads and appends from outside. The record on - the wire is `temporal.api.stream.v1.StreamRecord` on every provider. + can read, decide on, and write. A provider is registered once as a plugin, + `Client.connect(plugins=[provider])`, and workers built from that client + inherit it; each context then asks for its stream the same way: + `workflow.stream_reader()` and `workflow.stream_writer()` in workflow code, + `activity.stream_handle()` in an activity, and `client.get_stream_handle()` + anywhere a client is held. The record on the wire is + `temporal.api.stream.v1.StreamRecord` on every provider. `temporalio.streams.providers.memory.MemoryStreams` is the in-memory reference provider the conformance tests run against. diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index 330cb54c2..a76b35ced 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -1,12 +1,14 @@ """One agent loop, written once, run on every stream provider. Reads input, decides on it, publishes the decision, and runs an ordinary -Activity in the same workflow task. Also handles the two control records the -contract defines, so a retried producer and a finished topic are exercised -rather than described. +Activity in the same workflow task; the Activity reports on its own +workflow's stream in turn. Also handles the two control records the contract +defines, so a retried producer and a finished topic are exercised rather than +described. This file is byte-identical in the server-side tree and the client-side tree. -Only the worker that runs it differs, and only in which provider it is given. +Nothing in it names a provider: the workflow asks its runtime, the Activity +asks its context, and the process that runs them registered the provider once. """ from __future__ import annotations @@ -19,12 +21,20 @@ DECISIONS = "decisions" INPUTS = "inputs" +RECEIPTS = "receipts" @activity.defn(name="RecordDecision") async def record_decision(decision: dict[str, Any]) -> str: - """An ordinary command in the same task as the publish.""" - return f"recorded:{decision['source']}:{decision['branch']}" + """An ordinary command in the same task as the publish. + + Appends its receipt onto its own workflow's stream too, under the + Activity's own identity, so a reader outside sees the decision and the + record of it side by side. + """ + receipt = f"recorded:{decision['source']}:{decision['branch']}" + await activity.stream_handle().producer(topic=RECEIPTS).append({"receipt": receipt}) + return receipt def decide(token: dict[str, Any]) -> dict[str, Any]: diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index 1238fad11..0b06e9395 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -7,10 +7,13 @@ the run as it allows is rebuilt rather than remembered; - a producer whose second attempt supersedes its first, which the reader has to report and the workflow has to act on; -- an outside reader following what the workflow published. +- an outside reader following what the workflow published, and the receipts + the Activity appended on the workflow's stream from inside its own context. -Byte-identical in every tree. ``provider_setup`` is what differs, and it is -the only import here that names a provider. +The provider is registered once, on the client; the worker inherits it and +every context asks for its stream without naming it. Byte-identical in every +tree. ``provider_setup`` is what differs, and it is the only import here that +names a provider. """ from __future__ import annotations @@ -25,12 +28,18 @@ from temporalio.api.enums.v1 import EventType from temporalio.client import Client -from temporalio.streams import StreamHandle +from temporalio.streams import RecordKind, StreamHandle from temporalio.worker import Worker sys.path.insert(0, str(Path(__file__).resolve().parent)) import provider_setup # noqa: E402 -from agent_loop import DECISIONS, INPUTS, AgentLoop, record_decision # noqa: E402 +from agent_loop import ( # noqa: E402 + DECISIONS, + INPUTS, + RECEIPTS, + AgentLoop, + record_decision, +) DECISION_LIMIT = 8 EXPECTED_OUTPUT = 6 @@ -51,7 +60,7 @@ async def main() -> int: out = Path(__file__).resolve().parent / f"results-{provider_setup.NAME}" out.mkdir(exist_ok=True) target, provider = await provider_setup.open() - client = await Client.connect(target, namespace="default") + client = await Client.connect(target, namespace="default", plugins=[provider]) uid = f"ai198-contract-{provider_setup.NAME}-" + uuid.uuid4().hex record: dict[str, Any] = { @@ -67,12 +76,11 @@ async def main() -> int: workflows=[AgentLoop], activities=[record_decision], max_cached_workflows=provider_setup.WORKFLOW_CACHE, - plugins=[provider], ): handle = await client.start_workflow( AgentLoop.run, DECISION_LIMIT, id=uid, task_queue=uid ) - stream = provider.get_stream_handle(client, uid) + stream = client.get_stream_handle(uid) output = asyncio.create_task(collect_output(stream, EXPECTED_OUTPUT)) # The first attempt writes two records and then stops, as a failed @@ -138,6 +146,19 @@ async def main() -> int: output.cancel() record["observed_output"] = "timed_out" + async def receipts() -> list[Any]: + # Ends by itself once the workflow is closed and the tail served. + return [ + r.value + async for r in stream.read(topic=RECEIPTS, result_type=dict) + if r.kind is RecordKind.DATA + ] + + try: + record["receipts"] = await asyncio.wait_for(receipts(), timeout=20) + except asyncio.TimeoutError: + record["receipts"] = "timed_out" + history = await handle.fetch_history() record["history_events"] = len(history.events) (out / "history.json").write_text(history.to_json()) From 40bc91e4e89df8b88a99f1d95d228a2a9b103ea4 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 10:51:07 -0700 Subject: [PATCH 34/51] Added typed topic definitions. A topic is defined once with streams.topic(name, type) and shared by the workflow, its activities and the backend, so the record and value types follow from the definition; a plain string still names a topic decided at runtime. The wire and every provider see only the name. --- CHANGELOG.md | 6 +- streams_demo/agent_loop.py | 12 +-- streams_demo/run_demo.py | 4 +- temporalio/streams/__init__.py | 9 +- temporalio/streams/_provider.py | 62 +++++++++---- temporalio/streams/_topic.py | 92 ++++++++++++++++++++ temporalio/streams/providers/memory.py | 32 ++++--- temporalio/workflow/_streams.py | 80 ++++++++++------- tests/streams/test_stream_accessors.py | 13 ++- tests/streams/test_streams_conformance.py | 101 +++++++++++++--------- tests/streams/test_streams_workflow.py | 32 +++---- 11 files changed, 309 insertions(+), 134 deletions(-) create mode 100644 temporalio/streams/_topic.py diff --git a/CHANGELOG.md b/CHANGELOG.md index a90a9114f..c74bdf72a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,8 +27,10 @@ to include examples, links to docs, or any other relevant information. inherit it; each context then asks for its stream the same way: `workflow.stream_reader()` and `workflow.stream_writer()` in workflow code, `activity.stream_handle()` in an activity, and `client.get_stream_handle()` - anywhere a client is held. The record on the wire is - `temporal.api.stream.v1.StreamRecord` on every provider. + anywhere a client is held. A topic is a typed definition, + `streams.topic("inputs", Token)`, shared by workflow, activity and client + code; a plain string names a topic decided at runtime. The record on the wire + is `temporal.api.stream.v1.StreamRecord` on every provider. `temporalio.streams.providers.memory.MemoryStreams` is the in-memory reference provider the conformance tests run against. diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py index a76b35ced..df5eac4d6 100644 --- a/streams_demo/agent_loop.py +++ b/streams_demo/agent_loop.py @@ -16,12 +16,14 @@ from datetime import timedelta from typing import Any -from temporalio import activity, workflow +from temporalio import activity, streams, workflow from temporalio.streams import RecordKind -DECISIONS = "decisions" -INPUTS = "inputs" -RECEIPTS = "receipts" +# Defined once and shared by the workflow, the Activity and the demo's +# reader, so the type each topic carries is stated in one place. +DECISIONS = streams.topic("decisions", dict[str, Any]) +INPUTS = streams.topic("inputs", dict[str, Any]) +RECEIPTS = streams.topic("receipts", dict[str, Any]) @activity.defn(name="RecordDecision") @@ -55,7 +57,7 @@ class AgentLoop: @workflow.run async def run(self, limit: int) -> list[dict[str, Any]]: """Decide on at most ``limit`` inputs, then return the trace.""" - inputs = workflow.stream_reader(INPUTS, result_type=dict) + inputs = workflow.stream_reader(INPUTS) decisions = workflow.stream_writer(DECISIONS) trace: list[dict[str, Any]] = [] accepted = 0 diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index 0b06e9395..e91bf2e31 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -48,7 +48,7 @@ async def collect_output(stream: StreamHandle, want: int) -> list[dict]: """Read ``want`` decisions off the workflow's stream from outside it.""" seen: list[dict] = [] - async for record in stream.read(topic=DECISIONS, result_type=dict): + async for record in stream.read(topic=DECISIONS): seen.append({"kind": record.kind.name, "value": record.value}) if len(seen) >= want: break @@ -150,7 +150,7 @@ async def receipts() -> list[Any]: # Ends by itself once the workflow is closed and the tail served. return [ r.value - async for r in stream.read(topic=RECEIPTS, result_type=dict) + async for r in stream.read(topic=RECEIPTS) if r.kind is RecordKind.DATA ] diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index c185c35ce..b23c95be4 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -28,7 +28,10 @@ 5. **A workflow addresses its streams relative to itself, by topic.** A topic can be written by the workflow and by outside producers, and read by the workflow and by outside consumers; which of those happen is the - application's business. + application's business. A topic is defined once with :func:`topic`, with + the type its records decode to, and that definition is shared by the + workflow, its activities and the backend; a plain string names a topic + decided at runtime. A provider is an object, registered once as a plugin: ``Client.connect(plugins=[provider])``; workers built from that client inherit @@ -80,6 +83,7 @@ StreamRecord, Supersession, ) +from temporalio.streams._topic import StreamTopic, resolve_topic, topic __all__ = [ "BEGINNING", @@ -94,8 +98,11 @@ "StreamProducerError", "StreamProvider", "StreamRecord", + "StreamTopic", "StreamUnsupportedError", "Supersession", "WorkflowStreamProvider", "WriteSink", + "resolve_topic", + "topic", ] diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index 6992f0a14..8c142080d 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -9,7 +9,9 @@ workflow code is bundled separately name the two halves in two packages. A provider only moves ``temporal.api.stream.v1.StreamRecord`` protos. The -handles around it convert values, synthesize supersession and mint cursors. +handles around it convert values, synthesize supersession and mint cursors, +and turn a :class:`temporalio.streams.StreamTopic` into the plain name the +provider sees, through :func:`temporalio.streams.resolve_topic`. """ from __future__ import annotations @@ -19,6 +21,7 @@ from temporalio.api.stream.v1 import StreamRecord as WireRecord from temporalio.streams._record import BEGINNING, Cursor, StreamRecord +from temporalio.streams._topic import StreamTopic if TYPE_CHECKING: from temporalio.client import Client @@ -33,14 +36,16 @@ ] T = TypeVar("T") +T_contra = TypeVar("T_contra", contravariant=True) -class StreamProducer(Protocol): +class StreamProducer(Protocol[T_contra]): """Appends to one topic from outside workflow code. Every append is visible as soon as the store accepts it, and carries the producer id, attempt and sequence that let a reader tell a retried append - from a new generation. + from a new generation. The type parameter is the topic definition's + value type; a producer on a string-named topic takes any value. """ @property @@ -53,7 +58,7 @@ def attempt(self) -> int: """The generation this producer is writing, or 0 when undeclared.""" ... - async def append(self, *values: Any) -> Cursor | None: + async def append(self, *values: T_contra) -> Cursor | None: """Append ``values`` and return the cursor of the last record as the store holds it. A repeat of an earlier append (same producer, attempt and sequence) is @@ -83,11 +88,19 @@ class StreamHandle(Protocol): """One workflow's stream, addressed by topic, from outside workflow code. A handle follows the workflow's execution chain unless it was opened with - a ``run_id``, in which case it is pinned to that run. A transport failure - surfaces as :class:`temporalio.service.RPCError`, never as the transport's - own exception type. + a ``run_id``, in which case it is pinned to that run. A topic is a + :class:`temporalio.streams.StreamTopic` definition, which carries the + record type, or a plain string with ``result_type=`` for a name decided + at runtime. A transport failure surfaces as + :class:`temporalio.service.RPCError`, never as the transport's own + exception type. """ + @overload + def read( + self, *, topic: StreamTopic[T], after: Cursor = ... + ) -> AsyncGenerator[StreamRecord[T], None]: ... + @overload def read( self, *, topic: str, after: Cursor = ..., result_type: type[T] @@ -101,7 +114,7 @@ def read( def read( self, *, - topic: str, + topic: str | StreamTopic[Any], after: Cursor = BEGINNING, result_type: type | None = None, ) -> AsyncGenerator[StreamRecord[Any], None]: @@ -117,6 +130,8 @@ def read( release whatever the provider parked against the store. Raises: + ValueError: ``result_type`` was passed with a topic definition, + or the topic is empty. StreamCursorError: ``after`` came from another provider or names a record no longer retained. Raised by this call, not by the first iteration. @@ -125,7 +140,7 @@ def read( """ ... - async def latest(self, *, topic: str) -> Cursor: + async def latest(self, *, topic: str | StreamTopic[Any]) -> Cursor: """The cursor of the newest record on ``topic``, or ``BEGINNING`` when empty. For a reader that wants to follow from now: ``read(after=latest())`` @@ -135,9 +150,23 @@ async def latest(self, *, topic: str) -> Cursor: """ ... + @overload + def producer( + self, *, topic: StreamTopic[T], producer_id: str = ..., attempt: int = ... + ) -> StreamProducer[T]: ... + + @overload + def producer( + self, *, topic: str, producer_id: str = ..., attempt: int = ... + ) -> StreamProducer[Any]: ... + def producer( - self, *, topic: str, producer_id: str = "", attempt: int = 0 - ) -> StreamProducer: + self, + *, + topic: str | StreamTopic[Any], + producer_id: str = "", + attempt: int = 0, + ) -> StreamProducer[Any]: """A producer on ``topic``. Inside an activity, leave ``producer_id`` and ``attempt`` unset: the @@ -189,7 +218,8 @@ class WorkflowStreamProvider(Protocol): Imports nothing that does I/O. The worker creates one per workflow instance through :meth:`StreamProvider.workflow_provider`, so state kept - here dies with the instance the way handlers do. + here dies with the instance the way handlers do. It sees topics by name; + the definitions are resolved before it is called. """ def open_reader(self, topic: str, *, after: Cursor) -> ReadSource: @@ -224,9 +254,11 @@ async def on_workflow_finish(self) -> None: class StreamProvider(Protocol): """What a store ships. Also a :class:`temporalio.worker.Plugin` when it serves workers. - Construct one, pass it to ``Worker(plugins=[provider])`` and - ``Replayer(plugins=[provider])``, and open handles from it anywhere else. - Nothing is global: two workers in one process may hold two providers. + Construct one, pass it to ``Client.connect(plugins=[provider])`` so the + client and the workers built from it carry it, or to + ``Worker(plugins=[provider])`` and ``Replayer(plugins=[provider])`` for a + worker alone, and open handles from it anywhere else. Nothing is global: + two workers in one process may hold two providers. """ def workflow_provider(self) -> WorkflowStreamProvider: diff --git a/temporalio/streams/_topic.py b/temporalio/streams/_topic.py new file mode 100644 index 000000000..173291fad --- /dev/null +++ b/temporalio/streams/_topic.py @@ -0,0 +1,92 @@ +"""Typed topic definitions. + +Temporal's idiom is to define once and refer by reference: signals, queries +and updates are decorated methods, activities and workflows are functions, +Nexus operations are typed definitions. A topic follows the same rule. It is +defined once, at module level, with the type its records decode to, and the +workflow, its activities and the backend all refer to that one definition. A +plain string names a topic too, the way a string names a signal chosen at +runtime; then the decode hint travels as ``result_type=`` on each call. + +The wire does not change: a topic is a string on the proto and in every +store, and :attr:`temporalio.streams.StreamRecord.topic` is that string. +""" + +from __future__ import annotations + +from dataclasses import dataclass +from typing import Any, Generic, TypeVar, overload + +__all__ = ["StreamTopic", "resolve_topic", "topic"] + +T = TypeVar("T") + + +@dataclass(frozen=True) +class StreamTopic(Generic[T]): + """A topic of a workflow's stream, with the type its records decode to. + + Made with :func:`topic`. Hand it to :func:`temporalio.workflow.stream_reader`, + :func:`temporalio.workflow.stream_writer`, and to a handle's ``read``, + ``latest`` and ``producer``, and the record and value types follow from + it; ``result_type=`` is not passed alongside a definition. + """ + + name: str + result_type: type[T] | None = None + """The type records decode to, or ``None`` for the converter's default.""" + + +@overload +def topic(name: str, result_type: type[T]) -> StreamTopic[T]: ... + + +@overload +def topic(name: str, result_type: None = None) -> StreamTopic[Any]: ... + + +def topic(name: str, result_type: type | None = None) -> StreamTopic[Any]: + """Define a topic of a workflow's stream. + + Define it once, at module level, and share it: the workflow reads or + publishes it, an activity or a backend produces onto it or reads it, and + the type it carries is inferred wherever it is used. Use a plain string + instead only when the name is decided at runtime. + + Args: + name: The topic's name, as it appears on every record. + result_type: The type records on this topic decode to. Without one, + the payload converter's default applies. + + Raises: + ValueError: ``name`` is empty. + """ + if not name: + raise ValueError("topic name must not be empty") + return StreamTopic(name, result_type) + + +def resolve_topic( + topic: str | StreamTopic[Any], result_type: type | None = None +) -> tuple[str, type | None]: + """The name and decode hint a call means, from either form of topic. + + Providers call this once at the top of ``read``, ``latest`` and + ``producer``, so a definition and a string are the same to the store. + + Raises: + ValueError: A definition was given together with ``result_type``, + which would name two types for one topic, or the name is empty. + """ + if isinstance(topic, StreamTopic): + if result_type is not None: + raise ValueError( + f"topic {topic.name!r} already carries its type; do not pass " + "result_type= with a definition" + ) + name, result_type = topic.name, topic.result_type + else: + name = topic + if not name: + raise ValueError("topic must not be empty") + return name, result_type diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 2a6087b2d..f175570a8 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -28,7 +28,7 @@ import logging from collections.abc import AsyncGenerator from datetime import timedelta -from typing import Any +from typing import Any, Generic, TypeVar from google.protobuf.message import DecodeError @@ -40,6 +40,7 @@ from temporalio.streams._ids import topic_key from temporalio.streams._provider import ReadSource, WriteSink from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord +from temporalio.streams._topic import StreamTopic, resolve_topic from temporalio.streams._wire import ( RecordDecoder, WireRecord, @@ -54,6 +55,8 @@ _PROVIDER = "memory" +T = TypeVar("T") + logger = logging.getLogger(__name__) @@ -189,7 +192,7 @@ async def on_workflow_finish(self) -> None: pass -class MemoryProducer: +class MemoryProducer(Generic[T]): """The outside producer, faithful to the contract.""" def __init__( @@ -227,7 +230,7 @@ def _writer(self) -> str: else self._producer_id ) - async def append(self, *values: Any) -> Cursor: + async def append(self, *values: T) -> Cursor: """Append ``values`` and return the cursor of the last record as stored. A repeat returns where the original landed; an empty call returns @@ -298,12 +301,13 @@ def __init__( def read( self, *, - topic: str, + topic: str | StreamTopic[Any], after: Cursor = BEGINNING, result_type: type | None = None, ) -> AsyncGenerator[StreamRecord[Any], None]: """Yield records on ``topic`` after ``after`` until the workflow closes.""" - store = self._streams._topic(self._workflow_id, topic) + name, result_type = resolve_topic(topic, result_type) + store = self._streams._topic(self._workflow_id, name) # Parsed here so a foreign cursor fails this call, not the first # iteration of the generator. start = self._streams._offset_after(after) @@ -366,18 +370,24 @@ async def _closed(self) -> bool: self._run_id is None and status == WorkflowExecutionStatus.CONTINUED_AS_NEW ) - async def latest(self, *, topic: str) -> Cursor: + async def latest(self, *, topic: str | StreamTopic[Any]) -> Cursor: """The cursor of the newest record on ``topic``, for following from now.""" - count = len(self._streams._topic(self._workflow_id, topic).records) + name, _ = resolve_topic(topic) + count = len(self._streams._topic(self._workflow_id, name).records) return mint_cursor(_PROVIDER, str(count - 1)) if count else BEGINNING def producer( - self, *, topic: str, producer_id: str = "", attempt: int = 0 - ) -> MemoryProducer: + self, + *, + topic: str | StreamTopic[Any], + producer_id: str = "", + attempt: int = 0, + ) -> MemoryProducer[Any]: """A producer on ``topic``; inside an activity its identity is the activity's.""" - store = self._streams._topic(self._workflow_id, topic) + name, _ = resolve_topic(topic) + store = self._streams._topic(self._workflow_id, name) producer_id, attempt = producer_identity(producer_id, attempt) - return MemoryProducer(store, self._converter, topic, producer_id, attempt) + return MemoryProducer(store, self._converter, name, producer_id, attempt) class MemoryStreams(ProviderPlugin): diff --git a/temporalio/workflow/_streams.py b/temporalio/workflow/_streams.py index 029da59a1..5d319d50a 100644 --- a/temporalio/workflow/_streams.py +++ b/temporalio/workflow/_streams.py @@ -19,6 +19,7 @@ from temporalio.streams._provider import ReadSource, WorkflowStreamProvider, WriteSink from temporalio.streams._record import BEGINNING, Cursor, RecordKind, StreamRecord +from temporalio.streams._topic import StreamTopic, resolve_topic from temporalio.streams._wire import RecordDecoder, to_wire from temporalio.workflow._context import _Runtime, payload_converter from temporalio.workflow._sandbox import logger @@ -71,7 +72,7 @@ def __init__( @property def topic(self) -> str: - """The topic this reader is subscribed to.""" + """The name of the topic this reader is subscribed to.""" return self._topic def __aiter__(self) -> StreamReader[T]: @@ -124,12 +125,14 @@ def close(self) -> None: self._on_close() -class StreamWriter: +class StreamWriter(Generic[T]): """Publishes to one topic of this workflow's stream. A workflow can only publish transactionally to its own stream, on every provider. Writing to somebody else's stream is an activity's job, and it - gets the weaker guarantee that goes with doing I/O. + gets the weaker guarantee that goes with doing I/O. The type parameter is + the topic definition's value type; a writer on a string-named topic takes + any value. """ def __init__(self, sink: WriteSink, topic: str) -> None: @@ -140,10 +143,10 @@ def __init__(self, sink: WriteSink, topic: str) -> None: @property def topic(self) -> str: - """The topic this writer is bound to.""" + """The name of the topic this writer is bound to.""" return self._topic - def publish(self, value: Any) -> None: + def publish(self, value: T) -> None: """Append ``value`` to this topic. Synchronous, because there is nothing to wait for inside a task: the @@ -180,6 +183,10 @@ def finish(self) -> None: ) +@overload +def stream_reader(topic: StreamTopic[T], *, after: Cursor = ...) -> StreamReader[T]: ... + + @overload def stream_reader( topic: str, *, result_type: type[T], after: Cursor = ... @@ -193,65 +200,80 @@ def stream_reader( def stream_reader( - topic: str, *, result_type: type | None = None, after: Cursor = BEGINNING + topic: str | StreamTopic[Any], + *, + result_type: type | None = None, + after: Cursor = BEGINNING, ) -> StreamReader[Any]: """Subscribe this workflow to ``topic`` of its own stream. - One subscription per topic per run. A second call for the same topic - returns the reader already open on it, so records go to whichever loop - pulls first; such a call may pass neither ``after`` nor a different - ``result_type``. Adding a reader on a new topic is a new command, so gate - it with :func:`temporalio.workflow.patched` as you would a timer. A + ``topic`` is a :func:`temporalio.streams.topic` definition, which carries + the record type, or a plain string with ``result_type=`` for a name + decided at runtime. One subscription per topic per run. A second call + for the same topic returns the reader already open on it, so records go + to whichever loop pulls first; such a call may pass neither ``after`` nor + a different type. Adding a reader on a new topic is a new command, so + gate it with :func:`temporalio.workflow.patched` as you would a timer. A reader in a successor run starts a new subscription: nothing crosses continue-as-new implicitly. Args: topic: The topic, relative to this workflow's stream. - result_type: The value type, used as the decode hint. - :class:`temporalio.common.RawValue` returns the payload untouched. + result_type: The value type for a string-named topic, used as the + decode hint. :class:`temporalio.common.RawValue` returns the + payload untouched. after: Resume strictly after this record. Honoured on the first subscription of a run, because after that the recorded observations decide. Raises: - ValueError: ``topic`` is empty, or a reader on it is already open and - this call asked for a different position or type. + ValueError: ``topic`` is empty, ``result_type`` was passed with a + definition, or a reader on the topic is already open and this + call asked for a different position or type. temporalio.streams.StreamCursorError: ``after`` was minted by another provider. """ - if not topic: - raise ValueError("topic must not be empty") + name, result_type = resolve_topic(topic, result_type) state: _WorkflowStreams = _Runtime.current().workflow_streams() - existing = state.readers.get(topic) + existing = state.readers.get(name) if existing is not None: if after != BEGINNING or result_type is not existing._result_type: raise ValueError( - f"topic {topic!r} already has a reader in this run; a second " - "stream_reader shares it and takes no after= or other result_type=" + f"topic {name!r} already has a reader in this run; a second " + "stream_reader shares it and takes no after= or other type" ) return existing - source = state.provider.open_reader(topic, after=after) + source = state.provider.open_reader(name, after=after) def forget() -> None: - state.readers.pop(topic, None) + state.readers.pop(name, None) reader: StreamReader[Any] = StreamReader( - source, topic=topic, result_type=result_type, after=after, on_close=forget + source, topic=name, result_type=result_type, after=after, on_close=forget ) - state.readers[topic] = reader + state.readers[name] = reader return reader -def stream_writer(topic: str) -> StreamWriter: +@overload +def stream_writer(topic: StreamTopic[T]) -> StreamWriter[T]: ... + + +@overload +def stream_writer(topic: str) -> StreamWriter[Any]: ... + + +def stream_writer(topic: str | StreamTopic[Any]) -> StreamWriter[Any]: """Publish to ``topic`` of this workflow's stream. Args: - topic: The topic name. Encoding follows each published value. + topic: A :func:`temporalio.streams.topic` definition, whose value type + the writer's ``publish`` takes, or a plain string for a name + decided at runtime. Encoding follows each published value. Raises: ValueError: ``topic`` is empty. """ - if not topic: - raise ValueError("topic must not be empty") + name, _ = resolve_topic(topic) provider = _Runtime.current().workflow_streams().provider - return StreamWriter(provider.open_writer(topic), topic) + return StreamWriter(provider.open_writer(name), name) diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py index 73436dea2..eb733ba5b 100644 --- a/tests/streams/test_stream_accessors.py +++ b/tests/streams/test_stream_accessors.py @@ -18,13 +18,13 @@ from temporalio import activity, workflow from temporalio.client import Client -from temporalio.streams import RecordKind, StreamUnsupportedError +from temporalio.streams import RecordKind, StreamUnsupportedError, topic from temporalio.streams.providers.memory import MemoryStreams from temporalio.testing import ActivityEnvironment, WorkflowEnvironment from tests.helpers import new_worker -INPUTS = "inputs" -DECISIONS = "decisions" +INPUTS = topic("inputs", dict) +DECISIONS = topic("decisions", dict) @pytest.fixture @@ -64,7 +64,7 @@ class Echo: @workflow.run async def run(self, count: int) -> list[Any]: - inputs = workflow.stream_reader(INPUTS, result_type=dict) + inputs = workflow.stream_reader(INPUTS) decisions = workflow.stream_writer(DECISIONS) emitting = workflow.start_activity( emit, count, start_to_close_timeout=timedelta(seconds=30) @@ -100,10 +100,7 @@ async def test_one_registration_on_the_client_serves_every_context( stream = registered.get_stream_handle(workflow_id) async def read_everything() -> list[Any]: - return [ - (r.kind, r.value) - async for r in stream.read(topic=DECISIONS, result_type=dict) - ] + return [(r.kind, r.value) async for r in stream.read(topic=DECISIONS)] assert await asyncio.wait_for(read_everything(), 30) == [ (RecordKind.DATA, {"echo": 0}), diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 020250973..9002ea16a 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -42,10 +42,19 @@ Supersession, _ids, _wire, + topic, ) from temporalio.streams._policy import AttemptTracker from temporalio.streams.providers.memory import MemoryStreams +# Defined once and shared by every case, the way an application shares them +# between its workflow, its activities and its backend. +OUT = topic("out", dict) +A = topic("a", dict) +B = topic("b", dict) +Y = topic("y", dict) +XY = topic("x:y", dict) + @dataclass class ProviderCase: @@ -195,12 +204,12 @@ def test_cursors_name_their_provider(): async def test_append_read_roundtrip(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - producer = stream.producer(topic="out", producer_id="model", attempt=1) + producer = stream.producer(topic=OUT, producer_id="model", attempt=1) assert (producer.producer_id, producer.attempt) == ("model", 1) await producer.append({"id": "r1"}, {"id": "r2"}) await producer.finish() - records = await take(stream.read(topic="out", result_type=dict), 3) + records = await take(stream.read(topic=OUT), 3) assert [r.kind for r in records] == [ RecordKind.DATA, RecordKind.DATA, @@ -210,14 +219,14 @@ async def test_append_read_roundtrip(case: ProviderCase): assert records[2].value is None assert all(r.producer_id == "model" and r.attempt == 1 for r in records) assert [r.sequence for r in records] == [0, 1, 2] - assert all(r.topic == "out" for r in records) + assert all(r.topic == OUT.name for r in records) async def test_raw_values_pass_through_untouched(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) payload = Payload(metadata={"encoding": b"binary/plain"}, data=b"\x00\x01raw") - producer = stream.producer(topic="out", producer_id="model", attempt=1) + producer = stream.producer(topic=OUT.name, producer_id="model", attempt=1) await producer.append(RawValue(payload)) records = await take(stream.read(topic="out", result_type=RawValue), 1) @@ -229,46 +238,46 @@ async def test_raw_values_pass_through_untouched(case: ProviderCase): async def test_retried_append_returns_the_original_position(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - first = stream.producer(topic="out", producer_id="model", attempt=1) + first = stream.producer(topic=OUT, producer_id="model", attempt=1) landed = await first.append({"id": "r1"}) assert landed is not None # The retry of the same attempt starts its sequence over and appends the # same record. The provider stores it once and answers with where the # original landed, so the retry can checkpoint the same position. - retry = stream.producer(topic="out", producer_id="model", attempt=1) + retry = stream.producer(topic=OUT, producer_id="model", attempt=1) assert await retry.append({"id": "r1"}) == landed # An empty call writes nothing and answers the same way. assert await retry.append() == landed - records = await take(stream.read(topic="out", result_type=dict), 1) + records = await take(stream.read(topic=OUT), 1) assert records[0].value == {"id": "r1"} assert records[0].cursor == landed # The store holds exactly the one record: the newest position is its cursor. - assert await stream.latest(topic="out") == landed + assert await stream.latest(topic=OUT) == landed async def test_retried_append_is_stored_once(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - first = stream.producer(topic="out", producer_id="model", attempt=1) + first = stream.producer(topic=OUT, producer_id="model", attempt=1) await first.append({"id": "r1"}) - retry = stream.producer(topic="out", producer_id="model", attempt=1) + retry = stream.producer(topic=OUT, producer_id="model", attempt=1) await retry.append({"id": "r1"}) await retry.append({"id": "r2"}) - records = await take(stream.read(topic="out", result_type=dict), 2) + records = await take(stream.read(topic=OUT), 2) assert [r.value for r in records] == [{"id": "r1"}, {"id": "r2"}] async def test_new_attempt_supersedes_the_old_one(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - first = stream.producer(topic="out", producer_id="model", attempt=1) + first = stream.producer(topic=OUT, producer_id="model", attempt=1) await first.append({"text": "The capital of"}) - second = stream.producer(topic="out", producer_id="model", attempt=2) + second = stream.producer(topic=OUT, producer_id="model", attempt=2) await second.append({"text": "Paris is the capital"}) - records = await take(stream.read(topic="out", result_type=dict), 3) + records = await take(stream.read(topic=OUT), 3) assert records[0].kind is RecordKind.DATA and records[0].attempt == 1 assert records[1].kind is RecordKind.SUPERSEDED assert records[1].supersession == Supersession("model", 1, 2) @@ -281,21 +290,19 @@ async def test_a_superseded_record_resumes_to_the_triggering_record( ): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - first = stream.producer(topic="out", producer_id="model", attempt=1) + first = stream.producer(topic=OUT, producer_id="model", attempt=1) await first.append({"n": 1}) - second = stream.producer(topic="out", producer_id="model", attempt=2) + second = stream.producer(topic=OUT, producer_id="model", attempt=2) await second.append({"n": 2}) - records = await take(stream.read(topic="out", result_type=dict), 3) + records = await take(stream.read(topic=OUT), 3) superseded = records[1] assert superseded.kind is RecordKind.SUPERSEDED # The synthesized record sits at the position before the new attempt's # first record, so a consumer that checkpoints it and restarts is handed # that record rather than skipping it. assert superseded.cursor == records[0].cursor - resumed = await take( - stream.read(topic="out", result_type=dict, after=superseded.cursor), 1 - ) + resumed = await take(stream.read(topic=OUT, after=superseded.cursor), 1) assert resumed[0].kind is RecordKind.DATA assert resumed[0].value == {"n": 2} @@ -305,29 +312,29 @@ async def test_topics_are_addressed_by_name(case: ProviderCase): # names its topic and sees only that topic's records. workflow_id = new_workflow_id() stream = await case.open(workflow_id) - on_a = stream.producer(topic="a", producer_id="tool-a", attempt=1) + on_a = stream.producer(topic=A, producer_id="tool-a", attempt=1) await on_a.append({"n": 1}) - on_b = stream.producer(topic="b", producer_id="tool-b", attempt=1) + on_b = stream.producer(topic=B, producer_id="tool-b", attempt=1) await on_b.append({"n": 2}) - only_a = await take(stream.read(topic="a", result_type=dict), 1) + only_a = await take(stream.read(topic=A), 1) assert [(r.topic, r.value) for r in only_a] == [("a", {"n": 1})] - only_b = await take(stream.read(topic="b", result_type=dict), 1) + only_b = await take(stream.read(topic=B), 1) assert [(r.topic, r.value) for r in only_b] == [("b", {"n": 2})] async def test_cursor_resumes_where_it_points(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - producer = stream.producer(topic="out", producer_id="model", attempt=1) + producer = stream.producer(topic=OUT, producer_id="model", attempt=1) await producer.append({"n": 1}, {"n": 2}, {"n": 3}) - records = await take(stream.read(topic="out", result_type=dict), 3) + records = await take(stream.read(topic=OUT), 3) checkpoint = records[0].cursor # Resuming after a record hands back everything past it and nothing # twice, without the reader ever advancing a cursor itself. - again = await take(stream.read(topic="out", result_type=dict, after=checkpoint), 2) + again = await take(stream.read(topic=OUT, after=checkpoint), 2) assert [r.value for r in again] == [{"n": 2}, {"n": 3}] @@ -335,14 +342,14 @@ async def test_cursor_resumes_where_it_points(case: ProviderCase): async def test_append_cursor_names_the_last_record_of_the_batch(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - producer = stream.producer(topic="out", producer_id="model", attempt=1) + producer = stream.producer(topic=OUT, producer_id="model", attempt=1) appended = await producer.append({"n": 1}, {"n": 2}, {"n": 3}) assert appended is not None then = await producer.append({"n": 4}) # A producer that resumes a reader after its own append must see only # what came later, not the tail of the batch it just wrote. - records = await take(stream.read(topic="out", result_type=dict, after=appended), 1) + records = await take(stream.read(topic=OUT, after=appended), 1) assert [r.value for r in records] == [{"n": 4}] assert records[0].cursor == then assert await producer.append() == then @@ -351,16 +358,16 @@ async def test_append_cursor_names_the_last_record_of_the_batch(case: ProviderCa async def test_latest_positions_a_reader_at_the_end(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) - producer = stream.producer(topic="out", producer_id="model", attempt=1) - assert await stream.latest(topic="out") == BEGINNING + producer = stream.producer(topic=OUT, producer_id="model", attempt=1) + assert await stream.latest(topic=OUT) == BEGINNING await producer.append({"n": 1}, {"n": 2}) - since = await stream.latest(topic="out") + since = await stream.latest(topic=OUT) await producer.append({"n": 3}) # A reader that positioned itself before the last append sees only what # came after, which is how a client follows a turn it is about to start. - records = await take(stream.read(topic="out", result_type=dict, after=since), 1) + records = await take(stream.read(topic=OUT, after=since), 1) assert [r.value for r in records] == [{"n": 3}] @@ -369,17 +376,15 @@ async def test_topic_addresses_with_colons_do_not_share_a_store(case: ProviderCa base = new_workflow_id() left = await case.open(f"{base}:x") right = await case.open(base) - await left.producer(topic="y", producer_id="l", attempt=1).append({"side": "left"}) - await right.producer(topic="x:y", producer_id="r", attempt=1).append( - {"side": "right"} - ) + await left.producer(topic=Y, producer_id="l", attempt=1).append({"side": "left"}) + await right.producer(topic=XY, producer_id="r", attempt=1).append({"side": "right"}) - only_left = await take(left.read(topic="y", result_type=dict), 1) + only_left = await take(left.read(topic=Y), 1) assert [r.value for r in only_left] == [{"side": "left"}] - assert await left.latest(topic="y") == only_left[0].cursor - only_right = await take(right.read(topic="x:y", result_type=dict), 1) + assert await left.latest(topic=Y) == only_left[0].cursor + only_right = await take(right.read(topic=XY), 1) assert [r.value for r in only_right] == [{"side": "right"}] - assert await right.latest(topic="x:y") == only_right[0].cursor + assert await right.latest(topic=XY) == only_right[0].cursor async def test_a_foreign_cursor_is_refused_at_the_call(case: ProviderCase): @@ -387,7 +392,7 @@ async def test_a_foreign_cursor_is_refused_at_the_call(case: ProviderCase): # Refused by read() itself, not by the first iteration of its generator, # so the caller's except clause is where the mistake surfaces. with pytest.raises(StreamCursorError): - stream.read(topic="out", after=Cursor("elsewhere:42")) + stream.read(topic=OUT, after=Cursor("elsewhere:42")) async def test_argument_mistakes_are_value_errors(case: ProviderCase): @@ -398,4 +403,14 @@ async def test_argument_mistakes_are_value_errors(case: ProviderCase): stream.producer(topic="", producer_id="model", attempt=1) # Outside an activity there is no identity to fall back on. with pytest.raises(ValueError, match="producer_id is required"): - stream.producer(topic="out") + stream.producer(topic=OUT) + + +async def test_a_definition_carries_its_type_once(case: ProviderCase): + stream = await case.open(new_workflow_id()) + with pytest.raises(ValueError, match="already carries its type"): + stream.read(topic=OUT, result_type=dict) # type: ignore[call-overload] + with pytest.raises(ValueError): + topic("", dict) + # A string names a topic decided at runtime, and the hint rides the call. + assert await stream.latest(topic=OUT.name) == BEGINNING diff --git a/tests/streams/test_streams_workflow.py b/tests/streams/test_streams_workflow.py index 58fb274ef..71f2bb8bf 100644 --- a/tests/streams/test_streams_workflow.py +++ b/tests/streams/test_streams_workflow.py @@ -30,6 +30,7 @@ RecordKind, StreamCursorError, WriteSink, + topic, ) from temporalio.streams.providers.memory import MemoryStreams from temporalio.testing import WorkflowEnvironment @@ -37,8 +38,8 @@ from tests.helpers import new_worker from tests.streams.test_streams_conformance import take -INPUTS = "inputs" -DECISIONS = "decisions" +INPUTS = topic("inputs", dict) +DECISIONS = topic("decisions", dict) @pytest.fixture @@ -58,7 +59,7 @@ class ContractLoop: @workflow.run async def run(self) -> list[dict[str, Any]]: - inputs = workflow.stream_reader(INPUTS, result_type=dict) + inputs = workflow.stream_reader(INPUTS) decisions = workflow.stream_writer(DECISIONS) trace: list[dict[str, Any]] = [] try: @@ -128,7 +129,7 @@ async def test_workflow_reads_decides_and_publishes( # The outside view of what the workflow published, on its own topic. stream = provider.get_stream_handle(client, handle.id) - records = await take(stream.read(topic=DECISIONS, result_type=dict), 5) + records = await take(stream.read(topic=DECISIONS), 5) assert [(r.kind, r.value) for r in records] == [ (RecordKind.DATA, {"decided": 1}), (RecordKind.DATA, {"decided": 2}), @@ -136,7 +137,7 @@ async def test_workflow_reads_decides_and_publishes( (RecordKind.DATA, {"decided": 3}), (RecordKind.FINISH, None), ] - assert all(r.producer_id == "" and r.topic == DECISIONS for r in records) + assert all(r.producer_id == "" and r.topic == DECISIONS.name for r in records) # The second finish() wrote nothing: the marker is the newest record. assert await stream.latest(topic=DECISIONS) == records[-1].cursor @@ -148,7 +149,7 @@ async def test_read_ends_when_the_workflow_closes_and_the_tail_is_delivered( stream = provider.get_stream_handle(client, handle.id) async def read_everything() -> list[Any]: - return [r.value async for r in stream.read(topic=DECISIONS, result_type=dict)] + return [r.value async for r in stream.read(topic=DECISIONS)] # No count and no early break: the read ends by itself once the workflow # is closed and everything it retained has been handed over. @@ -218,9 +219,7 @@ async def test_a_failed_task_publishes_nothing(client: Client, provider: MemoryS PublishThenFail.run, id=workflow_id, task_queue=worker.task_queue ) stream = provider.get_stream_handle(client, workflow_id) - records = await take( - stream.read(topic=DECISIONS, result_type=dict), 2, timeout=30 - ) + records = await take(stream.read(topic=DECISIONS), 2, timeout=30) await handle.result() assert [(r.kind, r.value) for r in records] == [ (RecordKind.DATA, {"committed": True}), @@ -301,10 +300,7 @@ async def test_a_handle_without_a_run_id_reads_across_continue_as_new( stream = provider.get_stream_handle(client, workflow_id) async def read_everything() -> list[Any]: - return [ - (r.kind, r.value) - async for r in stream.read(topic=DECISIONS, result_type=dict) - ] + return [(r.kind, r.value) async for r in stream.read(topic=DECISIONS)] records = await asyncio.wait_for(read_everything(), 30) await handle.result() @@ -323,15 +319,15 @@ class SharedReaders: @workflow.run async def run(self) -> list[Any]: - first = workflow.stream_reader(INPUTS, result_type=dict) - second = workflow.stream_reader(INPUTS, result_type=dict) + first = workflow.stream_reader(INPUTS) + second = workflow.stream_reader(INPUTS) trace: list[Any] = ["shared" if first is second else "separate"] try: - workflow.stream_reader(INPUTS, result_type=dict, after=Cursor("memory:0")) + workflow.stream_reader(INPUTS, after=Cursor("memory:0")) except ValueError: trace.append("after-rejected") try: - workflow.stream_reader(INPUTS, result_type=list) + workflow.stream_reader(INPUTS.name, result_type=list) except ValueError: trace.append("type-rejected") trace.append((await first.__anext__()).value) @@ -435,7 +431,7 @@ async def test_an_outside_producer_and_the_workflow_share_a_topic( await handle.result() async def read_everything() -> list[Any]: - return [r async for r in stream.read(topic=DECISIONS, result_type=dict)] + return [r async for r in stream.read(topic=DECISIONS)] records = await asyncio.wait_for(read_everything(), 30) # Both writers land on one topic in one order, each under its own From b06871231fdd4d75c39e9ac62393217faad4768a Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 17:46:53 -0700 Subject: [PATCH 35/51] Listed stream_provider in ClientConnectConfig. `Client.connect` takes `stream_provider`, and the TypedDict that mirrors its keyword arguments has to name the same keys. The client test that compares the two failed on every branch since the keyword was added. --- temporalio/client/_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index dc4ef68c4..7cf624242 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -3058,6 +3058,7 @@ class ClientConnectConfig(TypedDict, total=False): grpc_compression: GrpcCompression payload_limits: PayloadLimitsConfig header_codec_behavior: HeaderCodecBehavior + stream_provider: temporalio.streams.StreamProvider | None class ClientConfig(TypedDict, total=False): From 1a8d19feac2d5a416678003bfe87ff3fb7dc9b2b Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 21 Sep 2026 18:03:43 -0700 Subject: [PATCH 36/51] Repinned Core to a protos-only branch on the commit main pins. `moe/AI-198-api-protos-on-85b71d7` is upstream's `85b71d7` plus the api branch's stream diff on its `api_upstream`, so the vendored `temporalio/api` regenerates byte-for-byte from the pin, which is what the `check-protos` job asserts. The bridge protos are unchanged. --- temporalio/bridge/sdk-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temporalio/bridge/sdk-core b/temporalio/bridge/sdk-core index 85b71d7ec..5209468cb 160000 --- a/temporalio/bridge/sdk-core +++ b/temporalio/bridge/sdk-core @@ -1 +1 @@ -Subproject commit 85b71d7ecd4f2bf677fa1cee17f3fbc1ab10f1b9 +Subproject commit 5209468cb61533f95b78c9f9d5561d55400e2d25 From 55200ecf0395dc930640f98064f8d6868d4a85fe Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 25 Sep 2026 08:08:47 -0700 Subject: [PATCH 37/51] Added activity.stream_handle. With no arguments the handle is the activity's own workflow, pinned to its run, so a producer opened from it writes onto that run's stream and its identity is the activity's. A sync activity gets no provider, the way it gets no client. --- temporalio/activity.py | 48 ++++++++++++++++++++++++++++++++++ temporalio/worker/_activity.py | 6 +++++ temporalio/worker/_worker.py | 1 + 3 files changed, 55 insertions(+) diff --git a/temporalio/activity.py b/temporalio/activity.py index 82678d8a1..33f3a90eb 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -29,6 +29,7 @@ import temporalio.bridge.proto.activity_task import temporalio.common import temporalio.converter +import temporalio.streams from temporalio.converter._payload_converter import ( _TemporalTransferTypePayloadConverter, ) @@ -209,6 +210,7 @@ class _Context: runtime_metric_meter: temporalio.common.MetricMeter | None client: Client | None cancellation_details: _ActivityCancellationDetailsHolder + stream_provider: temporalio.streams.StreamProvider | None = None _logger_details: Mapping[str, Any] | None = None _payload_converter: temporalio.converter.PayloadConverter | None = None _metric_meter: temporalio.common.MetricMeter | None = None @@ -298,6 +300,52 @@ def client() -> Client: return client +def stream_handle( + workflow_id: str | None = None, *, run_id: str | None = None +) -> temporalio.streams.StreamHandle: + """Return a stream handle from the provider the worker was given. + + With no arguments the handle is on this activity's own workflow, pinned to + the run the activity belongs to, so a producer opened from it writes onto + that run's stream and a read follows that run. Name a ``workflow_id`` to + address another workflow; ``run_id`` then pins the handle to one run and + its absence follows the execution chain. See :py:mod:`temporalio.streams`. + + Like :py:func:`client`, this is only available in ``async def`` + activities. + + Returns: + :py:class:`temporalio.streams.StreamHandle` for use in the current + activity. + + Raises: + temporalio.streams.StreamUnsupportedError: The worker has no stream + provider. Register one with ``Client.connect(plugins=[provider])`` + or ``Worker(plugins=[provider])``. + RuntimeError: When the client is not available, or when the activity + has no workflow and no ``workflow_id`` was given. + ValueError: ``run_id`` was given without ``workflow_id``. + """ + context = _Context.current() + provider = context.stream_provider + if provider is None: + raise temporalio.streams.StreamUnsupportedError( + "no stream provider is configured on this worker; register one with " + "Client.connect(plugins=[provider]) or Worker(plugins=[provider])" + ) + if workflow_id is None: + if run_id is not None: + raise ValueError("run_id needs a workflow_id") + info = context.info() + if info.workflow_id is None: + raise RuntimeError( + "this activity belongs to no workflow, so name the workflow_id to " + "address" + ) + workflow_id, run_id = info.workflow_id, info.workflow_run_id + return provider.get_stream_handle(client(), workflow_id, run_id=run_id) + + def in_activity() -> bool: """Whether the current code is inside an activity. diff --git a/temporalio/worker/_activity.py b/temporalio/worker/_activity.py index ded3047fc..10bf45bd2 100644 --- a/temporalio/worker/_activity.py +++ b/temporalio/worker/_activity.py @@ -33,6 +33,7 @@ import temporalio.common import temporalio.converter import temporalio.exceptions +import temporalio.streams from temporalio.converter import ( StorageDriverActivityInfo, StorageDriverStoreContext, @@ -63,9 +64,11 @@ def __init__( metric_meter: temporalio.common.MetricMeter, client: temporalio.client.Client, encode_headers: bool, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> None: self._bridge_worker = bridge_worker self._task_queue = task_queue + self._stream_provider = stream_provider self._activity_executor = activity_executor self._shared_state_manager = shared_state_manager self._running_activities: dict[bytes, _RunningActivity] = {} @@ -666,6 +669,9 @@ async def _execute_activity( runtime_metric_meter=None if sync_non_threaded else self._metric_meter, client=self._client if not running_activity.sync else None, cancellation_details=running_activity.cancellation_details, + stream_provider=( + self._stream_provider if not running_activity.sync else None + ), ) ) temporalio.activity.logger.debug("Starting activity") diff --git a/temporalio/worker/_worker.py b/temporalio/worker/_worker.py index f4b7eddad..fade69c4d 100644 --- a/temporalio/worker/_worker.py +++ b/temporalio/worker/_worker.py @@ -510,6 +510,7 @@ def _init_from_config(self, client: temporalio.client.Client, config: WorkerConf interceptors=interceptors, metric_meter=self._runtime.metric_meter, client=client, + stream_provider=stream_provider, encode_headers=( client_config["header_codec_behavior"] == HeaderCodecBehavior.CODEC ), From e94d11d713c3592f39bba70aedad5805b2c148ff Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 25 Sep 2026 08:08:47 -0700 Subject: [PATCH 38/51] Added Client.get_stream_handle and the connect keyword. It mirrors `get_workflow_handle`: without a `run_id` the handle follows the execution chain. `ClientConnectConfig` names the same keys `Client.connect` takes, so the keyword has to appear in both or the test comparing them fails. --- temporalio/client/_client.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index 999ad8bba..7cf624242 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -156,6 +156,7 @@ async def connect( grpc_compression: GrpcCompression = GrpcCompression.GZIP, payload_limits: PayloadLimitsConfig = PayloadLimitsConfig(), header_codec_behavior: HeaderCodecBehavior = HeaderCodecBehavior.NO_CODEC, + stream_provider: temporalio.streams.StreamProvider | None = None, ) -> Self: """Connect to a Temporal server. @@ -221,6 +222,11 @@ async def connect( payload_limits: Warning thresholds for outbound payload/memo sizes. Over-threshold fields are logged but still sent. Set a threshold to 0 to disable it. header_codec_behavior: Encoding behavior for headers sent by the client. + stream_provider: Experimental. The stream provider + :py:meth:`get_stream_handle` opens handles from, see + :py:mod:`temporalio.streams`. A provider that is also a + :py:class:`Plugin` sets this itself when passed in ``plugins``, + and workers built from this client inherit it. """ connect_config = temporalio.service.ConnectConfig( target_host=target_host, @@ -257,6 +263,7 @@ def make_lambda( default_workflow_query_reject_condition=default_workflow_query_reject_condition, header_codec_behavior=header_codec_behavior, plugins=plugins, + stream_provider=stream_provider, ) def __init__( @@ -889,6 +896,36 @@ def get_workflow_handle( result_type=result_type, ) + def get_stream_handle( + self, workflow_id: str, *, run_id: str | None = None + ) -> temporalio.streams.StreamHandle: + """Get a handle on a workflow's stream from the provider registered on this client. + + Mirrors :py:meth:`get_workflow_handle`: without ``run_id`` the handle + follows the workflow's execution chain across continue-as-new, with + one it is pinned to that run. The provider is the one registered with + ``plugins=[provider]`` at :py:meth:`connect`, or passed as + ``stream_provider``. See :py:mod:`temporalio.streams`. + + Args: + workflow_id: Workflow ID whose stream to get a handle to. + run_id: Run ID to pin the handle to. + + Returns: + The stream handle. + + Raises: + temporalio.streams.StreamUnsupportedError: No stream provider is + registered on this client. + """ + provider = self._config.get("stream_provider") + if provider is None: + raise temporalio.streams.StreamUnsupportedError( + "no stream provider is registered on this client; connect with " + "plugins=[provider]" + ) + return provider.get_stream_handle(self, workflow_id, run_id=run_id) + def get_workflow_handle_for( self, workflow: ( @@ -3021,6 +3058,7 @@ class ClientConnectConfig(TypedDict, total=False): grpc_compression: GrpcCompression payload_limits: PayloadLimitsConfig header_codec_behavior: HeaderCodecBehavior + stream_provider: temporalio.streams.StreamProvider | None class ClientConfig(TypedDict, total=False): From fe446e646a306923467298d75bc149175845fcdd Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 25 Sep 2026 08:08:47 -0700 Subject: [PATCH 39/51] Moved the conformance cases onto the client accessor. A storage provider registers itself on the client, so its cases go through the accessor an application uses, and a store that lives inside a running workflow gets a host that starts the owning workflow first. --- tests/streams/test_stream_accessors.py | 122 ++++++++++++++++++++++ tests/streams/test_streams_conformance.py | 19 +++- 2 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 tests/streams/test_stream_accessors.py diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py new file mode 100644 index 000000000..eb733ba5b --- /dev/null +++ b/tests/streams/test_stream_accessors.py @@ -0,0 +1,122 @@ +"""The accessors each context asks for its stream, with one registration. + +The provider is registered on the client alone. A worker built from that +client inherits it, an activity on that worker reaches its own workflow's +stream through ``activity.stream_handle()``, and any code holding the client +reaches a stream through ``client.get_stream_handle()``. Without a +registration, both say so with the same error. +""" + +from __future__ import annotations + +import asyncio +import uuid +from datetime import timedelta +from typing import Any + +import pytest + +from temporalio import activity, workflow +from temporalio.client import Client +from temporalio.streams import RecordKind, StreamUnsupportedError, topic +from temporalio.streams.providers.memory import MemoryStreams +from temporalio.testing import ActivityEnvironment, WorkflowEnvironment +from tests.helpers import new_worker + +INPUTS = topic("inputs", dict) +DECISIONS = topic("decisions", dict) + + +@pytest.fixture +def provider(env: WorkflowEnvironment): # pyright: ignore[reportUnusedFunction] + if env.supports_time_skipping: + pytest.skip( + "the memory provider polls on a timer, which time skipping turns into a spin" + ) + streams = MemoryStreams() + yield streams + streams.reset() + + +def _with_provider(client: Client, provider: MemoryStreams) -> Client: + # The same connection, with the provider registered the way an + # application registers it: once, on the client. + config = client.config() + config["plugins"] = [provider] + return Client(**config) + + +@activity.defn +async def emit(count: int) -> str: + # No workflow id and no run id: the handle is this activity's own + # workflow, pinned to its run, and the producer's identity is the + # activity's. + model = activity.stream_handle().producer(topic=INPUTS) + for n in range(count): + await model.append({"n": n}) + await model.finish() + return activity.info().activity_id + + +@workflow.defn +class Echo: + """Runs the emitting activity and echoes what arrives on ``inputs``.""" + + @workflow.run + async def run(self, count: int) -> list[Any]: + inputs = workflow.stream_reader(INPUTS) + decisions = workflow.stream_writer(DECISIONS) + emitting = workflow.start_activity( + emit, count, start_to_close_timeout=timedelta(seconds=30) + ) + seen: list[Any] = [] + async for record in inputs: + if record.kind is RecordKind.FINISH: + seen.append(("finish", record.producer_id)) + break + assert record.value is not None + seen.append(record.value["n"]) + decisions.publish({"echo": record.value["n"]}) + decisions.finish() + producer_id = await emitting + return [*seen, ("activity", producer_id)] + + +async def test_one_registration_on_the_client_serves_every_context( + client: Client, provider: MemoryStreams +): + registered = _with_provider(client, provider) + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + # No plugins on the worker: it inherits the client's provider. + async with new_worker(registered, Echo, activities=[emit]) as worker: + handle = await registered.start_workflow( + Echo.run, 2, id=workflow_id, task_queue=worker.task_queue + ) + result = await handle.result() + # The activity wrote as itself onto its own workflow's topic. + assert result[:2] == [0, 1] + assert result[2] == ["finish", result[3][1]] + + stream = registered.get_stream_handle(workflow_id) + + async def read_everything() -> list[Any]: + return [(r.kind, r.value) async for r in stream.read(topic=DECISIONS)] + + assert await asyncio.wait_for(read_everything(), 30) == [ + (RecordKind.DATA, {"echo": 0}), + (RecordKind.DATA, {"echo": 1}), + (RecordKind.FINISH, None), + ] + + +async def test_get_stream_handle_needs_a_registered_provider(client: Client): + with pytest.raises(StreamUnsupportedError, match="plugins="): + client.get_stream_handle("wf") + + +async def test_stream_handle_needs_a_provider_on_the_worker(): + async def ask() -> None: + activity.stream_handle() + + with pytest.raises(StreamUnsupportedError, match="plugins="): + await ActivityEnvironment().run(ask) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index a9dcae815..9002ea16a 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -5,9 +5,11 @@ store. A storage provider adds itself to ``SETUPS``, behind its own ``STREAMS_LIVE`` gate when it needs a store the test environment does not start: its setup receives the environment's client and hands back a provider -instance and which capabilities it lacks, so the cases marked -``reports_positions`` are skipped with a reason on a provider whose -``append()`` learns positions at read time. +instance, the client the cases should use, a ``host`` that starts the +workflow owning a stream when the store lives inside a running workflow, and +which capabilities it lacks, so the cases marked ``reports_positions`` are +skipped with a reason on a provider whose ``append()`` learns positions at +read time. What this file pins down is the contract: the record on the wire, producer identity, retry deduplication, positions, supersession, topic addressing, @@ -20,7 +22,7 @@ import asyncio import uuid -from collections.abc import AsyncIterator, Callable +from collections.abc import AsyncIterator, Awaitable, Callable from dataclasses import dataclass from typing import Any @@ -60,12 +62,21 @@ class ProviderCase: name: str provider: StreamProvider + client: Client | None = None reports_positions: bool = True """``append()`` returns where the records landed.""" + host: Callable[[str], Awaitable[None]] | None = None + """Starts the workflow that owns ``workflow_id``'s stream, when a store needs one.""" async def open( self, workflow_id: str, *, run_id: str | None = None ) -> StreamHandle: + if self.host is not None: + await self.host(workflow_id) + if self.client is not None: + # A storage provider's setup registers the provider on the client, + # so the cases go through the accessor an application uses. + return self.client.get_stream_handle(workflow_id, run_id=run_id) # Only the memory provider gets here, and it takes no client. return self.provider.get_stream_handle( None, # type: ignore[arg-type] From 717f58b42e6fe554f67833bc0f314977db39955f Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 25 Sep 2026 08:08:47 -0700 Subject: [PATCH 40/51] Added the streams demo and the changelog entry. The demo registers one provider on the client and shows each context asking for its stream: the workflow reads and publishes, the activity produces onto a topic, and the outside reader follows from the client. --- CHANGELOG.md | 13 +++ streams_demo/agent_loop.py | 110 +++++++++++++++++++++ streams_demo/provider_setup.py | 36 +++++++ streams_demo/run_demo.py | 172 +++++++++++++++++++++++++++++++++ 4 files changed, 331 insertions(+) create mode 100644 streams_demo/agent_loop.py create mode 100644 streams_demo/provider_setup.py create mode 100644 streams_demo/run_demo.py diff --git a/CHANGELOG.md b/CHANGELOG.md index f016f34ff..c74bdf72a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,19 @@ to include examples, links to docs, or any other relevant information. ### Added - Added the `temporalio.contrib.gcp.cloud_run.id` module with the `CloudRunIdPlugin` client plugin to set the worker identity on Cloud Run. +- **Experimental**: `temporalio.streams` defines one stream interface a workflow + can read, decide on, and write. A provider is registered once as a plugin, + `Client.connect(plugins=[provider])`, and workers built from that client + inherit it; each context then asks for its stream the same way: + `workflow.stream_reader()` and `workflow.stream_writer()` in workflow code, + `activity.stream_handle()` in an activity, and `client.get_stream_handle()` + anywhere a client is held. A topic is a typed definition, + `streams.topic("inputs", Token)`, shared by workflow, activity and client + code; a plain string names a topic decided at runtime. The record on the wire + is `temporal.api.stream.v1.StreamRecord` on every provider. + `temporalio.streams.providers.memory.MemoryStreams` is the in-memory + reference provider the conformance tests run against. + ### Changed ### Deprecated diff --git a/streams_demo/agent_loop.py b/streams_demo/agent_loop.py new file mode 100644 index 000000000..df5eac4d6 --- /dev/null +++ b/streams_demo/agent_loop.py @@ -0,0 +1,110 @@ +"""One agent loop, written once, run on every stream provider. + +Reads input, decides on it, publishes the decision, and runs an ordinary +Activity in the same workflow task; the Activity reports on its own +workflow's stream in turn. Also handles the two control records the contract +defines, so a retried producer and a finished topic are exercised rather than +described. + +This file is byte-identical in the server-side tree and the client-side tree. +Nothing in it names a provider: the workflow asks its runtime, the Activity +asks its context, and the process that runs them registered the provider once. +""" + +from __future__ import annotations + +from datetime import timedelta +from typing import Any + +from temporalio import activity, streams, workflow +from temporalio.streams import RecordKind + +# Defined once and shared by the workflow, the Activity and the demo's +# reader, so the type each topic carries is stated in one place. +DECISIONS = streams.topic("decisions", dict[str, Any]) +INPUTS = streams.topic("inputs", dict[str, Any]) +RECEIPTS = streams.topic("receipts", dict[str, Any]) + + +@activity.defn(name="RecordDecision") +async def record_decision(decision: dict[str, Any]) -> str: + """An ordinary command in the same task as the publish. + + Appends its receipt onto its own workflow's stream too, under the + Activity's own identity, so a reader outside sees the decision and the + record of it side by side. + """ + receipt = f"recorded:{decision['source']}:{decision['branch']}" + await activity.stream_handle().producer(topic=RECEIPTS).append({"receipt": receipt}) + return receipt + + +def decide(token: dict[str, Any]) -> dict[str, Any]: + """The decision the workflow is here to make.""" + if token["value"] % 2 == 0: + return { + "source": token["id"], + "branch": "even", + "computed": token["value"] * 10, + } + return {"source": token["id"], "branch": "odd", "computed": token["value"] + 100} + + +@workflow.defn(name="StreamContractDemo", sandboxed=False) +class AgentLoop: + """Read, decide, write, until the producer says it has finished.""" + + @workflow.run + async def run(self, limit: int) -> list[dict[str, Any]]: + """Decide on at most ``limit`` inputs, then return the trace.""" + inputs = workflow.stream_reader(INPUTS) + decisions = workflow.stream_writer(DECISIONS) + trace: list[dict[str, Any]] = [] + accepted = 0 + try: + async for record in inputs: + if record.kind is RecordKind.SUPERSEDED: + # A newer attempt of the same producer started writing. The + # decisions already published stand, so the workflow says so + # rather than pretending they can be withdrawn. + assert record.supersession is not None + trace.append( + { + "kind": "superseded", + "producer": record.producer_id, + "replaced": record.supersession.previous_attempt, + "attempt": record.supersession.attempt, + } + ) + decisions.publish( + {"retracting_attempt": record.supersession.previous_attempt} + ) + continue + if record.kind is RecordKind.FINISH: + # The producer says it is done, which is what ends the loop. + # Counting decisions instead would leave the terminal record + # unread and let the workflow finish while its producer is + # still writing. + trace.append({"kind": "finish", "producer": record.producer_id}) + break + assert record.value is not None + decision = decide(record.value) + decisions.publish(decision) + receipt = await workflow.execute_activity( + record_decision, + decision, + activity_id=f"decision-{decision['source']}", + start_to_close_timeout=timedelta(seconds=10), + ) + trace.append( + {"kind": "decision", "value": decision, "receipt": receipt} + ) + accepted += 1 + if accepted >= limit: + # A bound so a stuck producer cannot run this forever. The + # terminal record above is the ordinary way out. + break + finally: + inputs.close() + decisions.finish() + return trace diff --git a/streams_demo/provider_setup.py b/streams_demo/provider_setup.py new file mode 100644 index 000000000..2e4bcc350 --- /dev/null +++ b/streams_demo/provider_setup.py @@ -0,0 +1,36 @@ +"""Pick the provider for a demo run from the environment. + +``STREAMS_PROVIDER`` names a provider; this base tree carries only ``memory``, +and each provider branch adds its own name here. The demo needs a Temporal +server to run the workflow either way; ``TEMPORAL_ADDRESS`` points at it. +""" + +from __future__ import annotations + +import os + +from temporalio.streams.providers import ProviderPlugin +from temporalio.streams.providers.memory import MemoryStreams + +NAME = os.environ.get("STREAMS_PROVIDER", "memory") + +# The memory provider is not replay-safe, so its demo keeps the cache warm. +# Storage providers run with the smallest cache they support instead. +WORKFLOW_CACHE = int(os.environ.get("STREAMS_WORKFLOW_CACHE", "512")) + + +async def open() -> tuple[str, ProviderPlugin]: + """The server to connect to and the provider the worker and the client share.""" + if NAME != "memory": + raise SystemExit(f"this tree carries no stream provider named {NAME!r}") + return os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"), MemoryStreams() + + +async def close(provider: ProviderPlugin) -> None: + """Let go of whatever :func:`open` acquired. + + The memory provider holds no connection, so this is its ``close()`` and + nothing more. A provider branch that opens one closes it the same way, so + the demo's teardown reads the same on every provider. + """ + await provider.close() diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py new file mode 100644 index 000000000..e91bf2e31 --- /dev/null +++ b/streams_demo/run_demo.py @@ -0,0 +1,172 @@ +"""Run the shared agent loop against whichever provider is configured. + +Three cases, the same on every provider: + +- read, decide, publish and an ordinary Activity in the same workflow task, + with the smallest workflow cache the provider supports, so that as much of + the run as it allows is rebuilt rather than remembered; +- a producer whose second attempt supersedes its first, which the reader has + to report and the workflow has to act on; +- an outside reader following what the workflow published, and the receipts + the Activity appended on the workflow's stream from inside its own context. + +The provider is registered once, on the client; the worker inherits it and +every context asks for its stream without naming it. Byte-identical in every +tree. ``provider_setup`` is what differs, and it is the only import here that +names a provider. +""" + +from __future__ import annotations + +import asyncio +import json +import sys +import time +import uuid +from pathlib import Path +from typing import Any + +from temporalio.api.enums.v1 import EventType +from temporalio.client import Client +from temporalio.streams import RecordKind, StreamHandle +from temporalio.worker import Worker + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import provider_setup # noqa: E402 +from agent_loop import ( # noqa: E402 + DECISIONS, + INPUTS, + RECEIPTS, + AgentLoop, + record_decision, +) + +DECISION_LIMIT = 8 +EXPECTED_OUTPUT = 6 + + +async def collect_output(stream: StreamHandle, want: int) -> list[dict]: + """Read ``want`` decisions off the workflow's stream from outside it.""" + seen: list[dict] = [] + async for record in stream.read(topic=DECISIONS): + seen.append({"kind": record.kind.name, "value": record.value}) + if len(seen) >= want: + break + return seen + + +async def main() -> int: + """Run the demo once and write what happened next to this file.""" + out = Path(__file__).resolve().parent / f"results-{provider_setup.NAME}" + out.mkdir(exist_ok=True) + target, provider = await provider_setup.open() + client = await Client.connect(target, namespace="default", plugins=[provider]) + + uid = f"ai198-contract-{provider_setup.NAME}-" + uuid.uuid4().hex + record: dict[str, Any] = { + "provider": provider_setup.NAME, + "workflow_id": uid, + "target": target, + "max_cached_workflows": provider_setup.WORKFLOW_CACHE, + } + + async with Worker( + client, + task_queue=uid, + workflows=[AgentLoop], + activities=[record_decision], + max_cached_workflows=provider_setup.WORKFLOW_CACHE, + ): + handle = await client.start_workflow( + AgentLoop.run, DECISION_LIMIT, id=uid, task_queue=uid + ) + stream = client.get_stream_handle(uid) + output = asyncio.create_task(collect_output(stream, EXPECTED_OUTPUT)) + + # The first attempt writes two records and then stops, as a failed + # activity would. The second writes different inputs under the same + # logical producer, which is what the reader has to report. + first = stream.producer(topic=INPUTS, producer_id="model", attempt=1) + await first.append({"id": "r1", "value": 1}, {"id": "r2", "value": 2}) + await asyncio.sleep(0.5) + second = stream.producer(topic=INPUTS, producer_id="model", attempt=2) + await second.append({"id": "r3", "value": 3}, {"id": "r4", "value": 4}) + await second.finish() + + # A failed Workflow Task is not an outcome. The server rejects a + # completion that raced newly buffered events, and the retry usually + # gets through, so reading the first failure as the result reports a + # working run as a broken one. Wait for a terminal event, then report + # the retries separately so they are neither the headline nor hidden. + deadline = time.monotonic() + 120 + # Taken from the enum rather than written out, because guessing these + # numbers is how a run that completed gets reported as terminated. + terminal = { + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: "completed", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED: "workflow_failed", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT: "execution_timed_out", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED: "canceled", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED: "terminated", + EventType.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW: "continued_as_new", + } + while time.monotonic() < deadline: + history = await handle.fetch_history() + reached = [ + terminal[e.event_type] + for e in history.events + if e.event_type in terminal + ] + if reached: + record["outcome"] = reached[-1] + if record["outcome"] == "completed": + record["trace"] = await handle.result() + break + await asyncio.sleep(0.1) + else: + record["outcome"] = "timed_out_waiting" + history = await handle.fetch_history() + + retried = [ + e + for e in history.events + if e.event_type == EventType.EVENT_TYPE_WORKFLOW_TASK_FAILED + ] + record["task_failures"] = [ + { + "event_id": e.event_id, + "cause": int(e.workflow_task_failed_event_attributes.cause), + "message": e.workflow_task_failed_event_attributes.failure.message, + } + for e in retried + ] + + try: + record["observed_output"] = await asyncio.wait_for(output, timeout=20) + except asyncio.TimeoutError: + output.cancel() + record["observed_output"] = "timed_out" + + async def receipts() -> list[Any]: + # Ends by itself once the workflow is closed and the tail served. + return [ + r.value + async for r in stream.read(topic=RECEIPTS) + if r.kind is RecordKind.DATA + ] + + try: + record["receipts"] = await asyncio.wait_for(receipts(), timeout=20) + except asyncio.TimeoutError: + record["receipts"] = "timed_out" + + history = await handle.fetch_history() + record["history_events"] = len(history.events) + (out / "history.json").write_text(history.to_json()) + await provider_setup.close(provider) + (out / "results.json").write_text(json.dumps(record, indent=2) + "\n") + print(json.dumps(record, indent=2)) + return 0 if record["outcome"] == "completed" else 1 + + +if __name__ == "__main__": + sys.exit(asyncio.run(main())) From fc9216182599acc3f6aaca4425443b9759476bad Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 25 Sep 2026 13:50:57 -0700 Subject: [PATCH 41/51] Told a sync activity what it is actually missing. A def activity is handed no client and no provider, so reporting the provider sent the reader to register one that was already there. --- temporalio/activity.py | 17 ++++++++-- temporalio/worker/_activity.py | 2 ++ tests/streams/test_stream_accessors.py | 44 ++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/temporalio/activity.py b/temporalio/activity.py index 33f3a90eb..09e3040fa 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -211,6 +211,9 @@ class _Context: client: Client | None cancellation_details: _ActivityCancellationDetailsHolder stream_provider: temporalio.streams.StreamProvider | None = None + # A ``def`` activity is handed no client and no stream provider, so what + # it is missing cannot be read off the fields that are absent. + sync: bool = False _logger_details: Mapping[str, Any] | None = None _payload_converter: temporalio.converter.PayloadConverter | None = None _metric_meter: temporalio.common.MetricMeter | None = None @@ -319,14 +322,24 @@ def stream_handle( activity. Raises: + RuntimeError: When the client is not available, which is what a + ``def`` activity gets, or when the activity has no workflow and + no ``workflow_id`` was given. temporalio.streams.StreamUnsupportedError: The worker has no stream provider. Register one with ``Client.connect(plugins=[provider])`` or ``Worker(plugins=[provider])``. - RuntimeError: When the client is not available, or when the activity - has no workflow and no ``workflow_id`` was given. ValueError: ``run_id`` was given without ``workflow_id``. """ context = _Context.current() + if context.sync: + # A sync activity is handed neither a client nor a provider. Saying + # the worker has none would send the reader to fix a registration + # that is not the problem. + raise RuntimeError( + "No stream handle available. Stream handles are only available in " + "`async def` activities; not in `def` activities, which are handed no " + "client to reach the store with." + ) provider = context.stream_provider if provider is None: raise temporalio.streams.StreamUnsupportedError( diff --git a/temporalio/worker/_activity.py b/temporalio/worker/_activity.py index 10bf45bd2..9b06f91ab 100644 --- a/temporalio/worker/_activity.py +++ b/temporalio/worker/_activity.py @@ -672,6 +672,7 @@ async def _execute_activity( stream_provider=( self._stream_provider if not running_activity.sync else None ), + sync=running_activity.sync, ) ) temporalio.activity.logger.debug("Starting activity") @@ -948,6 +949,7 @@ def heartbeat_fn(*details: Any) -> None: runtime_metric_meter=runtime_metric_meter, client=None, cancellation_details=cancellation_details, + sync=True, ) ) if not cancel_thread_raiser: diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py index eb733ba5b..1c6af098e 100644 --- a/tests/streams/test_stream_accessors.py +++ b/tests/streams/test_stream_accessors.py @@ -11,6 +11,7 @@ import asyncio import uuid +from concurrent.futures import ThreadPoolExecutor from datetime import timedelta from typing import Any @@ -120,3 +121,46 @@ async def ask() -> None: with pytest.raises(StreamUnsupportedError, match="plugins="): await ActivityEnvironment().run(ask) + + +@activity.defn +def ask_from_a_sync_activity() -> str: + try: + activity.stream_handle() + except RuntimeError as error: + return str(error) + return "opened" + + +@workflow.defn +class RunsASyncActivity: + """Runs the `def` activity that reaches for a handle.""" + + @workflow.run + async def run(self) -> str: + return await workflow.execute_activity( + ask_from_a_sync_activity, start_to_close_timeout=timedelta(seconds=30) + ) + + +async def test_a_sync_activity_is_told_it_cannot_have_a_handle( + client: Client, provider: MemoryStreams +): + # The worker has a provider. What a `def` activity is missing is the + # client, so that is what the error has to say, rather than sending the + # reader to register a provider that is already there. + registered = _with_provider(client, provider) + with ThreadPoolExecutor(max_workers=1) as executor: + async with new_worker( + registered, + RunsASyncActivity, + activities=[ask_from_a_sync_activity], + activity_executor=executor, + ) as worker: + result = await registered.execute_workflow( + RunsASyncActivity.run, + id=f"streams-wf-{uuid.uuid4().hex}", + task_queue=worker.task_queue, + ) + assert "only available in `async def` activities" in result + assert "plugins=" not in result From e57bd027a8f7ba6165eafd3a2525212da128b791 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Fri, 25 Sep 2026 13:50:57 -0700 Subject: [PATCH 42/51] Put the streams demo under the type checkers. The demo sat outside pyright's include, so two of the configured checkers never saw it. --- pyproject.toml | 2 +- streams_demo/run_demo.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b7077785f..c9bdf9923 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -267,7 +267,7 @@ reportUnnecessaryIsInstance = "none" reportUnnecessaryTypeIgnoreComment = "none" reportUnusedCallResult = "none" reportUnknownLambdaType = "none" -include = ["temporalio", "tests"] +include = ["temporalio", "tests", "streams_demo"] exclude = [ # Exclude auto generated files "temporalio/api", diff --git a/streams_demo/run_demo.py b/streams_demo/run_demo.py index e91bf2e31..769d7bf18 100644 --- a/streams_demo/run_demo.py +++ b/streams_demo/run_demo.py @@ -31,9 +31,11 @@ from temporalio.streams import RecordKind, StreamHandle from temporalio.worker import Worker +# Run as a script rather than imported as a module, so the two siblings are +# reached by name off this directory rather than through a package path. sys.path.insert(0, str(Path(__file__).resolve().parent)) -import provider_setup # noqa: E402 -from agent_loop import ( # noqa: E402 +import provider_setup # noqa: E402 # pyright: ignore[reportImplicitRelativeImport] +from agent_loop import ( # noqa: E402 # pyright: ignore[reportImplicitRelativeImport] DECISIONS, INPUTS, RECEIPTS, From 1466028b344253cc88b9c1af5d90199198cf595e Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 28 Sep 2026 14:47:39 -0700 Subject: [PATCH 43/51] Documented the default topic on the stream accessors. Handles from client.get_stream_handle() and activity.stream_handle() reach the same default topic as the workflow side, so the accessor docs and the changelog say so and a test pins it across all three contexts. --- CHANGELOG.md | 4 +- temporalio/activity.py | 7 +++- temporalio/client/_client.py | 5 ++- tests/streams/test_stream_accessors.py | 51 +++++++++++++++++++++++++- 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77db8e269..dfd1c61df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,9 @@ to include examples, links to docs, or any other relevant information. `activity.stream_handle()` in an activity, and `client.get_stream_handle()` anywhere a client is held. A topic is a typed definition, `streams.topic("inputs", Token)`, shared by workflow, activity and client - code; a plain string names a topic decided at runtime. The record on the wire + code; a plain string names a topic decided at runtime, and a call that names + no topic addresses the default topic, `streams.DEFAULT_TOPIC` (`"output"`, + the server's default stream name). The record on the wire is `temporal.api.stream.v1.StreamRecord` on every provider. `temporalio.streams.providers.memory.MemoryStreams` is the in-memory reference provider the conformance tests run against. diff --git a/temporalio/activity.py b/temporalio/activity.py index 4dec55248..7315c661b 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -308,7 +308,12 @@ def stream_handle( the run the activity belongs to, so a producer opened from it writes onto that run's stream and a read follows that run. Name a ``workflow_id`` to address another workflow; ``run_id`` then pins the handle to one run and - its absence follows the execution chain. See :py:mod:`temporalio.streams`. + its absence follows the execution chain. A ``read``, ``latest`` or + ``producer`` that names no topic addresses the workflow's default topic, + :py:data:`temporalio.streams.DEFAULT_TOPIC`, the one + :py:func:`temporalio.workflow.stream_reader` and + :py:func:`temporalio.workflow.stream_writer` use without a topic. See + :py:mod:`temporalio.streams`. Like :py:func:`client`, this is only available in ``async def`` activities. diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index 7cf624242..33fcedf14 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -905,7 +905,10 @@ def get_stream_handle( follows the workflow's execution chain across continue-as-new, with one it is pinned to that run. The provider is the one registered with ``plugins=[provider]`` at :py:meth:`connect`, or passed as - ``stream_provider``. See :py:mod:`temporalio.streams`. + ``stream_provider``. The handle's ``read``, ``latest`` and + ``producer`` take a topic, and without one address the workflow's + default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`. See + :py:mod:`temporalio.streams`. Args: workflow_id: Workflow ID whose stream to get a handle to. diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py index 1c6af098e..f25381406 100644 --- a/tests/streams/test_stream_accessors.py +++ b/tests/streams/test_stream_accessors.py @@ -19,7 +19,13 @@ from temporalio import activity, workflow from temporalio.client import Client -from temporalio.streams import RecordKind, StreamUnsupportedError, topic +from temporalio.streams import ( + BEGINNING, + DEFAULT_TOPIC, + RecordKind, + StreamUnsupportedError, + topic, +) from temporalio.streams.providers.memory import MemoryStreams from temporalio.testing import ActivityEnvironment, WorkflowEnvironment from tests.helpers import new_worker @@ -110,6 +116,49 @@ async def read_everything() -> list[Any]: ] +@activity.defn +async def emit_on_the_default_topic() -> None: + await activity.stream_handle().producer().append({"from": "activity"}) + + +@workflow.defn +class Answers: + """Waits for the activity's record on the default topic and answers there.""" + + @workflow.run + async def run(self) -> None: + reader = workflow.stream_reader(result_type=dict) + await workflow.execute_activity( + emit_on_the_default_topic, start_to_close_timeout=timedelta(seconds=30) + ) + async for value in reader.values(): + workflow.stream_writer().publish({"answer": value["from"]}) + reader.close() + + +async def test_every_accessor_defaults_to_the_same_topic( + client: Client, provider: MemoryStreams +): + registered = _with_provider(client, provider) + workflow_id = f"streams-wf-{uuid.uuid4().hex}" + async with new_worker( + registered, Answers, activities=[emit_on_the_default_topic] + ) as worker: + stream = registered.get_stream_handle(workflow_id) + assert await stream.latest() == BEGINNING + await registered.execute_workflow( + Answers.run, id=workflow_id, task_queue=worker.task_queue + ) + + async def read_everything() -> list[Any]: + return [(r.topic, r.value) async for r in stream.read()] + + assert await asyncio.wait_for(read_everything(), 30) == [ + (DEFAULT_TOPIC, {"from": "activity"}), + (DEFAULT_TOPIC, {"answer": "activity"}), + ] + + async def test_get_stream_handle_needs_a_registered_provider(client: Client): with pytest.raises(StreamUnsupportedError, match="plugins="): client.get_stream_handle("wf") From 92c4b8c24c1ca00c854538ebf44cd25b71d3b4b2 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 28 Sep 2026 15:55:53 -0700 Subject: [PATCH 44/51] Let activities own streams and resolve stream_handle() by a static rule. A standalone activity now reaches its own stream, which used to raise, and scope="activity" gives a workflow's activity its own streams without changing what a bare call reaches. The rule never probes, because a stream is created by its first write and probing would split attempts across two streams. --- temporalio/activity.py | 89 ++++++++++++++++++------ temporalio/client/_client.py | 33 ++++++--- temporalio/streams/__init__.py | 9 ++- temporalio/streams/_provider.py | 32 ++++++++- temporalio/streams/providers/memory.py | 93 ++++++++++++++++++++++---- 5 files changed, 209 insertions(+), 47 deletions(-) diff --git a/temporalio/activity.py b/temporalio/activity.py index 7315c661b..f790c9bc2 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -20,6 +20,7 @@ from typing import ( TYPE_CHECKING, Any, + Literal, NoReturn, overload, ) @@ -300,36 +301,62 @@ def client() -> Client: def stream_handle( - workflow_id: str | None = None, *, run_id: str | None = None + workflow_id: str | None = None, + *, + run_id: str | None = None, + scope: Literal["workflow", "activity"] | None = None, ) -> temporalio.streams.StreamHandle: """Return a stream handle from the provider the worker was given. - With no arguments the handle is on this activity's own workflow, pinned to - the run the activity belongs to, so a producer opened from it writes onto - that run's stream and a read follows that run. Name a ``workflow_id`` to - address another workflow; ``run_id`` then pins the handle to one run and - its absence follows the execution chain. A ``read``, ``latest`` or - ``producer`` that names no topic addresses the workflow's default topic, - :py:data:`temporalio.streams.DEFAULT_TOPIC`, the one - :py:func:`temporalio.workflow.stream_reader` and + Which stream a call with no ``workflow_id`` reaches is decided by where + the activity runs, never by what exists: + + - In an activity a workflow scheduled, it is that workflow's stream, + pinned to the run the activity belongs to. + - In a standalone activity, it is the activity's own stream. + - ``scope="activity"`` gives an activity a workflow scheduled its own + streams instead, apart from the workflow's. ``scope="workflow"`` asks + for the workflow explicitly, and a standalone activity has none. + + The rule is static because a stream is created by its first write, so a + rule that looked for one would send attempt 1 to the workflow and a retry + to the stream attempt 1 created. An activity's own streams are one per + activity execution, not per attempt: a retry writes to the same stream, + under a new attempt, and they end when the activity reaches a terminal + status. + + Name a ``workflow_id`` to address another workflow; ``run_id`` then pins + the handle to one run and its absence follows the execution chain. A + ``read``, ``latest`` or ``producer`` that names no topic addresses the + owner's default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`, the + one :py:func:`temporalio.workflow.stream_reader` and :py:func:`temporalio.workflow.stream_writer` use without a topic. See :py:mod:`temporalio.streams`. Like :py:func:`client`, this is only available in ``async def`` activities. + Args: + workflow_id: Another workflow whose stream to address. + run_id: The run of ``workflow_id`` to pin to. + scope: ``"activity"`` for this activity's own streams, + ``"workflow"`` for its workflow's. Without it the rule above + decides. + Returns: :py:class:`temporalio.streams.StreamHandle` for use in the current activity. Raises: RuntimeError: When the client is not available, which is what a - ``def`` activity gets, or when the activity has no workflow and - no ``workflow_id`` was given. + ``def`` activity gets, or when ``scope="workflow"`` is asked of + an activity that belongs to no workflow. temporalio.streams.StreamUnsupportedError: The worker has no stream - provider. Register one with ``Client.connect(plugins=[provider])`` - or ``Worker(plugins=[provider])``. - ValueError: ``run_id`` was given without ``workflow_id``. + provider, or its provider cannot hold a stream an activity owns. + Register one with ``Client.connect(plugins=[provider])`` or + ``Worker(plugins=[provider])``. + ValueError: ``run_id`` was given without ``workflow_id``, or + ``scope="activity"`` with one. """ context = _Context.current() if context.sync: @@ -347,17 +374,37 @@ def stream_handle( "no stream provider is configured on this worker; register one with " "Client.connect(plugins=[provider]) or Worker(plugins=[provider])" ) - if workflow_id is None: - if run_id is not None: - raise ValueError("run_id needs a workflow_id") - info = context.info() + if workflow_id is not None: + if scope == "activity": + raise ValueError( + "scope='activity' addresses this activity's own streams, so it takes " + "no workflow_id" + ) + return provider.get_stream_handle(client(), workflow_id, run_id=run_id) + if run_id is not None: + raise ValueError("run_id needs a workflow_id") + info = context.info() + if scope is None: + scope = "workflow" if info.in_workflow else "activity" + if scope == "workflow": if info.workflow_id is None: raise RuntimeError( "this activity belongs to no workflow, so name the workflow_id to " - "address" + "address, or leave scope unset for the activity's own streams" ) - workflow_id, run_id = info.workflow_id, info.workflow_run_id - return provider.get_stream_handle(client(), workflow_id, run_id=run_id) + return provider.get_stream_handle( + client(), info.workflow_id, run_id=info.workflow_run_id + ) + if info.workflow_id is not None: + return provider.get_activity_stream_handle( + client(), + info.activity_id, + workflow_id=info.workflow_id, + run_id=info.workflow_run_id, + ) + return provider.get_activity_stream_handle( + client(), info.activity_id, run_id=info.activity_run_id + ) def in_activity() -> bool: diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index 33fcedf14..c6e6fa241 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -897,29 +897,40 @@ def get_workflow_handle( ) def get_stream_handle( - self, workflow_id: str, *, run_id: str | None = None + self, + workflow_id: str | None = None, + *, + run_id: str | None = None, + activity_id: str | None = None, ) -> temporalio.streams.StreamHandle: - """Get a handle on a workflow's stream from the provider registered on this client. + """Get a handle on a workflow's or an activity's stream from the provider registered on this client. Mirrors :py:meth:`get_workflow_handle`: without ``run_id`` the handle follows the workflow's execution chain across continue-as-new, with - one it is pinned to that run. The provider is the one registered with - ``plugins=[provider]`` at :py:meth:`connect`, or passed as - ``stream_provider``. The handle's ``read``, ``latest`` and - ``producer`` take a topic, and without one address the workflow's + one it is pinned to that run. With ``activity_id`` the handle is on + the streams that activity owns: a standalone activity's when + ``workflow_id`` is left out, and ``run_id`` then pins the activity's + run, or an activity that ``workflow_id`` scheduled. The provider is + the one registered with ``plugins=[provider]`` at :py:meth:`connect`, + or passed as ``stream_provider``. The handle's ``read``, ``latest`` + and ``producer`` take a topic, and without one address the owner's default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`. See :py:mod:`temporalio.streams`. Args: - workflow_id: Workflow ID whose stream to get a handle to. + workflow_id: Workflow ID whose stream to get a handle to, or the + workflow that scheduled ``activity_id``. run_id: Run ID to pin the handle to. + activity_id: Activity ID whose own streams to get a handle to. Returns: The stream handle. Raises: + ValueError: Neither ``workflow_id`` nor ``activity_id`` was given. temporalio.streams.StreamUnsupportedError: No stream provider is - registered on this client. + registered on this client, or it cannot hold a stream an + activity owns. """ provider = self._config.get("stream_provider") if provider is None: @@ -927,6 +938,12 @@ def get_stream_handle( "no stream provider is registered on this client; connect with " "plugins=[provider]" ) + if activity_id is not None: + return provider.get_activity_stream_handle( + self, activity_id, workflow_id=workflow_id, run_id=run_id + ) + if workflow_id is None: + raise ValueError("name the workflow_id or the activity_id to address") return provider.get_stream_handle(self, workflow_id, run_id=run_id) def get_workflow_handle_for( diff --git a/temporalio/streams/__init__.py b/temporalio/streams/__init__.py index fbb32e3fa..1eed3e0df 100644 --- a/temporalio/streams/__init__.py +++ b/temporalio/streams/__init__.py @@ -43,10 +43,13 @@ registers it on a worker alone. Each context then asks for its stream the same way. Workflow code uses :func:`temporalio.workflow.stream_reader` and :func:`temporalio.workflow.stream_writer`. An activity uses -:func:`temporalio.activity.stream_handle`, which is its own workflow pinned -to its run unless told otherwise. Any process holding a client uses +:func:`temporalio.activity.stream_handle`: an activity a workflow scheduled +reaches that workflow's stream pinned to its run, a standalone activity +reaches its own, and ``scope="activity"`` gives the first kind its own +streams too. Any process holding a client uses :meth:`temporalio.client.Client.get_stream_handle`, which mirrors -``get_workflow_handle``. The explicit form, +``get_workflow_handle`` and takes an ``activity_id`` for an activity's +streams. The explicit form, ``provider.get_stream_handle(client, workflow_id)``, stays for a process that talks to two stores. This module keeps the shared types, the errors and the protocols a provider implements; nothing here that workflow code imports does diff --git a/temporalio/streams/_provider.py b/temporalio/streams/_provider.py index e14b9faeb..6ad41a5bb 100644 --- a/temporalio/streams/_provider.py +++ b/temporalio/streams/_provider.py @@ -91,10 +91,11 @@ async def finish(self) -> None: class StreamHandle(Protocol): - """One workflow's stream, addressed by topic, from outside workflow code. + """One owner's stream, addressed by topic, from outside workflow code. - A handle follows the workflow's execution chain unless it was opened with - a ``run_id``, in which case it is pinned to that run. A topic is a + The owner is a workflow or an activity. A handle on a workflow follows + its execution chain unless it was opened with a ``run_id``, in which case + it is pinned to that run. A topic is a :class:`temporalio.streams.StreamTopic` definition, which carries the record type, or a plain string with ``result_type=`` for a name decided at runtime. A transport failure surfaces as @@ -292,6 +293,31 @@ def get_stream_handle( """ ... + def get_activity_stream_handle( + self, + client: Client, + activity_id: str, + *, + workflow_id: str | None = None, + run_id: str | None = None, + ) -> StreamHandle: + """A handle on the streams an activity owns. + + Without ``workflow_id`` the activity is a standalone one, an execution + of its own, and ``run_id`` pins one run of it. With ``workflow_id`` it + is an activity that workflow scheduled, and ``run_id`` pins the + workflow's run. Either way these streams are apart from any + workflow's: a topic here and the same topic on the workflow's handle + are two streams. A retry of the activity writes to the same streams, + and a read ends when the activity reaches a terminal status, not when + an attempt fails. + + Raises: + StreamUnsupportedError: The provider's store cannot hold a stream + an activity owns. + """ + ... + async def close(self) -> None: """Release what this provider holds for the process. diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index d139cfb51..98a76fd25 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -15,6 +15,12 @@ handle only decides which run's close ends a read. - It learns that a workflow closed by describing it, so a handle opened without a client reads until the caller closes it. +- An activity's own streams are keyed by the activity, not by its run. A + standalone activity's read ends when describing it shows a terminal + status. A workflow's activity is described through its workflow: the read + ends once the activity has been seen pending and is no longer, or the + workflow closed, so a read opened after the activity already finished + waits for the workflow. The outside surface (producer identity, retry deduplication, positions, supersession, cursors) is faithful, which is what the conformance tests lean @@ -35,7 +41,7 @@ import temporalio.converter from temporalio import workflow -from temporalio.client import Client, WorkflowExecutionStatus +from temporalio.client import ActivityExecutionStatus, Client, WorkflowExecutionStatus from temporalio.service import RPCError, RPCStatusCode from temporalio.streams._errors import StreamCursorError, StreamProducerError from temporalio.streams._ids import topic_key @@ -314,20 +320,28 @@ def _write(self, wires: list[WireRecord]) -> Cursor: class MemoryStreamHandle: - """One workflow's stream from outside, with the shared reader rules.""" + """One owner's stream from outside, with the shared reader rules. + + The owner is ``workflow_id``'s workflow, or with ``activity_id`` an + activity: a standalone one without ``workflow_id``, or one that workflow + scheduled. + """ def __init__( self, streams: MemoryStreams, client: Client | None, - workflow_id: str, + workflow_id: str | None, run_id: str | None, + activity_id: str | None = None, ) -> None: - """Address ``workflow_id``'s topics in ``streams``.""" + """Address the owner's topics in ``streams``.""" self._streams = streams self._client = client self._workflow_id = workflow_id self._run_id = run_id + self._activity_id = activity_id + self._seen_pending = False self._converter = ( client.data_converter.payload_converter if client is not None @@ -343,7 +357,7 @@ def read( ) -> AsyncGenerator[StreamRecord[Any], None]: """Yield records on ``topic`` after ``after`` until the workflow closes.""" name, result_type = resolve_topic(topic, result_type) - store = self._streams._topic(self._workflow_id, name) + store = self._store(name) # Parsed here so a foreign cursor fails this call, not the first # iteration of the generator. start = self._streams._offset_after(after) @@ -383,21 +397,46 @@ async def _read( else self._streams._poll.total_seconds(), ) + def _store(self, topic: str) -> _Topic: + if self._activity_id is not None: + return self._streams._activity_topic( + self._workflow_id, self._activity_id, topic + ) + assert self._workflow_id is not None + return self._streams._topic(self._workflow_id, topic) + async def _closed(self) -> bool: if self._client is None: return False - handle = self._client.get_workflow_handle( - self._workflow_id, run_id=self._run_id - ) try: - description = await handle.describe() + if self._activity_id is not None and self._workflow_id is None: + activity = await self._client.get_activity_handle( + self._activity_id, run_id=self._run_id + ).describe() + return activity.status != ActivityExecutionStatus.RUNNING + assert self._workflow_id is not None + description = await self._client.get_workflow_handle( + self._workflow_id, run_id=self._run_id + ).describe() except RPCError as error: if error.status == RPCStatusCode.NOT_FOUND: - # A producer may write before the workflow exists; there is + # A producer may write before the owner exists; there is # nothing to follow yet, so keep waiting. return False raise status = description.status + if self._activity_id is not None: + pending = any( + info.activity_id == self._activity_id + for info in description.raw_description.pending_activities + ) + if pending: + self._seen_pending = True + elif self._seen_pending: + return True + # The activity's streams are not the workflow's chain: a run that + # continued as new took its activities with it. + return status is not None and status != WorkflowExecutionStatus.RUNNING if status is None or status == WorkflowExecutionStatus.RUNNING: return False # Following the chain, a run that continued as new is not the end: @@ -409,7 +448,7 @@ async def _closed(self) -> bool: async def latest(self, *, topic: str | StreamTopic[Any] | None = None) -> Cursor: """The cursor of the newest record on ``topic``, for following from now.""" name, _ = resolve_topic(topic) - count = len(self._streams._topic(self._workflow_id, name).records) + count = len(self._store(name).records) return mint_cursor(_PROVIDER, str(count - 1)) if count else BEGINNING def producer( @@ -421,7 +460,7 @@ def producer( ) -> MemoryProducer[Any]: """A producer on ``topic``; inside an activity its identity is the activity's.""" name, _ = resolve_topic(topic) - store = self._streams._topic(self._workflow_id, name) + store = self._store(name) producer_id, attempt = producer_identity(producer_id, attempt) return MemoryProducer(store, self._converter, name, producer_id, attempt) @@ -445,10 +484,12 @@ def __init__( """ self._poll = poll_interval self._topics: dict[str, _Topic] = {} + self._activity_topics: dict[tuple[str | None, str, str], _Topic] = {} def reset(self) -> None: """Drop every topic. For tests.""" self._topics.clear() + self._activity_topics.clear() def workflow_provider(self) -> _MemoryWorkflowProvider: """The workflow half, over this provider's topics.""" @@ -465,6 +506,21 @@ def get_stream_handle( """ return MemoryStreamHandle(self, client, workflow_id, run_id) + def get_activity_stream_handle( + self, + client: Client | None, + activity_id: str, + *, + workflow_id: str | None = None, + run_id: str | None = None, + ) -> MemoryStreamHandle: + """A handle on the topics ``activity_id`` owns, apart from any workflow's. + + As on :meth:`get_stream_handle`, ``client`` may be ``None``, and then + a read waits until the caller closes it. + """ + return MemoryStreamHandle(self, client, workflow_id, run_id, activity_id) + async def close(self) -> None: """Nothing to release: the provider holds no connection.""" @@ -477,6 +533,19 @@ def _topic(self, workflow_id: str, topic: str) -> _Topic: found = self._topics[key] = _Topic() return found + def _activity_topic( + self, workflow_id: str | None, activity_id: str, topic: str + ) -> _Topic: + # Kept apart from the workflow topics, so no workflow id can name an + # activity's stream. + if not topic: + raise ValueError("topic must not be empty") + key = (workflow_id, activity_id, topic) + found = self._activity_topics.get(key) + if found is None: + found = self._activity_topics[key] = _Topic() + return found + def _offset_after(self, after: Cursor) -> int: position = cursor_position(after, provider=_PROVIDER) if position is None: From be5118605d628e30b291abd2f86f095e33534947 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 28 Sep 2026 15:55:53 -0700 Subject: [PATCH 45/51] Tested the activity stream accessor rule and retry supersession. Covers all three arms of the rule, a retry writing to the same stream, and the misaddressed calls, on every provider the tree can stand up. --- tests/streams/test_activity_streams.py | 261 +++++++++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 tests/streams/test_activity_streams.py diff --git a/tests/streams/test_activity_streams.py b/tests/streams/test_activity_streams.py new file mode 100644 index 000000000..8aa4a653a --- /dev/null +++ b/tests/streams/test_activity_streams.py @@ -0,0 +1,261 @@ +"""Streams owned by activities, and which stream an activity's accessor reaches. + +``activity.stream_handle()`` resolves by a static rule, never by what exists: +an activity a workflow scheduled reaches its workflow's stream, a standalone +activity reaches its own, and ``scope="activity"`` gives an activity a +workflow scheduled its own streams. An activity's own streams are one per +activity execution, so a retry writes to the same stream and a reader sees +the attempt change as ``SUPERSEDED``. + +The memory provider always runs. A storage provider adds itself to +``SETUPS`` behind its own ``STREAMS_LIVE`` gate: its setup receives the +environment's client and hands back the provider and a client with it +registered, which the workers and the reads in these cases share. +""" + +from __future__ import annotations + +import asyncio +import uuid +from collections.abc import AsyncIterator, Callable +from dataclasses import dataclass +from datetime import timedelta +from typing import Any + +import pytest + +from temporalio import activity, workflow +from temporalio.client import Client +from temporalio.common import RetryPolicy +from temporalio.streams import ( + BEGINNING, + RecordKind, + StreamProvider, + topic, +) +from temporalio.streams.providers.memory import MemoryStreams +from temporalio.testing import WorkflowEnvironment +from tests.helpers import new_worker + +TOKENS = topic("tokens", dict) + + +@dataclass +class ActivitySetup: + """A provider under test, registered on the client the cases use.""" + + name: str + provider: StreamProvider + client: Client + + +async def _memory_setup(client: Client) -> AsyncIterator[ActivitySetup]: + provider = MemoryStreams(poll_interval=timedelta(milliseconds=50)) + config = client.config() + config["plugins"] = [provider] + yield ActivitySetup("memory", provider, Client(**config)) + provider.reset() + + +SETUPS: dict[str, Callable[[Client], AsyncIterator[ActivitySetup]]] = { + "memory": _memory_setup +} + + +@pytest.fixture(params=sorted(SETUPS)) +async def setup( + request: pytest.FixtureRequest, client: Client, env: WorkflowEnvironment +) -> AsyncIterator[ActivitySetup]: + if env.supports_time_skipping: + pytest.skip("the time-skipping test server has no standalone activities") + async for found in SETUPS[request.param](client): + yield found + + +async def read_all(records: Any, timeout: float = 30.0) -> list: + """Read until the stream ends, which is when its owner does.""" + + async def _collect() -> list: + return [record async for record in records] + + return await asyncio.wait_for(_collect(), timeout) + + +def summary(records: list) -> list[tuple[Any, ...]]: + return [ + (r.kind, r.attempt, r.value["token"] if r.kind is RecordKind.DATA else None) + for r in records + ] + + +@activity.defn +async def write_by_default(label: str) -> str: + # No arguments: where this lands depends only on where the activity runs. + producer = activity.stream_handle().producer(topic=TOKENS) + await producer.append({"token": label}) + await producer.finish() + return activity.info().activity_id + + +@activity.defn +async def write_to_own_streams(label: str) -> str: + producer = activity.stream_handle(scope="activity").producer(topic=TOKENS) + await producer.append({"token": label}) + await producer.finish() + return activity.info().activity_id + + +@workflow.defn +class RunsOneActivity: + """Runs one activity by name and returns what it returned.""" + + @workflow.run + async def run(self, name: str, label: str) -> str: + return await workflow.execute_activity( + name, + label, + activity_id="streamer", + start_to_close_timeout=timedelta(seconds=30), + ) + + +async def test_workflow_activity_defaults_to_its_workflow(setup: ActivitySetup): + client = setup.client + workflow_id = f"streams-wfa-{uuid.uuid4().hex}" + async with new_worker( + client, RunsOneActivity, activities=[write_by_default] + ) as worker: + await client.execute_workflow( + RunsOneActivity.run, + args=["write_by_default", "to the workflow"], + id=workflow_id, + task_queue=worker.task_queue, + ) + records = await read_all( + client.get_stream_handle(workflow_id).read(topic=TOKENS) + ) + assert summary(records) == [ + (RecordKind.DATA, 1, "to the workflow"), + (RecordKind.FINISH, 1, None), + ] + assert all(r.producer_id == "streamer" for r in records) + own = client.get_stream_handle(workflow_id, activity_id="streamer") + assert await own.latest(topic=TOKENS) == BEGINNING + + +async def test_scope_activity_gives_a_workflow_activity_its_own_streams( + setup: ActivitySetup, +): + client = setup.client + workflow_id = f"streams-wfa-own-{uuid.uuid4().hex}" + async with new_worker( + client, RunsOneActivity, activities=[write_to_own_streams] + ) as worker: + await client.execute_workflow( + RunsOneActivity.run, + args=["write_to_own_streams", "to the activity"], + id=workflow_id, + task_queue=worker.task_queue, + ) + own = client.get_stream_handle(workflow_id, activity_id="streamer") + assert summary(await read_all(own.read(topic=TOKENS))) == [ + (RecordKind.DATA, 1, "to the activity"), + (RecordKind.FINISH, 1, None), + ] + # The workflow's topic of the same name is a different stream. + workflow_stream = client.get_stream_handle(workflow_id) + assert await workflow_stream.latest(topic=TOKENS) == BEGINNING + + +async def test_standalone_activity_defaults_to_its_own_stream(setup: ActivitySetup): + client = setup.client + activity_id = f"streams-saa-{uuid.uuid4().hex}" + async with new_worker(client, activities=[write_by_default]) as worker: + handle = await client.start_activity( + write_by_default, + "standalone", + id=activity_id, + task_queue=worker.task_queue, + start_to_close_timeout=timedelta(seconds=30), + ) + assert await handle.result() == activity_id + stream = client.get_stream_handle(activity_id=activity_id) + # The read ends by itself: the activity reached a terminal status. + records = await read_all(stream.read(topic=TOKENS)) + assert summary(records) == [ + (RecordKind.DATA, 1, "standalone"), + (RecordKind.FINISH, 1, None), + ] + assert all(r.producer_id == activity_id for r in records) + + +@activity.defn +async def fail_once_after_writing() -> None: + attempt = activity.info().attempt + producer = activity.stream_handle().producer(topic=TOKENS) + await producer.append({"token": f"attempt {attempt}"}) + if attempt == 1: + raise RuntimeError("the first attempt fails after writing") + await producer.finish() + + +async def test_a_retry_inherits_the_stream_and_supersedes(setup: ActivitySetup): + client = setup.client + activity_id = f"streams-saa-retry-{uuid.uuid4().hex}" + async with new_worker(client, activities=[fail_once_after_writing]) as worker: + handle = await client.start_activity( + fail_once_after_writing, + id=activity_id, + task_queue=worker.task_queue, + start_to_close_timeout=timedelta(seconds=30), + retry_policy=RetryPolicy( + initial_interval=timedelta(milliseconds=200), maximum_attempts=2 + ), + ) + await handle.result() + records = await read_all( + client.get_stream_handle(activity_id=activity_id).read(topic=TOKENS) + ) + # One stream across both attempts, with the takeover reported between. + assert summary(records) == [ + (RecordKind.DATA, 1, "attempt 1"), + (RecordKind.SUPERSEDED, 2, None), + (RecordKind.DATA, 2, "attempt 2"), + (RecordKind.FINISH, 2, None), + ] + superseded = records[1].supersession + assert superseded is not None + assert (superseded.previous_attempt, superseded.attempt) == (1, 2) + + +@activity.defn +async def ask_for_misaddressed_handles() -> list[str]: + errors: list[str] = [] + try: + activity.stream_handle(scope="workflow") + except RuntimeError as error: + errors.append(f"RuntimeError: {error}") + try: + activity.stream_handle("some-workflow", scope="activity") + except ValueError as error: + errors.append(f"ValueError: {error}") + return errors + + +async def test_a_standalone_activity_has_no_workflow_to_address(setup: ActivitySetup): + client = setup.client + async with new_worker(client, activities=[ask_for_misaddressed_handles]) as worker: + errors = await client.execute_activity( + ask_for_misaddressed_handles, + id=f"streams-saa-errors-{uuid.uuid4().hex}", + task_queue=worker.task_queue, + start_to_close_timeout=timedelta(seconds=30), + ) + assert len(errors) == 2 + assert errors[0].startswith("RuntimeError: this activity belongs to no workflow") + assert errors[1].startswith("ValueError: scope='activity'") + + +async def test_get_stream_handle_needs_an_owner(setup: ActivitySetup): + with pytest.raises(ValueError, match="workflow_id or the activity_id"): + setup.client.get_stream_handle() From 06cfa0182b86bf9ebe4c8f63014ede3cce1de48e Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Mon, 28 Sep 2026 16:56:25 -0700 Subject: [PATCH 46/51] Documented the read starts on both accessors and tested an activity stream. --- temporalio/activity.py | 6 ++++-- temporalio/client/_client.py | 5 ++++- tests/streams/test_stream_accessors.py | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/temporalio/activity.py b/temporalio/activity.py index f790c9bc2..5f7a62373 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -330,8 +330,10 @@ def stream_handle( ``read``, ``latest`` or ``producer`` that names no topic addresses the owner's default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`, the one :py:func:`temporalio.workflow.stream_reader` and - :py:func:`temporalio.workflow.stream_writer` use without a topic. See - :py:mod:`temporalio.streams`. + :py:func:`temporalio.workflow.stream_writer` use without a topic. A + ``read`` starts at :py:data:`temporalio.streams.BEGINNING`, at + :py:data:`temporalio.streams.END` or at the last ``N`` records with + ``last=N``. See :py:mod:`temporalio.streams`. Like :py:func:`client`, this is only available in ``async def`` activities. diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index c6e6fa241..2e0cc3f3b 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -914,7 +914,10 @@ def get_stream_handle( the one registered with ``plugins=[provider]`` at :py:meth:`connect`, or passed as ``stream_provider``. The handle's ``read``, ``latest`` and ``producer`` take a topic, and without one address the owner's - default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`. See + default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`. A + ``read`` starts at :py:data:`temporalio.streams.BEGINNING`, at + :py:data:`temporalio.streams.END` or at the last ``N`` records with + ``last=N``, and resumes only after a cursor it was handed. See :py:mod:`temporalio.streams`. Args: diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py index f25381406..85a1f87c5 100644 --- a/tests/streams/test_stream_accessors.py +++ b/tests/streams/test_stream_accessors.py @@ -22,6 +22,7 @@ from temporalio.streams import ( BEGINNING, DEFAULT_TOPIC, + END, RecordKind, StreamUnsupportedError, topic, @@ -213,3 +214,24 @@ async def test_a_sync_activity_is_told_it_cannot_have_a_handle( ) assert "only available in `async def` activities" in result assert "plugins=" not in result + + +async def test_an_activity_owned_stream_takes_every_read_start( + client: Client, provider: MemoryStreams +): + registered = _with_provider(client, provider) + stream = registered.get_stream_handle(activity_id=f"act-{uuid.uuid4().hex}") + producer = stream.producer(topic=INPUTS, producer_id="tool", attempt=1) + await producer.append({"n": 1}, {"n": 2}, {"n": 3}) + + async def first(records: Any) -> Any: + async for record in records: + await records.aclose() + return record.value + return None + + assert await first(stream.read(topic=INPUTS, after=BEGINNING)) == {"n": 1} + assert await first(stream.read(topic=INPUTS, last=1)) == {"n": 3} + at_end = stream.read(topic=INPUTS, after=END) + await producer.append({"n": 4}) + assert await asyncio.wait_for(first(at_end), 10) == {"n": 4} From 61a58f78b953b5c5fdeac575c1c3c64e9d099d5b Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Wed, 30 Sep 2026 02:30:38 -0700 Subject: [PATCH 47/51] Let the client and activity accessors open refs and standalone streams. A StreamRef in place of the workflow id opens the stream it names on whatever provider the client carries, and its topic becomes the handle's default. A standalone stream is created with client.create_stream and reached by its stream_id. --- CHANGELOG.md | 8 +- temporalio/activity.py | 21 ++++- temporalio/client/_client.py | 103 ++++++++++++++++++++++--- temporalio/streams/_ref.py | 91 +++++++++++++++++++++- tests/streams/test_activity_streams.py | 4 +- 5 files changed, 208 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd1c61df..d335d6db4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,13 @@ to include examples, links to docs, or any other relevant information. code; a plain string names a topic decided at runtime, and a call that names no topic addresses the default topic, `streams.DEFAULT_TOPIC` (`"output"`, the server's default stream name). The record on the wire - is `temporal.api.stream.v1.StreamRecord` on every provider. + is `temporal.api.stream.v1.StreamRecord` on every provider. A stream is + handed to another process as a `streams.StreamRef`, plain data naming the + owner and the topic, which `client.get_stream_handle(ref)` and + `activity.stream_handle(ref)` open; `client.create_stream(stream_id, ...)` + creates a standalone stream with a retention policy, and its handle's + `close()` seals it. A provider runs record bodies through the client's data + converter, so a payload codec and external storage apply to them. `temporalio.streams.providers.memory.MemoryStreams` is the in-memory reference provider the conformance tests run against. diff --git a/temporalio/activity.py b/temporalio/activity.py index 5f7a62373..40821db39 100644 --- a/temporalio/activity.py +++ b/temporalio/activity.py @@ -34,6 +34,7 @@ from temporalio.converter._payload_converter import ( _TemporalTransferTypePayloadConverter, ) +from temporalio.streams._ref import open_ref from .types import CallableType @@ -301,13 +302,18 @@ def client() -> Client: def stream_handle( - workflow_id: str | None = None, + workflow_id: str | temporalio.streams.StreamRef | None = None, *, run_id: str | None = None, scope: Literal["workflow", "activity"] | None = None, ) -> temporalio.streams.StreamHandle: """Return a stream handle from the provider the worker was given. + A :py:class:`temporalio.streams.StreamRef` in place of ``workflow_id``, + such as one this activity received as an argument, opens the stream it + names, whatever owns it, and takes no other argument; the handle's calls + that name no topic then address the ref's topic. + Which stream a call with no ``workflow_id`` reaches is decided by where the activity runs, never by what exists: @@ -339,7 +345,8 @@ def stream_handle( activities. Args: - workflow_id: Another workflow whose stream to address. + workflow_id: Another workflow whose stream to address, or a + :py:class:`temporalio.streams.StreamRef` naming the stream. run_id: The run of ``workflow_id`` to pin to. scope: ``"activity"`` for this activity's own streams, ``"workflow"`` for its workflow's. Without it the rule above @@ -357,8 +364,8 @@ def stream_handle( provider, or its provider cannot hold a stream an activity owns. Register one with ``Client.connect(plugins=[provider])`` or ``Worker(plugins=[provider])``. - ValueError: ``run_id`` was given without ``workflow_id``, or - ``scope="activity"`` with one. + ValueError: ``run_id`` was given without ``workflow_id``, + ``scope="activity"`` with one, or a ref with either. """ context = _Context.current() if context.sync: @@ -376,6 +383,12 @@ def stream_handle( "no stream provider is configured on this worker; register one with " "Client.connect(plugins=[provider]) or Worker(plugins=[provider])" ) + if isinstance(workflow_id, temporalio.streams.StreamRef): + if run_id is not None or scope is not None: + raise ValueError( + "a StreamRef names the stream in full, so it takes no run_id or scope" + ) + return open_ref(provider, client(), workflow_id) if workflow_id is not None: if scope == "activity": raise ValueError( diff --git a/temporalio/client/_client.py b/temporalio/client/_client.py index 2e0cc3f3b..d770a73b1 100644 --- a/temporalio/client/_client.py +++ b/temporalio/client/_client.py @@ -40,6 +40,7 @@ ServiceClient, TLSConfig, ) +from temporalio.streams._ref import open_ref from ..common import HeaderCodecBehavior from ..types import ( @@ -898,22 +899,29 @@ def get_workflow_handle( def get_stream_handle( self, - workflow_id: str | None = None, + workflow_id: str | temporalio.streams.StreamRef | None = None, *, run_id: str | None = None, activity_id: str | None = None, + stream_id: str | None = None, ) -> temporalio.streams.StreamHandle: - """Get a handle on a workflow's or an activity's stream from the provider registered on this client. + """Get a handle on a stream from the provider registered on this client. Mirrors :py:meth:`get_workflow_handle`: without ``run_id`` the handle follows the workflow's execution chain across continue-as-new, with one it is pinned to that run. With ``activity_id`` the handle is on the streams that activity owns: a standalone activity's when ``workflow_id`` is left out, and ``run_id`` then pins the activity's - run, or an activity that ``workflow_id`` scheduled. The provider is - the one registered with ``plugins=[provider]`` at :py:meth:`connect`, - or passed as ``stream_provider``. The handle's ``read``, ``latest`` - and ``producer`` take a topic, and without one address the owner's + run, or an activity that ``workflow_id`` scheduled. With + ``stream_id`` it is on a standalone stream, one with an id of its own + and no owner, which :py:meth:`create_stream` made; it takes no other + argument. A :py:class:`temporalio.streams.StreamRef` in place of + ``workflow_id`` opens the stream the ref names, whatever owns it, and + takes no other argument either: the handle's calls that name no topic + then address the ref's topic. The provider is the one registered + with ``plugins=[provider]`` at :py:meth:`connect`, or passed as + ``stream_provider``. The handle's ``read``, ``latest`` and + ``producer`` take a topic, and without one address the owner's default topic, :py:data:`temporalio.streams.DEFAULT_TOPIC`. A ``read`` starts at :py:data:`temporalio.streams.BEGINNING`, at :py:data:`temporalio.streams.END` or at the last ``N`` records with @@ -921,19 +929,22 @@ def get_stream_handle( :py:mod:`temporalio.streams`. Args: - workflow_id: Workflow ID whose stream to get a handle to, or the - workflow that scheduled ``activity_id``. + workflow_id: Workflow ID whose stream to get a handle to, the + workflow that scheduled ``activity_id``, or a + :py:class:`temporalio.streams.StreamRef` naming the stream. run_id: Run ID to pin the handle to. activity_id: Activity ID whose own streams to get a handle to. + stream_id: ID of the standalone stream to get a handle to. Returns: The stream handle. Raises: - ValueError: Neither ``workflow_id`` nor ``activity_id`` was given. + ValueError: No owner was named, or a ref or ``stream_id`` was + given together with another argument. temporalio.streams.StreamUnsupportedError: No stream provider is registered on this client, or it cannot hold a stream an - activity owns. + activity owns or a stream without an owner. """ provider = self._config.get("stream_provider") if provider is None: @@ -941,14 +952,84 @@ def get_stream_handle( "no stream provider is registered on this client; connect with " "plugins=[provider]" ) + if isinstance(workflow_id, temporalio.streams.StreamRef): + if run_id is not None or activity_id is not None or stream_id is not None: + raise ValueError( + "a StreamRef names the stream in full, so it takes no run_id, " + "activity_id or stream_id" + ) + return open_ref(provider, self, workflow_id) + if stream_id is not None: + if workflow_id is not None or run_id is not None or activity_id is not None: + raise ValueError( + "stream_id names a standalone stream, which has no workflow_id, " + "run_id or activity_id" + ) + return provider.get_standalone_stream_handle(self, stream_id) if activity_id is not None: return provider.get_activity_stream_handle( self, activity_id, workflow_id=workflow_id, run_id=run_id ) if workflow_id is None: - raise ValueError("name the workflow_id or the activity_id to address") + raise ValueError( + "name the workflow_id, the activity_id or the stream_id to address" + ) return provider.get_stream_handle(self, workflow_id, run_id=run_id) + async def create_stream( + self, + stream_id: str, + *, + retention: timedelta | None = None, + max_records: int | None = None, + max_bytes: int | None = None, + ) -> temporalio.streams.StreamHandle: + """Create a standalone stream and get a handle on it. + + A standalone stream has an id of its own and no owner, so it is + created here on purpose rather than by its first write, and it is + sealed on purpose with the handle's ``close()``, after which appends + are refused and the retained records stay readable. The three policy + arguments bound what it retains: records older than ``retention``, + beyond the newest ``max_records`` or past ``max_bytes`` of stored + records are dropped, and ``None`` leaves a bound to the provider's + default. Creating a stream that exists with the same policy returns a + handle on it, so a retried create is harmless. Another process + reaches the stream with ``get_stream_handle(stream_id=...)`` or with + the handle's ``ref()``. + + Args: + stream_id: ID of the stream to create. + retention: How long a record is kept. + max_records: How many of the newest records are kept. + max_bytes: How many bytes of records are kept. + + Returns: + A handle on the new or existing stream. + + Raises: + ValueError: ``stream_id`` is empty, a bound is not positive, or + the stream exists with a different policy. + temporalio.streams.StreamUnsupportedError: No stream provider is + registered on this client, or it cannot hold a stream without + an owner. + """ + provider = self._config.get("stream_provider") + if provider is None: + raise temporalio.streams.StreamUnsupportedError( + "no stream provider is registered on this client; connect with " + "plugins=[provider]" + ) + if not stream_id: + raise ValueError("stream_id must not be empty") + return await provider.create_standalone_stream( + self, + stream_id, + retention=retention, + max_records=max_records, + max_bytes=max_bytes, + ) + def get_workflow_handle_for( self, workflow: ( diff --git a/temporalio/streams/_ref.py b/temporalio/streams/_ref.py index 5322f4cdb..9e8130af7 100644 --- a/temporalio/streams/_ref.py +++ b/temporalio/streams/_ref.py @@ -12,12 +12,22 @@ from __future__ import annotations import dataclasses +from collections.abc import AsyncGenerator from dataclasses import dataclass -from typing import Any, Literal +from typing import TYPE_CHECKING, Any, Literal +from temporalio.streams._record import BEGINNING, Cursor, StreamRecord from temporalio.streams._topic import DEFAULT_TOPIC, StreamTopic, resolve_topic -__all__ = ["StreamOwnerKind", "StreamRef"] +if TYPE_CHECKING: + from temporalio.client import Client + from temporalio.streams._provider import ( + StreamHandle, + StreamProducer, + StreamProvider, + ) + +__all__ = ["StreamOwnerKind", "StreamRef", "open_ref"] StreamOwnerKind = Literal["workflow", "activity", "standalone"] """What owns a stream: a workflow, an activity, or the stream itself.""" @@ -140,3 +150,80 @@ def with_topic(self, topic: str | StreamTopic[Any] | None) -> StreamRef: """ name, _ = resolve_topic(topic) return dataclasses.replace(self, topic=name) + + +def open_ref(provider: StreamProvider, client: Client, ref: StreamRef) -> StreamHandle: + """The handle ``ref`` names, on ``provider``. + + The ref's kind picks the provider call that opens the owner, and its + topic becomes the handle's default, so a call that names none addresses + the stream the ref names. A provider that cannot host that owner kind + raises :class:`temporalio.streams.StreamUnsupportedError` from the call + that would have opened it. + """ + if ref.kind == "workflow": + assert ref.workflow_id is not None + handle = provider.get_stream_handle(client, ref.workflow_id, run_id=ref.run_id) + elif ref.kind == "activity": + assert ref.activity_id is not None + handle = provider.get_activity_stream_handle( + client, ref.activity_id, workflow_id=ref.workflow_id, run_id=ref.run_id + ) + else: + assert ref.stream_id is not None + handle = provider.get_standalone_stream_handle(client, ref.stream_id) + return _RefHandle(handle, ref) + + +class _RefHandle: + """A provider's handle whose default topic is the one a ref names. + + Every call passes through unchanged when it names a topic; one that + names none gets the ref's. The wrapper exists so a ref can address a + stream without every provider learning about refs. + """ + + def __init__(self, inner: StreamHandle, ref: StreamRef) -> None: + self._inner = inner + self._ref = ref + + def _topic(self, topic: str | StreamTopic[Any] | None) -> str | StreamTopic[Any]: + return self._ref.topic if topic is None else topic + + def read( + self, + *, + topic: str | StreamTopic[Any] | None = None, + after: Cursor = BEGINNING, + last: int | None = None, + result_type: type | None = None, + ) -> AsyncGenerator[StreamRecord[Any], None]: + # The protocol's overloads each take one shape of topic and + # result_type; a passthrough hands over whatever it was given. + inner: Any = self._inner + return inner.read( + topic=self._topic(topic), after=after, last=last, result_type=result_type + ) + + async def latest(self, *, topic: str | StreamTopic[Any] | None = None) -> Cursor: + return await self._inner.latest(topic=self._topic(topic)) + + def producer( + self, + *, + topic: str | StreamTopic[Any] | None = None, + producer_id: str = "", + attempt: int = 0, + ) -> StreamProducer[Any]: + inner: Any = self._inner + return inner.producer( + topic=self._topic(topic), producer_id=producer_id, attempt=attempt + ) + + def ref(self, *, topic: str | StreamTopic[Any] | None = None) -> StreamRef: + if topic is None: + return self._ref + return self._inner.ref(topic=topic) + + async def close(self) -> None: + await self._inner.close() diff --git a/tests/streams/test_activity_streams.py b/tests/streams/test_activity_streams.py index 8aa4a653a..bd0a675ac 100644 --- a/tests/streams/test_activity_streams.py +++ b/tests/streams/test_activity_streams.py @@ -257,5 +257,7 @@ async def test_a_standalone_activity_has_no_workflow_to_address(setup: ActivityS async def test_get_stream_handle_needs_an_owner(setup: ActivitySetup): - with pytest.raises(ValueError, match="workflow_id or the activity_id"): + with pytest.raises( + ValueError, match="workflow_id, the activity_id or the stream_id" + ): setup.client.get_stream_handle() From a95c913161d5211baab19cd5d7fba594566061f8 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Wed, 30 Sep 2026 02:42:04 -0700 Subject: [PATCH 48/51] Hosted standalone streams in the memory provider. A standalone stream lives in the provider with its policy and a sealed flag. The policy trims on append, a seal wakes parked readers so their reads end, and a stream id that was never created is refused at the call, so the conformance suite can run the standalone cases without a server. --- temporalio/streams/providers/memory.py | 180 +++++++++++++++++++++---- 1 file changed, 152 insertions(+), 28 deletions(-) diff --git a/temporalio/streams/providers/memory.py b/temporalio/streams/providers/memory.py index 3139805c1..ce8a4ae10 100644 --- a/temporalio/streams/providers/memory.py +++ b/temporalio/streams/providers/memory.py @@ -23,8 +23,13 @@ waits for the workflow. - It keeps every record until :meth:`MemoryStreams.truncate` drops the oldest ones, which stands in for a store's retention in tests. -- It does not host standalone streams; both standalone calls raise - :class:`temporalio.streams.StreamUnsupportedError`. +- A standalone stream lives here with its policy and a sealed flag. + ``retention``, ``max_records`` and ``max_bytes`` are applied when a record + is appended, so a stream nobody writes to keeps records past their + retention. A read on it ends when it is sealed and the tail delivered, and + a read, ``latest`` or ``producer`` on a stream id that does not exist + raises :class:`temporalio.streams.StreamNotFoundError` at the call rather + than waiting for the stream to be created. - The outside path encodes and decodes bodies through the client's data converter, codec and external storage included, and fingerprints a retry over the converted bytes first. The workflow half has no client, so a @@ -41,7 +46,9 @@ import asyncio import logging +import time from collections.abc import AsyncGenerator +from dataclasses import dataclass from datetime import timedelta from typing import Any, Generic, TypeVar @@ -53,9 +60,10 @@ from temporalio.service import RPCError, RPCStatusCode from temporalio.streams._body import content_fingerprint, decode_body, encode_body from temporalio.streams._errors import ( + StreamClosedError, StreamCursorError, + StreamNotFoundError, StreamProducerError, - StreamUnsupportedError, ) from temporalio.streams._ids import topic_key from temporalio.streams._provider import ReadSource, WriteSink @@ -93,15 +101,45 @@ def _wake(future: asyncio.Future[None]) -> None: future.set_result(None) +@dataclass(frozen=True) +class _Policy: + """What a standalone stream retains, applied as records are appended.""" + + retention: timedelta | None = None + max_records: int | None = None + max_bytes: int | None = None + + def __post_init__(self) -> None: + if self.retention is not None and self.retention <= timedelta(0): + raise ValueError("retention must be positive") + if self.max_records is not None and self.max_records <= 0: + raise ValueError("max_records must be positive") + if self.max_bytes is not None and self.max_bytes <= 0: + raise ValueError("max_bytes must be positive") + + +class _Standalone: + """One standalone stream: its policy, its seal and its topics.""" + + def __init__(self, policy: _Policy) -> None: + self.policy = policy + self.sealed = False + self.topics: dict[str, _Topic] = {} + + class _Topic: """One topic's records, and the waiters parked on its tail.""" - def __init__(self) -> None: + def __init__(self, policy: _Policy | None = None, *, sealed: bool = False) -> None: + self.policy = policy + self.sealed = sealed # The retained records, the first of which sits at offset ``base``. # Offsets are never reused, so a cursor keeps naming the same record # after truncation drops the ones before it. self.base = 0 self.records: list[bytes] = [] + # When each retained record landed, for a retention policy. + self.stamps: list[float] = [] # Dedupe identity is (producer#attempt, first sequence of the append), # the same pair the storage providers use, mapped to where the batch # landed and a digest of what it held, so a repeat answers with the @@ -132,7 +170,10 @@ def append( Raises: StreamProducerError: ``(writer, sequence)`` is held with different content. + StreamClosedError: The stream was sealed. """ + if self.sealed: + raise StreamClosedError("the stream is closed and takes no more records") key = (writer or "", sequence) bodies = [wire.SerializeToString(deterministic=True) for wire in wires] if content is None: @@ -148,13 +189,43 @@ def append( ) return first, count first = self.head + now = time.time() self.records.extend(bodies) + self.stamps.extend([now] * len(bodies)) if writer is not None: self.seen[key] = (first, len(wires), content) + self._apply_policy(now) + self._wake_waiters() + return first, len(wires) + + def _wake_waiters(self) -> None: waiters, self._waiters = self._waiters, [] for loop, future in waiters: loop.call_soon_threadsafe(_wake, future) - return first, len(wires) + + def _apply_policy(self, now: float) -> None: + policy = self.policy + if policy is None: + return + drop = 0 + if policy.max_records is not None: + drop = max(drop, len(self.records) - policy.max_records) + if policy.max_bytes is not None: + held = sum(len(record) for record in self.records) + while drop < len(self.records) and held > policy.max_bytes: + held -= len(self.records[drop]) + drop += 1 + if policy.retention is not None: + floor = now - policy.retention.total_seconds() + while drop < len(self.records) and self.stamps[drop] < floor: + drop += 1 + if drop: + self._drop(drop) + + def seal(self) -> None: + """Take no more records, and let parked readers see the end.""" + self.sealed = True + self._wake_waiters() @property def head(self) -> int: @@ -167,9 +238,12 @@ def at(self, offset: int) -> bytes: def truncate(self, keep: int) -> None: """Drop all but the newest ``keep`` records.""" - drop = max(0, len(self.records) - keep) - self.base += drop - del self.records[:drop] + self._drop(max(0, len(self.records) - keep)) + + def _drop(self, count: int) -> None: + self.base += count + del self.records[:count] + del self.stamps[:count] async def wait_past(self, offset: int, timeout: float | None) -> None: """Wait until a record exists at ``offset``, or ``timeout`` passes.""" @@ -368,7 +442,8 @@ class MemoryStreamHandle: The owner is ``workflow_id``'s workflow, or with ``activity_id`` an activity: a standalone one without ``workflow_id``, or one that workflow - scheduled. + scheduled. With ``stream_id`` the handle is on a standalone stream, which + has no owner. """ def __init__( @@ -378,6 +453,7 @@ def __init__( workflow_id: str | None, run_id: str | None, activity_id: str | None = None, + stream_id: str | None = None, ) -> None: """Address the owner's topics in ``streams``.""" self._streams = streams @@ -385,6 +461,7 @@ def __init__( self._workflow_id = workflow_id self._run_id = run_id self._activity_id = activity_id + self._stream_id = stream_id self._seen_pending = False self._converter = ( client.data_converter @@ -400,10 +477,11 @@ def read( last: int | None = None, result_type: type | None = None, ) -> AsyncGenerator[StreamRecord[Any], None]: - """Yield records on ``topic`` from where the read starts until the workflow closes. + """Yield records on ``topic`` from where the read starts until the owner closes. ``END`` and ``last=`` are resolved by this call, against what the - topic holds when it is made. + topic holds when it is made. On a standalone stream the read ends + once the stream is sealed and the tail delivered. """ check_read_start(after, last) name, result_type = resolve_topic(topic, result_type) @@ -459,6 +537,8 @@ async def _read( ) def _store(self, topic: str) -> _Topic: + if self._stream_id is not None: + return self._streams._standalone_topic(self._stream_id, topic) if self._activity_id is not None: return self._streams._activity_topic( self._workflow_id, self._activity_id, topic @@ -467,6 +547,8 @@ def _store(self, topic: str) -> _Topic: return self._streams._topic(self._workflow_id, topic) async def _closed(self) -> bool: + if self._stream_id is not None: + return self._streams._standalone_stream(self._stream_id).sealed if self._client is None: return False try: @@ -527,6 +609,8 @@ def producer( def ref(self, *, topic: str | StreamTopic[Any] | None = None) -> StreamRef: """A ref to ``topic`` of this owner's stream, pinned as this handle is.""" + if self._stream_id is not None: + return StreamRef.for_standalone(self._stream_id, topic=topic) if self._activity_id is not None: return StreamRef.for_activity( self._activity_id, @@ -540,11 +624,13 @@ def ref(self, *, topic: str | StreamTopic[Any] | None = None) -> StreamRef: ) async def close(self) -> None: - """Refuse: an owned stream ends with its owner, not by a caller.""" - raise ValueError( - "only a standalone stream can be closed; this handle is on an owned " - "stream, which ends when its workflow or activity does" - ) + """Seal a standalone stream. An owned stream ends with its owner, not by a caller.""" + if self._stream_id is None: + raise ValueError( + "only a standalone stream can be closed; this handle is on an owned " + "stream, which ends when its workflow or activity does" + ) + self._streams._seal(self._stream_id) class MemoryStreams(ProviderPlugin): @@ -567,11 +653,13 @@ def __init__( self._poll = poll_interval self._topics: dict[str, _Topic] = {} self._activity_topics: dict[tuple[str | None, str, str], _Topic] = {} + self._standalone: dict[str, _Standalone] = {} def reset(self) -> None: - """Drop every topic. For tests.""" + """Drop every topic and every standalone stream. For tests.""" self._topics.clear() self._activity_topics.clear() + self._standalone.clear() def truncate(self, workflow_id: str, topic: str, *, keep: int) -> None: """Drop all but the newest ``keep`` records of a topic. For tests. @@ -621,26 +709,38 @@ async def create_standalone_stream( max_records: int | None = None, max_bytes: int | None = None, ) -> MemoryStreamHandle: - """Refuse: this provider keeps no stream without an owner. + """Create the standalone stream ``stream_id``, or find it with the same policy. + + The policy is applied on every append to any of the stream's topics. + ``client`` may be ``None``, as on the other handles. Raises: - StreamUnsupportedError: Always. + ValueError: ``stream_id`` is empty, a bound is not positive, or + the stream exists with a different policy. """ - raise StreamUnsupportedError( - "the memory provider does not host standalone streams" - ) + if not stream_id: + raise ValueError("stream_id must not be empty") + policy = _Policy(retention, max_records, max_bytes) + existing = self._standalone.get(stream_id) + if existing is None: + self._standalone[stream_id] = _Standalone(policy) + elif existing.policy != policy: + raise ValueError( + f"standalone stream {stream_id!r} exists with policy " + f"{existing.policy}, not {policy}" + ) + return MemoryStreamHandle(self, client, None, None, stream_id=stream_id) def get_standalone_stream_handle( self, client: Client | None, stream_id: str ) -> MemoryStreamHandle: - """Refuse: this provider keeps no stream without an owner. + """A handle on the standalone stream ``stream_id``. - Raises: - StreamUnsupportedError: Always. + Nothing is checked here: a ``read``, ``latest`` or ``producer`` on a + stream that was never created raises + :class:`temporalio.streams.StreamNotFoundError` at the call. """ - raise StreamUnsupportedError( - "the memory provider does not host standalone streams" - ) + return MemoryStreamHandle(self, client, None, None, stream_id=stream_id) async def close(self) -> None: """Nothing to release: the provider holds no connection.""" @@ -667,6 +767,30 @@ def _activity_topic( found = self._activity_topics[key] = _Topic() return found + def _standalone_stream(self, stream_id: str) -> _Standalone: + stream = self._standalone.get(stream_id) + if stream is None: + raise StreamNotFoundError( + f"standalone stream {stream_id!r} does not exist; create it with " + "client.create_stream" + ) + return stream + + def _standalone_topic(self, stream_id: str, topic: str) -> _Topic: + stream = self._standalone_stream(stream_id) + if not topic: + raise ValueError("topic must not be empty") + found = stream.topics.get(topic) + if found is None: + found = stream.topics[topic] = _Topic(stream.policy, sealed=stream.sealed) + return found + + def _seal(self, stream_id: str) -> None: + stream = self._standalone_stream(stream_id) + stream.sealed = True + for store in stream.topics.values(): + store.seal() + def _start(self, store: _Topic, after: Cursor, last: int | None) -> int: """The offset a read starts at, resolved against what ``store`` holds now.""" if last is not None: From 5287f6e53a6b5a512d3297ce39a6bcd7b70deba6 Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Wed, 30 Sep 2026 02:42:04 -0700 Subject: [PATCH 49/51] Tested refs, standalone streams and body encoding through the accessors. The conformance suite opens a ref, creates and seals a standalone stream and checks its retention policy on every provider that hosts one. The accessor tests carry a ref through a workflow argument and result and open it from the activity and the client. --- tests/streams/conftest.py | 5 + tests/streams/test_stream_accessors.py | 87 ++++++++++ tests/streams/test_streams_conformance.py | 194 ++++++++++++++++++++++ 3 files changed, 286 insertions(+) diff --git a/tests/streams/conftest.py b/tests/streams/conftest.py index b8a152f20..f03dbc919 100644 --- a/tests/streams/conftest.py +++ b/tests/streams/conftest.py @@ -15,3 +15,8 @@ def pytest_configure(config: pytest.Config) -> None: "markers", "truncates: the case needs a way to drop a topic's oldest records", ) + config.addinivalue_line( + "markers", + "hosts_standalone_streams: the case needs a stream with an id of its own and " + "no owner", + ) diff --git a/tests/streams/test_stream_accessors.py b/tests/streams/test_stream_accessors.py index 85a1f87c5..4fd3f9b4e 100644 --- a/tests/streams/test_stream_accessors.py +++ b/tests/streams/test_stream_accessors.py @@ -24,6 +24,8 @@ DEFAULT_TOPIC, END, RecordKind, + StreamClosedError, + StreamRef, StreamUnsupportedError, topic, ) @@ -235,3 +237,88 @@ async def first(records: Any) -> Any: at_end = stream.read(topic=INPUTS, after=END) await producer.append({"n": 4}) assert await asyncio.wait_for(first(at_end), 10) == {"n": 4} + + +NOTES = topic("notes", dict) + + +@activity.defn +async def append_to_ref(ref: StreamRef) -> str: + # The ref arrived as an argument and names the stream in full, so it + # takes no scope; the handle it opens writes to the ref's topic. + try: + activity.stream_handle(ref, scope="activity") + except ValueError as error: + refused = str(error) + else: + refused = "accepted" + await activity.stream_handle(ref).producer().append({"via": "activity"}) + return refused + + +@workflow.defn +class PublishToRef: + """Hands a stream ref to an activity and returns it, both as plain data.""" + + @workflow.run + async def run(self, ref: StreamRef) -> tuple[StreamRef, str]: + refused = await workflow.execute_activity( + append_to_ref, ref, start_to_close_timeout=timedelta(seconds=30) + ) + return ref, refused + + +async def test_a_ref_travels_as_data_and_opens_from_every_context( + client: Client, provider: MemoryStreams +): + registered = _with_provider(client, provider) + shared = await registered.create_stream(f"shared-{uuid.uuid4().hex}") + ref = shared.ref(topic=NOTES) + async with new_worker( + registered, PublishToRef, activities=[append_to_ref] + ) as worker: + returned, refused = await registered.execute_workflow( + PublishToRef.run, + ref, + id=f"streams-wf-{uuid.uuid4().hex}", + task_queue=worker.task_queue, + ) + # The workflow argument and result went through the data converter. + assert returned == ref + assert "takes no run_id or scope" in refused + # The activity wrote to the referenced topic, and the client reads it + # from the ref without naming the topic. Sealing the stream is what ends + # a full read of it. + await shared.close() + records = [ + (r.topic, r.value) async for r in registered.get_stream_handle(ref).read(last=1) + ] + assert records == [("notes", {"via": "activity"})] + with pytest.raises(ValueError, match="takes no run_id"): + registered.get_stream_handle(ref, run_id="r") + + +async def test_the_client_creates_reaches_and_closes_a_standalone_stream( + client: Client, provider: MemoryStreams +): + registered = _with_provider(client, provider) + stream_id = f"shared-{uuid.uuid4().hex}" + created = await registered.create_stream(stream_id, max_records=3) + producer = created.producer(topic=NOTES, producer_id="writer", attempt=1) + await producer.append({"n": 1}) + + reached = registered.get_stream_handle(stream_id=stream_id) + assert await reached.latest(topic=NOTES) != BEGINNING + await reached.close() + with pytest.raises(StreamClosedError): + await producer.append({"n": 2}) + assert [r.value async for r in reached.read(topic=NOTES)] == [{"n": 1}] + + with pytest.raises(ValueError, match="no workflow_id"): + registered.get_stream_handle(stream_id=stream_id, workflow_id="wf") + with pytest.raises(ValueError, match="empty"): + await registered.create_stream("") + with pytest.raises(StreamUnsupportedError, match="plugins="): + await client.create_stream(stream_id) + with pytest.raises(StreamUnsupportedError, match="plugins="): + client.get_stream_handle(stream_id=stream_id) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index afbb1d2d7..0ffd35982 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -31,6 +31,7 @@ import uuid from collections.abc import AsyncIterator, Awaitable, Callable, Sequence from dataclasses import dataclass +from datetime import timedelta from typing import Any import pytest @@ -53,14 +54,17 @@ END, Cursor, RecordKind, + StreamClosedError, StreamCursorError, StreamHandle, + StreamNotFoundError, StreamProducerError, StreamProvider, StreamRef, Supersession, topic, ) +from temporalio.streams._ref import open_ref from temporalio.streams.providers.memory import MemoryStreams # Defined once and shared by every case, the way an application shares them @@ -88,6 +92,11 @@ class ProviderCase: truncate: Callable[[str, str, int], Awaitable[None]] | None = None """Drops all but the newest records of a workflow's topic, standing in for retention, or ``None`` when the provider offers no way to.""" + hosts_standalone_streams: bool = True + """The store holds a stream with an id of its own and no owner.""" + waits_for_standalone_creation: bool = False + """A read on a standalone stream id that does not exist yet parks until + the first write instead of raising ``StreamNotFoundError``.""" async def open( self, @@ -113,6 +122,42 @@ async def open( run_id=run_id, ) + async def open_ref(self, ref: StreamRef) -> StreamHandle: + if self.client is not None: + return self.client.get_stream_handle(ref) + return open_ref(self.provider, None, ref) # type: ignore[arg-type] + + async def create_stream( + self, + stream_id: str, + *, + retention: timedelta | None = None, + max_records: int | None = None, + max_bytes: int | None = None, + ) -> StreamHandle: + if self.client is not None: + return await self.client.create_stream( + stream_id, + retention=retention, + max_records=max_records, + max_bytes=max_bytes, + ) + return await self.provider.create_standalone_stream( + None, # type: ignore[arg-type] + stream_id, + retention=retention, + max_records=max_records, + max_bytes=max_bytes, + ) + + async def open_standalone(self, stream_id: str) -> StreamHandle: + if self.client is not None: + return self.client.get_stream_handle(stream_id=stream_id) + return self.provider.get_standalone_stream_handle( + None, # type: ignore[arg-type] + stream_id, + ) + class RecordingDriver(StorageDriver): """An in-memory external storage driver that counts what it was asked to hold.""" @@ -191,6 +236,7 @@ async def truncate(workflow_id: str, topic: str, keep: int) -> None: "reports_positions": lambda case: case.reports_positions, "detects_divergent_retries": lambda case: case.detects_divergent_retries, "truncates": lambda case: case.truncate is not None, + "hosts_standalone_streams": lambda case: case.hosts_standalone_streams, } @@ -224,6 +270,19 @@ async def _collect() -> None: return out +async def drain(records: Any, timeout: float = 5.0) -> list: + """Every record until the read ends on its own.""" + + async def _collect() -> list: + return [record async for record in records] + + return await asyncio.wait_for(_collect(), timeout) + + +def new_stream_id() -> str: + return f"stream-{uuid.uuid4().hex}" + + async def test_append_read_roundtrip(case: ProviderCase): workflow_id = new_workflow_id() stream = await case.open(workflow_id) @@ -668,3 +727,138 @@ async def test_a_retry_through_a_nondeterministic_codec_still_deduplicates( await first.append({"id": "r2"}) records = await take(stream.read(topic=OUT), 2) assert [r.value for r in records] == [{"id": "r1"}, {"id": "r2"}] + + +async def test_a_ref_opens_the_stream_it_names(case: ProviderCase): + workflow_id = new_workflow_id() + stream = await case.open(workflow_id) + await stream.producer(topic=A, producer_id="model", attempt=1).append({"n": 1}) + ref = stream.ref(topic=A) + + # The receiver names no topic: the ref carried it, so every call on the + # handle it opened addresses topic ``a`` of that workflow. + opened = await case.open_ref(ref) + records = await take(opened.read(result_type=dict), 1) + assert [(r.topic, r.value) for r in records] == [("a", {"n": 1})] + assert await opened.latest() == records[0].cursor + assert opened.ref() == ref + await opened.producer(producer_id="tool", attempt=1).append({"n": 2}) + assert [r.value for r in await take(stream.read(topic=A), 2)] == [ + {"n": 1}, + {"n": 2}, + ] + # Naming a topic on the opened handle addresses that topic instead. + assert await opened.latest(topic=B) == BEGINNING + assert opened.ref(topic=B) == stream.ref(topic=B) + + +@pytest.mark.hosts_standalone_streams +async def test_a_standalone_stream_is_read_from_another_handle(case: ProviderCase): + stream_id = new_stream_id() + created = await case.create_stream(stream_id) + producer = created.producer(topic=OUT, producer_id="writer", attempt=1) + await producer.append({"n": 1}, {"n": 2}) + + # Any process reaches the stream by its id, or by a ref the creator + # handed out; nothing about the stream depends on who created it. + other = await case.open_standalone(stream_id) + records = await take(other.read(topic=OUT), 2) + assert [r.value for r in records] == [{"n": 1}, {"n": 2}] + assert await other.latest(topic=OUT) == records[1].cursor + assert other.ref(topic=OUT) == StreamRef.for_standalone(stream_id, topic="out") + via_ref = await case.open_ref(created.ref(topic=OUT)) + assert [r.value for r in await take(via_ref.read(), 2)] == [{"n": 1}, {"n": 2}] + + +@pytest.mark.hosts_standalone_streams +async def test_a_missing_standalone_stream_is_not_found(case: ProviderCase): + if case.waits_for_standalone_creation: + pytest.skip( + f"the {case.name} provider waits for a standalone stream to be created" + ) + # get_stream_handle(stream_id=) creates nothing: the stream has to have + # been created on purpose, and a use before that says so. + stream = await case.open_standalone(new_stream_id()) + with pytest.raises(StreamNotFoundError): + await stream.latest(topic=OUT) + with pytest.raises(StreamNotFoundError): + await take(stream.read(topic=OUT), 1) + with pytest.raises(StreamNotFoundError): + await stream.producer(topic=OUT, producer_id="writer", attempt=1).append( + {"n": 1} + ) + + +@pytest.mark.hosts_standalone_streams +async def test_creating_a_standalone_stream_is_idempotent_for_one_policy( + case: ProviderCase, +): + stream_id = new_stream_id() + first = await case.create_stream(stream_id, max_records=10) + # The same id and policy again is the same stream, not an error, so a + # retried create is harmless. + again = await case.create_stream(stream_id, max_records=10) + await first.producer(topic=OUT, producer_id="writer", attempt=1).append({"n": 1}) + assert [r.value for r in await take(again.read(topic=OUT), 1)] == [{"n": 1}] + # A different policy on an existing id is a mistake, not a change. + with pytest.raises(ValueError): + await case.create_stream(stream_id, max_records=5) + for bad in (dict(max_records=0), dict(max_bytes=-1), dict(retention=timedelta(0))): + with pytest.raises(ValueError): + await case.create_stream(new_stream_id(), **bad) # type: ignore[arg-type] + + +@pytest.mark.hosts_standalone_streams +async def test_closing_a_standalone_stream_ends_reads_and_refuses_appends( + case: ProviderCase, +): + stream_id = new_stream_id() + stream = await case.create_stream(stream_id) + producer = stream.producer(topic=OUT, producer_id="writer", attempt=1) + await producer.append({"n": 1}) + # A reader parked on the tail before the close has to learn of it. + other = await case.open_standalone(stream_id) + parked = asyncio.ensure_future(drain(other.read(topic=OUT), timeout=10)) + await asyncio.sleep(0.2) + await producer.append({"n": 2}) + + await stream.close() + assert [r.value for r in await parked] == [{"n": 1}, {"n": 2}] + # Sealed: the tail stays readable, and a read opened now ends by itself. + assert [r.value for r in await drain(stream.read(topic=OUT))] == [ + {"n": 1}, + {"n": 2}, + ] + with pytest.raises(StreamClosedError): + await producer.append({"n": 3}) + with pytest.raises(StreamClosedError): + await other.producer(topic=A, producer_id="late", attempt=1).append({"n": 3}) + # Closing again is not an error. + await stream.close() + + +@pytest.mark.hosts_standalone_streams +async def test_a_standalone_stream_honors_its_retention_policy(case: ProviderCase): + by_count = await case.create_stream(new_stream_id(), max_records=2) + producer = by_count.producer(topic=OUT, producer_id="writer", attempt=1) + await producer.append({"n": 1}, {"n": 2}, {"n": 3}, {"n": 4}) + # BEGINNING is the oldest record still held, which the policy decided. + kept = await take(by_count.read(topic=OUT), 2) + assert [r.value for r in kept] == [{"n": 3}, {"n": 4}] + + by_bytes = await case.create_stream(new_stream_id(), max_bytes=700) + producer = by_bytes.producer(topic=OUT, producer_id="writer", attempt=1) + for n in range(3): + await producer.append({"n": n, "blob": "x" * 500}) + kept = await take(by_bytes.read(topic=OUT), 1) + assert kept[0].value is not None and kept[0].value["n"] == 2 + + by_age = await case.create_stream( + new_stream_id(), retention=timedelta(milliseconds=200) + ) + producer = by_age.producer(topic=OUT, producer_id="writer", attempt=1) + await producer.append({"n": "old"}) + await asyncio.sleep(0.3) + await producer.append({"n": "new"}) + kept = await take(by_age.read(topic=OUT), 1) + assert [r.value for r in kept] == [{"n": "new"}] From f5a7e1bf7d0eff8485ce0f0f99162bacc8f8e73c Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Wed, 30 Sep 2026 03:06:35 -0700 Subject: [PATCH 50/51] Held the retention case to the declared capabilities and used the case's client. A provider that cannot bound a standalone stream by bytes is now expected to refuse the policy, and one that trims by age only after close skips that check. The converter cases derive their client from the provider's own, so a live provider is not asked to reach the fixture's dev server. --- tests/streams/test_streams_conformance.py | 29 ++++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 8fd498abf..62512e789 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -61,6 +61,7 @@ StreamProducerError, StreamProvider, StreamRef, + StreamUnsupportedError, Supersession, topic, ) @@ -696,7 +697,9 @@ async def test_a_body_above_the_threshold_is_offloaded_and_read_back( external_storage=ExternalStorage(drivers=[driver], payload_size_threshold=256), ) workflow_id = new_workflow_id() - stream = await case.open(workflow_id, client=_client_with(client, converter)) + stream = await case.open( + workflow_id, client=_client_with(case.client or client, converter) + ) producer = stream.producer(topic=OUT, producer_id="model", attempt=1) small = {"n": 1} large = {"blob": "x" * 1024} @@ -718,7 +721,9 @@ async def test_a_retry_through_a_nondeterministic_codec_still_deduplicates( codec = NonceCodec() converter = dataclasses.replace(DataConverter.default, payload_codec=codec) workflow_id = new_workflow_id() - stream = await case.open(workflow_id, client=_client_with(client, converter)) + stream = await case.open( + workflow_id, client=_client_with(case.client or client, converter) + ) first = stream.producer(topic=OUT, producer_id="model", attempt=1) landed = await first.append({"id": "r1"}) assert codec.encoded == 1 @@ -857,13 +862,19 @@ async def test_a_standalone_stream_honors_its_retention_policy(case: ProviderCas kept = await take(by_count.read(topic=OUT), 2) assert [r.value for r in kept] == [{"n": 3}, {"n": 4}] - by_bytes = await case.create_stream(new_stream_id(), max_bytes=700) - producer = by_bytes.producer(topic=OUT, producer_id="writer", attempt=1) - for n in range(3): - await producer.append({"n": n, "blob": "x" * 500}) - kept = await take(by_bytes.read(topic=OUT), 1) - assert kept[0].value is not None and kept[0].value["n"] == 2 - + if case.bounds_standalone_bytes: + by_bytes = await case.create_stream(new_stream_id(), max_bytes=700) + producer = by_bytes.producer(topic=OUT, producer_id="writer", attempt=1) + for n in range(3): + await producer.append({"n": n, "blob": "x" * 500}) + kept = await take(by_bytes.read(topic=OUT), 1) + assert kept[0].value is not None and kept[0].value["n"] == 2 + else: + with pytest.raises(StreamUnsupportedError): + await case.create_stream(new_stream_id(), max_bytes=700) + + if not case.trims_open_stream_by_age: + return by_age = await case.create_stream( new_stream_id(), retention=timedelta(milliseconds=200) ) From f05f6c39423f81a0238079713767e8f4b8da6e7a Mon Sep 17 00:00:00 2001 From: Mohammad Dashti Date: Wed, 30 Sep 2026 18:37:05 -0700 Subject: [PATCH 51/51] Let the retention case accept a refused append and a coarse age sweep. A store that refuses the append crossing its byte cap is checked with a cap that holds one stored record, hash metadata included, and not two. The age subcase waits for the older record to leave BEGINNING and accepts the newer one aging out as well, since a store reclaims on its own schedule. --- tests/streams/test_streams_conformance.py | 32 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tests/streams/test_streams_conformance.py b/tests/streams/test_streams_conformance.py index 3ba6eb61b..f9c53bdcf 100644 --- a/tests/streams/test_streams_conformance.py +++ b/tests/streams/test_streams_conformance.py @@ -48,6 +48,7 @@ StorageDriverRetrieveContext, StorageDriverStoreContext, ) +from temporalio.service import RPCError from temporalio.streams import ( BEGINNING, DEFAULT_TOPIC, @@ -56,6 +57,7 @@ RecordKind, StreamClosedError, StreamCursorError, + StreamError, StreamHandle, StreamNotFoundError, StreamProducerError, @@ -866,7 +868,19 @@ async def test_a_standalone_stream_honors_its_retention_policy(case: ProviderCas kept = await take(by_count.read(topic=OUT), 2) assert [r.value for r in kept] == [{"n": 3}, {"n": 4}] - if case.bounds_standalone_bytes: + if case.bounds_standalone_bytes and case.refuses_appends_past_byte_cap: + # The cap counts the stored record, body and metadata included, so it + # holds one of these and not two. + by_bytes = await case.create_stream(new_stream_id(), max_bytes=1000) + producer = by_bytes.producer(topic=OUT, producer_id="writer", attempt=1) + await producer.append({"n": 0, "blob": "x" * 500}) + # The second record would take the stream past its cap, so the store + # refuses it and keeps what it holds. + with pytest.raises((RPCError, StreamError)): + await producer.append({"n": 1, "blob": "x" * 500}) + kept = await take(by_bytes.read(topic=OUT), 1) + assert kept[0].value is not None and kept[0].value["n"] == 0 + elif case.bounds_standalone_bytes: by_bytes = await case.create_stream(new_stream_id(), max_bytes=700) producer = by_bytes.producer(topic=OUT, producer_id="writer", attempt=1) for n in range(3): @@ -886,5 +900,17 @@ async def test_a_standalone_stream_honors_its_retention_policy(case: ProviderCas await producer.append({"n": "old"}) await asyncio.sleep(0.3) await producer.append({"n": "new"}) - kept = await take(by_age.read(topic=OUT), 1) - assert [r.value for r in kept] == [{"n": "new"}] + # A store reclaims by age on its own schedule, and a coarse one may have + # aged the newer record out as well by the time it is looked at. What the + # policy decides is that the older record is no longer where BEGINNING + # starts. + kept = [] + for _ in range(50): + try: + kept = await take(by_age.read(topic=OUT), 1, timeout=1) + except asyncio.TimeoutError: + kept = [] + if not kept or kept[0].value == {"n": "new"}: + break + await asyncio.sleep(0.2) + assert [r.value for r in kept] in ([{"n": "new"}], [])