Skip to content

Add __enhanced_stack_trace query to workers #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2d623b8
enhanced stack trace:
twin-drill May 31, 2024
4acf6ab
Refactored `@dataclass`es to `temporalio.common`.
twin-drill May 31, 2024
9579582
Added integration test for external file, via added file (externalsta…
twin-drill Jun 3, 2024
3cfcce0
Reformatted with `poe format`.
twin-drill Jun 3, 2024
c72f9d0
Fix typing issues (_FileLocation to _StackTrace) and adjust integ tes…
twin-drill Jun 3, 2024
d9a930a
Fix typing errors in new integ test (Forgot an External-)
twin-drill Jun 3, 2024
16cad2c
refactor dataclasses into `_workflow_instance.py`; use `typing` packa…
twin-drill Jun 4, 2024
21acbda
Merge branch 'main' into main
twin-drill Jun 4, 2024
80bd0e5
Merge branch 'main' of https://github.com/twin-drill/temporal-sdk-python
twin-drill Jun 4, 2024
3e5037b
multi-file stack traces not working atm
twin-drill Jun 7, 2024
ae4f4a9
delete extra file
twin-drill Jun 10, 2024
428fb7f
Merge branch 'main' into main
twin-drill Jun 12, 2024
0c5f175
remove in-file classes
twin-drill Jun 12, 2024
0380f30
update submodule
twin-drill Jun 12, 2024
37b8b33
refactor with proto classes
twin-drill Jun 14, 2024
c8902c7
changed `test_workflow_enhanced_stack_trace` and `test_workflow_exter…
twin-drill Jun 14, 2024
a2c0803
Merge branch 'main' into main
twin-drill Jun 17, 2024
393ca37
Make `FileSlice` a copy of the entire source file, with `line_offset`…
twin-drill Jun 17, 2024
91584e3
add `Cargo.lock`
twin-drill Jun 17, 2024
2440ea8
Skip `test_replayer_workflow_complete` for Python versions < 3.12 -- …
twin-drill Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading