Skip to content

Commit bf747f1

Browse files
authored
Workflow/Activity Priorities (#802)
1 parent 65b10bf commit bf747f1

File tree

82 files changed

+8495
-1721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+8495
-1721
lines changed

scripts/_proto/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
FROM python:3.10
22

33
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
4+
ENV PATH="$PATH:/root/.local/bin"
45
RUN uv tool install poethepoet
56
VOLUME ["/api_new", "/bridge_new"]
67

78
COPY ./ ./
89

910
RUN mkdir -p ./temporalio/api
10-
RUN uv sync --all-extras
1111
RUN uv add "protobuf<4"
12+
RUN uv sync --all-extras
1213
RUN poe gen-protos
1314

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

scripts/_proto/Dockerfile.dockerignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
.idea/
33
.mypy_cache/
44
.pytest_cache/
5+
.ruff_cache/
56
.venv/
67
build/
78
dist/
89
temporalio/api/
910
temporalio/bridge/**/target/
1011
temporalio/bridge/**/*.so
11-
Dockerfile
12+
Dockerfile
13+
.python-version

temporalio/activity.py

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class Info:
116116
workflow_namespace: str
117117
workflow_run_id: str
118118
workflow_type: str
119+
priority: temporalio.common.Priority
119120
# TODO(cretz): Consider putting identity on here for "worker_id" for logger?
120121

121122
def _logger_details(self) -> Mapping[str, Any]:

temporalio/api/batch/v1/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
BatchOperationReset,
66
BatchOperationSignal,
77
BatchOperationTermination,
8+
BatchOperationUnpauseActivities,
9+
BatchOperationUpdateWorkflowExecutionOptions,
810
)
911

1012
__all__ = [
@@ -14,4 +16,6 @@
1416
"BatchOperationReset",
1517
"BatchOperationSignal",
1618
"BatchOperationTermination",
19+
"BatchOperationUnpauseActivities",
20+
"BatchOperationUpdateWorkflowExecutionOptions",
1721
]

temporalio/api/batch/v1/message_pb2.py

+50-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporalio/api/batch/v1/message_pb2.pyi

+130
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ import builtins
2828
import sys
2929

3030
import google.protobuf.descriptor
31+
import google.protobuf.duration_pb2
32+
import google.protobuf.field_mask_pb2
3133
import google.protobuf.message
3234
import google.protobuf.timestamp_pb2
3335

3436
import temporalio.api.common.v1.message_pb2
3537
import temporalio.api.enums.v1.batch_operation_pb2
3638
import temporalio.api.enums.v1.reset_pb2
39+
import temporalio.api.workflow.v1.message_pb2
3740

3841
if sys.version_info >= (3, 8):
3942
import typing as typing_extensions
@@ -262,3 +265,130 @@ class BatchOperationReset(google.protobuf.message.Message):
262265
) -> None: ...
263266

264267
global___BatchOperationReset = BatchOperationReset
268+
269+
class BatchOperationUpdateWorkflowExecutionOptions(google.protobuf.message.Message):
270+
"""BatchOperationUpdateWorkflowExecutionOptions sends UpdateWorkflowExecutionOptions requests to batch workflows.
271+
Keep the parameters in sync with temporalio.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest.
272+
"""
273+
274+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
275+
276+
IDENTITY_FIELD_NUMBER: builtins.int
277+
WORKFLOW_EXECUTION_OPTIONS_FIELD_NUMBER: builtins.int
278+
UPDATE_MASK_FIELD_NUMBER: builtins.int
279+
identity: builtins.str
280+
"""The identity of the worker/client."""
281+
@property
282+
def workflow_execution_options(
283+
self,
284+
) -> temporalio.api.workflow.v1.message_pb2.WorkflowExecutionOptions:
285+
"""Workflow Execution options. Partial updates are accepted and controlled by update_mask."""
286+
@property
287+
def update_mask(self) -> google.protobuf.field_mask_pb2.FieldMask:
288+
"""Controls which fields from `workflow_execution_options` will be applied.
289+
To unset a field, set it to null and use the update mask to indicate that it should be mutated.
290+
"""
291+
def __init__(
292+
self,
293+
*,
294+
identity: builtins.str = ...,
295+
workflow_execution_options: temporalio.api.workflow.v1.message_pb2.WorkflowExecutionOptions
296+
| None = ...,
297+
update_mask: google.protobuf.field_mask_pb2.FieldMask | None = ...,
298+
) -> None: ...
299+
def HasField(
300+
self,
301+
field_name: typing_extensions.Literal[
302+
"update_mask",
303+
b"update_mask",
304+
"workflow_execution_options",
305+
b"workflow_execution_options",
306+
],
307+
) -> builtins.bool: ...
308+
def ClearField(
309+
self,
310+
field_name: typing_extensions.Literal[
311+
"identity",
312+
b"identity",
313+
"update_mask",
314+
b"update_mask",
315+
"workflow_execution_options",
316+
b"workflow_execution_options",
317+
],
318+
) -> None: ...
319+
320+
global___BatchOperationUpdateWorkflowExecutionOptions = (
321+
BatchOperationUpdateWorkflowExecutionOptions
322+
)
323+
324+
class BatchOperationUnpauseActivities(google.protobuf.message.Message):
325+
"""BatchOperationUnpauseActivities sends unpause requests to batch workflows."""
326+
327+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
328+
329+
IDENTITY_FIELD_NUMBER: builtins.int
330+
TYPE_FIELD_NUMBER: builtins.int
331+
MATCH_ALL_FIELD_NUMBER: builtins.int
332+
RESET_ATTEMPTS_FIELD_NUMBER: builtins.int
333+
RESET_HEARTBEAT_FIELD_NUMBER: builtins.int
334+
JITTER_FIELD_NUMBER: builtins.int
335+
identity: builtins.str
336+
"""The identity of the worker/client."""
337+
type: builtins.str
338+
match_all: builtins.bool
339+
reset_attempts: builtins.bool
340+
"""Providing this flag will also reset the number of attempts."""
341+
reset_heartbeat: builtins.bool
342+
"""Providing this flag will also reset the heartbeat details."""
343+
@property
344+
def jitter(self) -> google.protobuf.duration_pb2.Duration:
345+
"""If set, the activity will start at a random time within the specified jitter
346+
duration, introducing variability to the start time.
347+
"""
348+
def __init__(
349+
self,
350+
*,
351+
identity: builtins.str = ...,
352+
type: builtins.str = ...,
353+
match_all: builtins.bool = ...,
354+
reset_attempts: builtins.bool = ...,
355+
reset_heartbeat: builtins.bool = ...,
356+
jitter: google.protobuf.duration_pb2.Duration | None = ...,
357+
) -> None: ...
358+
def HasField(
359+
self,
360+
field_name: typing_extensions.Literal[
361+
"activity",
362+
b"activity",
363+
"jitter",
364+
b"jitter",
365+
"match_all",
366+
b"match_all",
367+
"type",
368+
b"type",
369+
],
370+
) -> builtins.bool: ...
371+
def ClearField(
372+
self,
373+
field_name: typing_extensions.Literal[
374+
"activity",
375+
b"activity",
376+
"identity",
377+
b"identity",
378+
"jitter",
379+
b"jitter",
380+
"match_all",
381+
b"match_all",
382+
"reset_attempts",
383+
b"reset_attempts",
384+
"reset_heartbeat",
385+
b"reset_heartbeat",
386+
"type",
387+
b"type",
388+
],
389+
) -> None: ...
390+
def WhichOneof(
391+
self, oneof_group: typing_extensions.Literal["activity", b"activity"]
392+
) -> typing_extensions.Literal["type", "match_all"] | None: ...
393+
394+
global___BatchOperationUnpauseActivities = BatchOperationUnpauseActivities

0 commit comments

Comments
 (0)