Skip to content

Commit

Permalink
Add __enhanced_stack_trace query to workers (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
twin-drill authored Jun 18, 2024
1 parent 2bb211e commit 4f646c2
Show file tree
Hide file tree
Showing 34 changed files with 1,722 additions and 802 deletions.
85 changes: 44 additions & 41 deletions temporalio/api/command/v1/message_pb2.py

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions temporalio/api/command/v1/message_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import temporalio.api.common.v1.message_pb2
import temporalio.api.enums.v1.command_type_pb2
import temporalio.api.enums.v1.workflow_pb2
import temporalio.api.failure.v1.message_pb2
import temporalio.api.sdk.v1.user_metadata_pb2
import temporalio.api.taskqueue.v1.message_pb2

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

COMMAND_TYPE_FIELD_NUMBER: builtins.int
USER_METADATA_FIELD_NUMBER: builtins.int
SCHEDULE_ACTIVITY_TASK_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
START_TIMER_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
COMPLETE_WORKFLOW_EXECUTION_COMMAND_ATTRIBUTES_FIELD_NUMBER: builtins.int
Expand All @@ -1038,6 +1040,19 @@ class Command(google.protobuf.message.Message):
REQUEST_CANCEL_NEXUS_OPERATION_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:
"""Metadata on the command. This is sometimes carried over to the history event if one is
created as a result of the command. Most commands won't have this information, and how this
information is used is dependent upon the interface that reads it.
Current well-known uses:
* start_child_workflow_execution_command_attributes - populates
temporalio.api.workflow.v1.WorkflowExecutionInfo.user_metadata where the summary and details
are used by user interfaces to show fixed as-of-start workflow summary and details.
* start_timer_command_attributes - populates temporalio.api.history.v1.HistoryEvent for timer
started where the summary is used to identify the timer.
"""
@property
def schedule_activity_task_command_attributes(
self,
) -> global___ScheduleActivityTaskCommandAttributes: ...
Expand Down Expand Up @@ -1110,6 +1125,8 @@ class Command(google.protobuf.message.Message):
self,
*,
command_type: temporalio.api.enums.v1.command_type_pb2.CommandType.ValueType = ...,
user_metadata: temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata
| None = ...,
schedule_activity_task_command_attributes: global___ScheduleActivityTaskCommandAttributes
| None = ...,
start_timer_command_attributes: global___StartTimerCommandAttributes
Expand Down Expand Up @@ -1184,6 +1201,8 @@ class Command(google.protobuf.message.Message):
b"start_timer_command_attributes",
"upsert_workflow_search_attributes_command_attributes",
b"upsert_workflow_search_attributes_command_attributes",
"user_metadata",
b"user_metadata",
],
) -> builtins.bool: ...
def ClearField(
Expand Down Expand Up @@ -1227,6 +1246,8 @@ class Command(google.protobuf.message.Message):
b"start_timer_command_attributes",
"upsert_workflow_search_attributes_command_attributes",
b"upsert_workflow_search_attributes_command_attributes",
"user_metadata",
b"user_metadata",
],
) -> None: ...
def WhichOneof(
Expand Down
9 changes: 5 additions & 4 deletions temporalio/api/enums/v1/failed_cause_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions temporalio/api/enums/v1/failed_cause_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ class _ResourceExhaustedCauseEnumTypeWrapper(
"""Workflow is busy"""
RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT: _ResourceExhaustedCause.ValueType # 6
"""Caller exceeds action per second limit."""
RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT: _ResourceExhaustedCause.ValueType # 7
"""Persistence storage limit exceeded."""

class ResourceExhaustedCause(
_ResourceExhaustedCause, metaclass=_ResourceExhaustedCauseEnumTypeWrapper
Expand All @@ -330,6 +332,8 @@ RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW: ResourceExhaustedCause.ValueType # 5
"""Workflow is busy"""
RESOURCE_EXHAUSTED_CAUSE_APS_LIMIT: ResourceExhaustedCause.ValueType # 6
"""Caller exceeds action per second limit."""
RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_STORAGE_LIMIT: ResourceExhaustedCause.ValueType # 7
"""Persistence storage limit exceeded."""
global___ResourceExhaustedCause = ResourceExhaustedCause

class _ResourceExhaustedScope:
Expand Down
15 changes: 10 additions & 5 deletions temporalio/api/enums/v1/task_queue_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ class _BuildIdTaskReachabilityEnumTypeWrapper(
BUILD_ID_TASK_REACHABILITY_UNSPECIFIED: _BuildIdTaskReachability.ValueType # 0
"""Task reachability is not reported"""
BUILD_ID_TASK_REACHABILITY_REACHABLE: _BuildIdTaskReachability.ValueType # 1
"""Build ID may be used by new workflows or activities (base on versioning rules), or there are
open workflows or backlogged activities assigned to it.
"""Build ID may be used by new workflows or activities (base on versioning rules), or there MAY
be open workflows or backlogged activities assigned to it.
"""
BUILD_ID_TASK_REACHABILITY_CLOSED_WORKFLOWS_ONLY: _BuildIdTaskReachability.ValueType # 2
"""Build ID does not have open workflows and is not reachable by new workflows,
Expand All @@ -201,8 +201,13 @@ class BuildIdTaskReachability(
_BuildIdTaskReachability, metaclass=_BuildIdTaskReachabilityEnumTypeWrapper
):
"""Specifies which category of tasks may reach a versioned worker of a certain Build ID.
Task Reachability is eventually consistent; there may be a delay until it converges to the most
accurate value but it is designed in a way to take the more conservative side until it converges.
For example REACHABLE is more conservative than CLOSED_WORKFLOWS_ONLY.
Note: future activities who inherit their workflow's Build ID but not its Task Queue will not be
accounted for reachability as server cannot not know if they'll happen as they do not use
accounted for reachability as server cannot know if they'll happen as they do not use
assignment rules of their Task Queue. Same goes for Child Workflows or Continue-As-New Workflows
who inherit the parent/previous workflow's Build ID but not its Task Queue. In those cases, make
sure to query reachability for the parent/previous workflow's Task Queue as well.
Expand All @@ -211,8 +216,8 @@ class BuildIdTaskReachability(
BUILD_ID_TASK_REACHABILITY_UNSPECIFIED: BuildIdTaskReachability.ValueType # 0
"""Task reachability is not reported"""
BUILD_ID_TASK_REACHABILITY_REACHABLE: BuildIdTaskReachability.ValueType # 1
"""Build ID may be used by new workflows or activities (base on versioning rules), or there are
open workflows or backlogged activities assigned to it.
"""Build ID may be used by new workflows or activities (base on versioning rules), or there MAY
be open workflows or backlogged activities assigned to it.
"""
BUILD_ID_TASK_REACHABILITY_CLOSED_WORKFLOWS_ONLY: BuildIdTaskReachability.ValueType # 2
"""Build ID does not have open workflows and is not reachable by new workflows,
Expand Down
237 changes: 120 additions & 117 deletions temporalio/api/history/v1/message_pb2.py

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions temporalio/api/history/v1/message_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import temporalio.api.enums.v1.update_pb2
import temporalio.api.enums.v1.workflow_pb2
import temporalio.api.failure.v1.message_pb2
import temporalio.api.sdk.v1.task_complete_metadata_pb2
import temporalio.api.sdk.v1.user_metadata_pb2
import temporalio.api.taskqueue.v1.message_pb2
import temporalio.api.update.v1.message_pb2
import temporalio.api.workflow.v1.message_pb2
Expand Down Expand Up @@ -3546,6 +3547,7 @@ class HistoryEvent(google.protobuf.message.Message):
VERSION_FIELD_NUMBER: builtins.int
TASK_ID_FIELD_NUMBER: builtins.int
WORKER_MAY_IGNORE_FIELD_NUMBER: builtins.int
USER_METADATA_FIELD_NUMBER: builtins.int
WORKFLOW_EXECUTION_STARTED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int
WORKFLOW_EXECUTION_COMPLETED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int
WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES_FIELD_NUMBER: builtins.int
Expand Down Expand Up @@ -3616,6 +3618,17 @@ class HistoryEvent(google.protobuf.message.Message):
acceptable for the event type and/or attributes to be uninterpretable.
"""
@property
def user_metadata(self) -> temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata:
"""Metadata on the event. This is often carried over from commands and client calls. Most events
won't have this information, and how this information is used is dependent upon the interface
that reads it.
Current well-known uses:
* workflow_execution_started_event_attributes - summary and details from start workflow.
* timer_started_event_attributes - summary represents an identifier for the timer for use by
user interfaces.
"""
@property
def workflow_execution_started_event_attributes(
self,
) -> global___WorkflowExecutionStartedEventAttributes: ...
Expand Down Expand Up @@ -3838,6 +3851,8 @@ class HistoryEvent(google.protobuf.message.Message):
version: builtins.int = ...,
task_id: builtins.int = ...,
worker_may_ignore: builtins.bool = ...,
user_metadata: temporalio.api.sdk.v1.user_metadata_pb2.UserMetadata
| None = ...,
workflow_execution_started_event_attributes: global___WorkflowExecutionStartedEventAttributes
| None = ...,
workflow_execution_completed_event_attributes: global___WorkflowExecutionCompletedEventAttributes
Expand Down Expand Up @@ -4021,6 +4036,8 @@ class HistoryEvent(google.protobuf.message.Message):
b"timer_started_event_attributes",
"upsert_workflow_search_attributes_event_attributes",
b"upsert_workflow_search_attributes_event_attributes",
"user_metadata",
b"user_metadata",
"workflow_execution_cancel_requested_event_attributes",
b"workflow_execution_cancel_requested_event_attributes",
"workflow_execution_canceled_event_attributes",
Expand Down Expand Up @@ -4144,6 +4161,8 @@ class HistoryEvent(google.protobuf.message.Message):
b"timer_started_event_attributes",
"upsert_workflow_search_attributes_event_attributes",
b"upsert_workflow_search_attributes_event_attributes",
"user_metadata",
b"user_metadata",
"version",
b"version",
"worker_may_ignore",
Expand Down
Loading

0 comments on commit 4f646c2

Please sign in to comment.