Skip to content

Commit 31eac3c

Browse files
committed
DEV
1 parent 04f7a52 commit 31eac3c

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

temporalio/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ async def start_workflow(
532532

533533
for l in workflow_event_links:
534534
print(
535-
f"🌈<< worker starting workflow with link: {[google.protobuf.json_format.MessageToJson(l)]}"
535+
f"🌈@@ worker starting workflow with link: {google.protobuf.json_format.MessageToJson(l)}"
536536
)
537537

538538
return await self._impl.start_workflow(

temporalio/nexus/handler.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222

2323
import nexusrpc.handler
24+
from hyperlinked import hyperlinked, print
2425
from nexusrpc.handler import _ServiceImpl
2526
from typing_extensions import Concatenate, overload
2627

@@ -152,7 +153,6 @@ async def start_workflow(
152153
if task_queue is None:
153154
# TODO(dan): are we handling empty string well elsewhere?
154155
task_queue = get_task_queue()
155-
print(f"🌈 starting workflow {workflow} {id} in task queue {task_queue}")
156156
completion_callbacks = (
157157
[
158158
temporalio.common.NexusCompletionCallback(
@@ -162,6 +162,9 @@ async def start_workflow(
162162
if options.callback_url
163163
else []
164164
)
165+
print(f"🌈 starting workflow {workflow} {id} in task queue {task_queue}")
166+
for link in options.links:
167+
print(f"🌈 link: {link}")
165168
# We need to pass options (completion_callbacks, links, on_conflict_options) which are
166169
# deliberately not exposed in any overload, hence the type error.
167170
workflow_handle = await client.start_workflow( # type: ignore
@@ -351,25 +354,31 @@ def _nexus_link_to_workflow_event(
351354
)
352355
url = urllib.parse.urlparse(link.url)
353356
if not (match := path_regex.match(url.path)):
357+
from hyperlinked import print_stack
358+
354359
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+
)
356363
)
364+
print_stack()
365+
exit(1)
357366
return None
358367

359368
try:
360369
query_params = urllib.parse.parse_qs(url.query)
361370
[reference_type] = query_params.get("referenceType", [])
362371
if reference_type != "EventReference":
363372
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}"
365374
)
366375
[event_type_name] = query_params.get("eventType", [])
367376
event_ref = temporalio.api.common.v1.Link.WorkflowEvent.EventReference(
368377
event_type=temporalio.api.enums.v1.EventType.Value(event_type_name)
369378
)
370379
except ValueError as err:
371380
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})"
373382
)
374383
event_ref = None
375384

temporalio/worker/_nexus.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async def _handle_start_operation(
192192
)
193193
for l in request.links:
194194
print(
195-
f"🌈<< worker received task with link: {google.protobuf.json_format.MessageToJson(l)}"
195+
f"🌈@@ worker received task with link: {google.protobuf.json_format.MessageToJson(l)}"
196196
)
197197
temporalio.nexus.handler._current_context.set(
198198
temporalio.nexus.handler._Context(

0 commit comments

Comments
 (0)