Skip to content

Commit 6fd8394

Browse files
committed
Cleanup
1 parent 3db333b commit 6fd8394

3 files changed

Lines changed: 5 additions & 20 deletions

File tree

hello_nexus/basic/handler/service_handler.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
"""
2-
This file demonstrates how to define operation handlers by using a "shorthand" style in
3-
which you implement the `start` method only. WorkflowRunOperationHandler implements
4-
`cancel` for you automatically, but apart from that, the other operation methods
5-
(`fetch_info`, `fetch_result`, and `cancel` for SyncOperationHandler) are all
6-
automatically created with "raise NotImplementedError" implementations.
7-
8-
See hello_nexus/basic/handler/service_handler_with_operation_handler_classes.py for the
9-
alternative "fully manual" style where you implement an OperationHandler class directly.
2+
This file demonstrates how to implement a Nexus service.
103
"""
114

125
from __future__ import annotations
@@ -55,10 +48,6 @@ async def my_workflow_run_operation(
5548
# that unlike the workflow run operation above, in this case the `start` method
5649
# returns the final operation result.
5750
#
58-
# Here it is implemented using SyncOperationHandler.from_callable.
59-
# See service_handler_with_operation_handler_classes.py for an alternative style
60-
# involving subclassing SyncOperationHandler and overriding the start method.
61-
#
6251
# Sync operations are free to make arbitrary network calls, or perform CPU-bound
6352
# computations. Total execution duration must not exceed 10s.
6453
@sync_operation

hello_nexus/basic/handler/workflows.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
from hello_nexus.basic.service import MyInput, MyOutput
44

55

6+
# This is the workflow that is started by the `my_workflow_run_operation` nexus operation.
67
@workflow.defn
78
class WorkflowStartedByNexusOperation:
8-
"""
9-
This is the workflow that is started by the `my_workflow_run_operation` nexus operation.
10-
"""
11-
129
@workflow.run
1310
async def run(self, input: MyInput) -> MyOutput:
1411
return MyOutput(message=f"Hello {input.name} from workflow run operation!")

hello_nexus/without_service_definition/app.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ async def run(self, message: str) -> str:
4040
@service_handler
4141
class MyNexusService:
4242
# Here we implement a Nexus operation backed by a Temporal workflow. The start
43-
# method must use TemporalOperationContext.start_workflow to start the workflow,
44-
# which returns a WorkflowOperationToken. (Temporal server will then take care of
45-
# delivering the workflow result to the caller, using the Nexus RPC callback
46-
# mechanism).
43+
# method must use nexus.start_workflow to start the workflow. (Temporal server will
44+
# then take care of delivering the workflow result to the caller, using the Nexus
45+
# RPC callback mechanism).
4746
@workflow_run_operation
4847
async def my_workflow_run_operation(
4948
self, ctx: StartOperationContext, name: str

0 commit comments

Comments
 (0)