Skip to content

Commit 4f646c2

Browse files
authored
Add __enhanced_stack_trace query to workers (#537)
1 parent 2bb211e commit 4f646c2

34 files changed

+1722
-802
lines changed

temporalio/api/command/v1/message_pb2.py

Lines changed: 44 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporalio/api/command/v1/message_pb2.pyi

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import temporalio.api.common.v1.message_pb2
3434
import temporalio.api.enums.v1.command_type_pb2
3535
import temporalio.api.enums.v1.workflow_pb2
3636
import temporalio.api.failure.v1.message_pb2
37+
import temporalio.api.sdk.v1.user_metadata_pb2
3738
import temporalio.api.taskqueue.v1.message_pb2
3839

3940
if sys.version_info >= (3, 8):
@@ -1019,6 +1020,7 @@ class Command(google.protobuf.message.Message):
10191020
DESCRIPTOR: google.protobuf.descriptor.Descriptor
10201021

10211022
COMMAND_TYPE_FIELD_NUMBER: builtins.int
1023+
USER_METADATA_FIELD_NUMBER: builtins.int
10221024
SCHEDULE_ACTIVITY_TASK_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
10231025
START_TIMER_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
10241026
COMPLETE_WORKFLOW_EXECUTION_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
@@ -1038,6 +1040,19 @@ class Command(google.protobuf.message.Message):
10381040
REQUEST_CANCEL_NEXUS_OPERATION_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
10391041
command_type: temporalio.api.enums.v1.command_type_pb2.CommandType.ValueType
10401042
@property
1043+
def user_metadata(self) -> temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata:
1044+
"""Metadata on the command. This is sometimes carried over to the history event if one is
1045+
created as a result of the command. Most commands won't have this information, and how this
1046+
information is used is dependent upon the interface that reads it.
1047+
1048+
Current well-known uses:
1049+
* start_child_workflow_execution_command_attributes - populates
1050+
temporalio.api.workflow.v1.WorkflowExecutionInfo.user_metadata where the summary and details
1051+
are used by user interfaces to show fixed as-of-start workflow summary and details.
1052+
* start_timer_command_attributes - populates temporalio.api.history.v1.HistoryEvent for timer
1053+
started where the summary is used to identify the timer.
1054+
"""
1055+
@property
10411056
def schedule_activity_task_command_attributes(
10421057
self,
10431058
) -> global___ScheduleActivityTaskCommandAttributes: ...
@@ -1110,6 +1125,8 @@ class Command(google.protobuf.message.Message):
11101125
self,
11111126
*,
11121127
command_type: temporalio.api.enums.v1.command_type_pb2.CommandType.ValueType = ...,
1128+
user_metadata: temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata
1129+
| None = ...,
11131130
schedule_activity_task_command_attributes: global___ScheduleActivityTaskCommandAttributes
11141131
| None = ...,
11151132
start_timer_command_attributes: global___StartTimerCommandAttributes
@@ -1184,6 +1201,8 @@ class Command(google.protobuf.message.Message):
11841201
b"start_timer_command_attributes",
11851202
"upsert_workflow_search_attributes_command_attributes",
11861203
b"upsert_workflow_search_attributes_command_attributes",
1204+
"user_metadata",
1205+
b"user_metadata",
11871206
],
11881207
) -> builtins.bool: ...
11891208
def ClearField(
@@ -1227,6 +1246,8 @@ class Command(google.protobuf.message.Message):
12271246
b"start_timer_command_attributes",
12281247
"upsert_workflow_search_attributes_command_attributes",
12291248
b"upsert_workflow_search_attributes_command_attributes",
1249+
"user_metadata",
1250+
b"user_metadata",
12301251
],
12311252
) -> None: ...
12321253
def WhichOneof(

temporalio/api/enums/v1/failed_cause_pb2.py

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporalio/api/enums/v1/failed_cause_pb2.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ class _ResourceExhaustedCauseEnumTypeWrapper(
312312
"""Workflow is busy"""
313313
RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT: _ResourceExhaustedCause.ValueType # 6
314314
"""Caller exceeds action per second limit."""
315+
RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT: _ResourceExhaustedCause.ValueType # 7
316+
"""Persistence storage limit exceeded."""
315317

316318
class ResourceExhaustedCause(
317319
_ResourceExhaustedCause, metaclass=_ResourceExhaustedCauseEnumTypeWrapper
@@ -330,6 +332,8 @@ RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW: ResourceExhaustedCause.ValueType # 5
330332
"""Workflow is busy"""
331333
RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT: ResourceExhaustedCause.ValueType # 6
332334
"""Caller exceeds action per second limit."""
335+
RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT: ResourceExhaustedCause.ValueType # 7
336+
"""Persistence storage limit exceeded."""
333337
global___ResourceExhaustedCause = ResourceExhaustedCause
334338

335339
class _ResourceExhaustedScope:

temporalio/api/enums/v1/task_queue_pb2.pyi

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ class _BuildIdTaskReachabilityEnumTypeWrapper(
184184
BUILD_ID_TASK_REACHABILITY_UNSPECIFIED: _BuildIdTaskReachability.ValueType # 0
185185
"""Task reachability is not reported"""
186186
BUILD_ID_TASK_REACHABILITY_REACHABLE: _BuildIdTaskReachability.ValueType # 1
187-
"""Build ID may be used by new workflows or activities (base on versioning rules), or there are
188-
open workflows or backlogged activities assigned to it.
187+
"""Build ID may be used by new workflows or activities (base on versioning rules), or there MAY
188+
be open workflows or backlogged activities assigned to it.
189189
"""
190190
BUILD_ID_TASK_REACHABILITY_CLOSED_WORKFLOWS_ONLY: _BuildIdTaskReachability.ValueType # 2
191191
"""Build ID does not have open workflows and is not reachable by new workflows,
@@ -201,8 +201,13 @@ class BuildIdTaskReachability(
201201
_BuildIdTaskReachability, metaclass=_BuildIdTaskReachabilityEnumTypeWrapper
202202
):
203203
"""Specifies which category of tasks may reach a versioned worker of a certain Build ID.
204+
205+
Task Reachability is eventually consistent; there may be a delay until it converges to the most
206+
accurate value but it is designed in a way to take the more conservative side until it converges.
207+
For example REACHABLE is more conservative than CLOSED_WORKFLOWS_ONLY.
208+
204209
Note: future activities who inherit their workflow's Build ID but not its Task Queue will not be
205-
accounted for reachability as server cannot not know if they'll happen as they do not use
210+
accounted for reachability as server cannot know if they'll happen as they do not use
206211
assignment rules of their Task Queue. Same goes for Child Workflows or Continue-As-New Workflows
207212
who inherit the parent/previous workflow's Build ID but not its Task Queue. In those cases, make
208213
sure to query reachability for the parent/previous workflow's Task Queue as well.
@@ -211,8 +216,8 @@ class BuildIdTaskReachability(
211216
BUILD_ID_TASK_REACHABILITY_UNSPECIFIED: BuildIdTaskReachability.ValueType # 0
212217
"""Task reachability is not reported"""
213218
BUILD_ID_TASK_REACHABILITY_REACHABLE: BuildIdTaskReachability.ValueType # 1
214-
"""Build ID may be used by new workflows or activities (base on versioning rules), or there are
215-
open workflows or backlogged activities assigned to it.
219+
"""Build ID may be used by new workflows or activities (base on versioning rules), or there MAY
220+
be open workflows or backlogged activities assigned to it.
216221
"""
217222
BUILD_ID_TASK_REACHABILITY_CLOSED_WORKFLOWS_ONLY: BuildIdTaskReachability.ValueType # 2
218223
"""Build ID does not have open workflows and is not reachable by new workflows,

temporalio/api/history/v1/message_pb2.py

Lines changed: 120 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporalio/api/history/v1/message_pb2.pyi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import temporalio.api.enums.v1.update_pb2
3838
import temporalio.api.enums.v1.workflow_pb2
3939
import temporalio.api.failure.v1.message_pb2
4040
import temporalio.api.sdk.v1.task_complete_metadata_pb2
41+
import temporalio.api.sdk.v1.user_metadata_pb2
4142
import temporalio.api.taskqueue.v1.message_pb2
4243
import temporalio.api.update.v1.message_pb2
4344
import temporalio.api.workflow.v1.message_pb2
@@ -3546,6 +3547,7 @@ class HistoryEvent(google.protobuf.message.Message):
35463547
VERSION_FIELD_NUMBER: builtins.int
35473548
TASK_ID_FIELD_NUMBER: builtins.int
35483549
WORKER_MAY_IGNORE_FIELD_NUMBER: builtins.int
3550+
USER_METADATA_FIELD_NUMBER: builtins.int
35493551
WORKFLOW_EXECUTION_STARTED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int
35503552
WORKFLOW_EXECUTION_COMPLETED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int
35513553
WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int
@@ -3616,6 +3618,17 @@ class HistoryEvent(google.protobuf.message.Message):
36163618
acceptable for the event type and/or attributes to be uninterpretable.
36173619
"""
36183620
@property
3621+
def user_metadata(self) -> temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata:
3622+
"""Metadata on the event. This is often carried over from commands and client calls. Most events
3623+
won't have this information, and how this information is used is dependent upon the interface
3624+
that reads it.
3625+
3626+
Current well-known uses:
3627+
* workflow_execution_started_event_attributes - summary and details from start workflow.
3628+
* timer_started_event_attributes - summary represents an identifier for the timer for use by
3629+
user interfaces.
3630+
"""
3631+
@property
36193632
def workflow_execution_started_event_attributes(
36203633
self,
36213634
) -> global___WorkflowExecutionStartedEventAttributes: ...
@@ -3838,6 +3851,8 @@ class HistoryEvent(google.protobuf.message.Message):
38383851
version: builtins.int = ...,
38393852
task_id: builtins.int = ...,
38403853
worker_may_ignore: builtins.bool = ...,
3854+
user_metadata: temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata
3855+
| None = ...,
38413856
workflow_execution_started_event_attributes: global___WorkflowExecutionStartedEventAttributes
38423857
| None = ...,
38433858
workflow_execution_completed_event_attributes: global___WorkflowExecutionCompletedEventAttributes
@@ -4021,6 +4036,8 @@ class HistoryEvent(google.protobuf.message.Message):
40214036
b"timer_started_event_attributes",
40224037
"upsert_workflow_search_attributes_event_attributes",
40234038
b"upsert_workflow_search_attributes_event_attributes",
4039+
"user_metadata",
4040+
b"user_metadata",
40244041
"workflow_execution_cancel_requested_event_attributes",
40254042
b"workflow_execution_cancel_requested_event_attributes",
40264043
"workflow_execution_canceled_event_attributes",
@@ -4144,6 +4161,8 @@ class HistoryEvent(google.protobuf.message.Message):
41444161
b"timer_started_event_attributes",
41454162
"upsert_workflow_search_attributes_event_attributes",
41464163
b"upsert_workflow_search_attributes_event_attributes",
4164+
"user_metadata",
4165+
b"user_metadata",
41474166
"version",
41484167
b"version",
41494168
"worker_may_ignore",

0 commit comments

Comments
 (0)