21
21
)
22
22
23
23
import nexusrpc .handler
24
+ from hyperlinked import hyperlinked , print
24
25
from nexusrpc .handler import _ServiceImpl
25
26
from typing_extensions import Concatenate , overload
26
27
@@ -152,7 +153,6 @@ async def start_workflow(
152
153
if task_queue is None :
153
154
# TODO(dan): are we handling empty string well elsewhere?
154
155
task_queue = get_task_queue ()
155
- print (f"🌈 starting workflow { workflow } { id } in task queue { task_queue } " )
156
156
completion_callbacks = (
157
157
[
158
158
temporalio .common .NexusCompletionCallback (
@@ -162,6 +162,9 @@ async def start_workflow(
162
162
if options .callback_url
163
163
else []
164
164
)
165
+ print (f"🌈 starting workflow { workflow } { id } in task queue { task_queue } " )
166
+ for link in options .links :
167
+ print (f"🌈 link: { link } " )
165
168
# We need to pass options (completion_callbacks, links, on_conflict_options) which are
166
169
# deliberately not exposed in any overload, hence the type error.
167
170
workflow_handle = await client .start_workflow ( # type: ignore
@@ -351,25 +354,31 @@ def _nexus_link_to_workflow_event(
351
354
)
352
355
url = urllib .parse .urlparse (link .url )
353
356
if not (match := path_regex .match (url .path )):
357
+ from hyperlinked import print_stack
358
+
354
359
logger .warning (
355
- f"Invalid Nexus link: { link } . Expected path to match { path_regex .pattern } "
360
+ hyperlinked (
361
+ f"@@ Invalid Nexus link: { link } . Expected path to match { path_regex .pattern } "
362
+ )
356
363
)
364
+ print_stack ()
365
+ exit (1 )
357
366
return None
358
367
359
368
try :
360
369
query_params = urllib .parse .parse_qs (url .query )
361
370
[reference_type ] = query_params .get ("referenceType" , [])
362
371
if reference_type != "EventReference" :
363
372
raise ValueError (
364
- f"Expected Nexus link URL query parameter referenceType to be EventReference but got: { reference_type } "
373
+ f"@@ Expected Nexus link URL query parameter referenceType to be EventReference but got: { reference_type } "
365
374
)
366
375
[event_type_name ] = query_params .get ("eventType" , [])
367
376
event_ref = temporalio .api .common .v1 .Link .WorkflowEvent .EventReference (
368
377
event_type = temporalio .api .enums .v1 .EventType .Value (event_type_name )
369
378
)
370
379
except ValueError as err :
371
380
logger .warning (
372
- f"Failed to parse event type from Nexus link URL query parameters: { link } ({ err } )"
381
+ f"@@ Failed to parse event type from Nexus link URL query parameters: { link } ({ err } )"
373
382
)
374
383
event_ref = None
375
384
0 commit comments