Skip to content

Commit 5f3def5

Browse files
committed
Remove xray
1 parent 2d1eac0 commit 5f3def5

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

hello_nexus/caller/workflows.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from datetime import timedelta
22

3-
import xray
43
from temporalio import workflow
54
from temporalio.exceptions import FailureError
65
from temporalio.workflow import NexusClient
@@ -25,7 +24,6 @@ def __init__(self):
2524

2625
@workflow.defn
2726
class EchoCallerWorkflow(CallerWorkflowBase):
28-
@xray.start_as_current_workflow_method_span()
2927
@workflow.run
3028
async def run(self, message: str) -> EchoOutput:
3129
op_output = await self.nexus_client.execute_operation(
@@ -37,7 +35,6 @@ async def run(self, message: str) -> EchoOutput:
3735

3836
@workflow.defn
3937
class Echo2CallerWorkflow(CallerWorkflowBase):
40-
@xray.start_as_current_workflow_method_span()
4138
@workflow.run
4239
async def run(self, message: str) -> EchoOutput:
4340
op_output = await self.nexus_client.execute_operation(
@@ -49,7 +46,6 @@ async def run(self, message: str) -> EchoOutput:
4946

5047
@workflow.defn
5148
class Echo3CallerWorkflow(CallerWorkflowBase):
52-
@xray.start_as_current_workflow_method_span()
5349
@workflow.run
5450
async def run(self, message: str) -> EchoOutput:
5551
op_output = await self.nexus_client.execute_operation(
@@ -61,7 +57,6 @@ async def run(self, message: str) -> EchoOutput:
6157

6258
@workflow.defn
6359
class HelloCallerWorkflow(CallerWorkflowBase):
64-
@xray.start_as_current_workflow_method_span()
6560
@workflow.run
6661
async def run(self, name: str) -> HelloOutput:
6762
# TODO: Java returns a handle immediately. The handle has a blocking method to
@@ -71,36 +66,24 @@ async def run(self, name: str) -> HelloOutput:
7166
MyNexusService.hello,
7267
HelloInput(name),
7368
)
74-
span = xray.get_current_span()
75-
span.add_event("Got NexusOperationHandle (1)")
7669
assert handle.cancel()
7770
try:
7871
await handle
7972
# TODO(dan): But should this be asyncio.CancelledError? (there's also
8073
# temporalio.exceptions.CancelledError which doesn't inherit from
8174
# asyncio.CancelledError; as a workflow author, this confused me)
82-
except FailureError as e:
83-
span.add_event(
84-
"Caught error, retrying operation",
85-
attributes={
86-
"type": e.__class__.__name__,
87-
"message": str(e),
88-
},
89-
)
75+
except FailureError:
9076
handle = await self.nexus_client.start_operation(
9177
MyNexusService.hello,
9278
HelloInput(name),
9379
)
94-
span.add_event("Got NexusOperationHandle (2)")
9580
result = await handle
96-
span.add_event(f"Got result (2): {result}")
9781
return result
9882
raise AssertionError("Expected Nexus operation to be cancelled")
9983

10084

10185
@workflow.defn
10286
class Hello2CallerWorkflow(CallerWorkflowBase):
103-
@xray.start_as_current_workflow_method_span()
10487
@workflow.run
10588
async def run(self, name: str) -> HelloOutput:
10689
handle = await self.nexus_client.start_operation(
@@ -112,7 +95,6 @@ async def run(self, name: str) -> HelloOutput:
11295

11396
@workflow.defn
11497
class Hello3CallerWorkflow(CallerWorkflowBase):
115-
@xray.start_as_current_workflow_method_span()
11698
@workflow.run
11799
async def run(self, name: str) -> HelloOutput:
118100
handle = await self.nexus_client.start_operation(

hello_nexus/handler/workflows.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22

3-
import xray
43
from temporalio import workflow
54

65
from hello_nexus.service.interface import (
@@ -15,7 +14,6 @@ class HelloWorkflow:
1514
Workflow that backs the `hello` operation.
1615
"""
1716

18-
@xray.start_as_current_workflow_method_span()
1917
@workflow.run
2018
async def run(self, input: HelloInput) -> HelloOutput:
2119
await asyncio.sleep(1) # so that it can be cancelled

0 commit comments

Comments
 (0)