26
26
def workflow_handle_to_workflow_execution_started_event_link (
27
27
handle : temporalio .client .WorkflowHandle [Any , Any ],
28
28
) -> temporalio .api .common .v1 .Link .WorkflowEvent :
29
+ """Create a WorkflowEvent link corresponding to a started workflow"""
29
30
if handle .first_execution_run_id is None :
30
31
raise ValueError (
31
32
f"Workflow handle { handle } has no first execution run ID. "
@@ -39,13 +40,18 @@ def workflow_handle_to_workflow_execution_started_event_link(
39
40
event_id = 1 ,
40
41
event_type = temporalio .api .enums .v1 .EventType .EVENT_TYPE_WORKFLOW_EXECUTION_STARTED ,
41
42
),
42
- # TODO(nexus-preview): RequestIdReference?
43
+ # TODO(nexus-preview): RequestIdReference
43
44
)
44
45
45
46
46
47
def workflow_event_to_nexus_link (
47
48
workflow_event : temporalio .api .common .v1 .Link .WorkflowEvent ,
48
49
) -> nexusrpc .Link :
50
+ """Convert a WorkflowEvent link into a nexusrpc link
51
+
52
+ Used when propagating links from a StartWorkflow response to a Nexus start operation
53
+ response.
54
+ """
49
55
scheme = "temporal"
50
56
namespace = urllib .parse .quote (workflow_event .namespace )
51
57
workflow_id = urllib .parse .quote (workflow_event .workflow_id )
@@ -61,6 +67,11 @@ def workflow_event_to_nexus_link(
61
67
def nexus_link_to_workflow_event (
62
68
link : nexusrpc .Link ,
63
69
) -> Optional [temporalio .api .common .v1 .Link .WorkflowEvent ]:
70
+ """Convert a nexus link into a WorkflowEvent link
71
+
72
+ This is used when propagating links from a Nexus start operation request to a
73
+ StartWorklow request.
74
+ """
64
75
url = urllib .parse .urlparse (link .url )
65
76
match = _LINK_URL_PATH_REGEX .match (url .path )
66
77
if not match :
0 commit comments