Thanks to visit codestin.com
Credit goes to github.com

Skip to content

💥 Breaking Change - Make static_details and static_summary lazy on the workflow description #869

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 4 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 27 additions & 11 deletions temporalio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2926,27 +2926,43 @@ class WorkflowExecutionDescription(WorkflowExecution):

raw_description: temporalio.api.workflowservice.v1.DescribeWorkflowExecutionResponse
"""Underlying protobuf description."""
static_summary: Optional[str]
"""Gets the single-line fixed summary for this workflow execution that may appear in
UI/CLI. This can be in single-line Temporal markdown format."""
static_details: Optional[str]
"""Gets the general fixed details for this workflow execution that may appear in UI/CLI.
This can be in Temporal markdown format and can span multiple lines."""

_static_summary: Optional[str] = None
_static_details: Optional[str] = None
_metadata_decoded: bool = False

async def static_summary(self) -> Optional[str]:
"""Gets the single-line fixed summary for this workflow execution that may appear in
UI/CLI. This can be in single-line Temporal markdown format.
"""
if not self._metadata_decoded:
await self._decode_metadata()
return self._static_summary

async def static_details(self) -> Optional[str]:
"""Gets the general fixed details for this workflow execution that may appear in UI/CLI.
This can be in Temporal markdown format and can span multiple lines.
"""
if not self._metadata_decoded:
await self._decode_metadata()
return self._static_details

async def _decode_metadata(self) -> None:
"""Internal method to decode metadata lazily."""
self._static_summary, self._static_details = await _decode_user_metadata(
self.data_converter, self.raw_description.execution_config.user_metadata
)
self._metadata_decoded = True

@staticmethod
async def _from_raw_description(
description: temporalio.api.workflowservice.v1.DescribeWorkflowExecutionResponse,
converter: temporalio.converter.DataConverter,
) -> WorkflowExecutionDescription:
(summ, deets) = await _decode_user_metadata(
converter, description.execution_config.user_metadata
)
return WorkflowExecutionDescription._from_raw_info( # type: ignore
description.workflow_execution_info,
converter,
raw_description=description,
static_summary=summ,
static_details=deets,
)


Expand Down
4 changes: 2 additions & 2 deletions tests/worker/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6394,8 +6394,8 @@ async def waiting() -> bool:
assert timer_summs == {"hi!", "timer2"}

describe_r = await handle.describe()
assert describe_r.static_summary == "cool workflow bro"
assert describe_r.static_details == "xtremely detailed"
assert await describe_r.static_summary() == "cool workflow bro"
assert await describe_r.static_details() == "xtremely detailed"


@workflow.defn
Expand Down
Loading