Conversation
| """ | ||
| @property | ||
| def provider(self) -> temporalio.api.compute.v1.provider_pb2.ComputeProvider: | ||
| """Stores instructions for a worker control plane controller how to respond |
There was a problem hiding this comment.
This is a generated file. We'll need to file a PR in the api repo to address this.
| ) | ||
|
|
||
| # Convert outcome to error or value | ||
| match self._known_outcome: |
There was a problem hiding this comment.
Is there a guarantee that one of these two cases will match? What will ReturnType be if it is an unexpected outcome?
There was a problem hiding this comment.
I've changed this in the new setup with get_nexus_operation_result being on the OutboundInterceptor now, but to answer your question, the linter/type checkers ensure that a match statement is exhaustive. In this case self._known_outcome isn't affected by function input or anything so a mismatch runtime type compared to the exhaustive type checking is unlikely.
| The result of the operation. | ||
|
|
||
| Raises: | ||
| NexusOperationFailureError: If the operation completed with a failure. |
There was a problem hiding this comment.
Claude tells me this exception is never used anywhere, but this comment says it can be raised?
There was a problem hiding this comment.
This is a good catch! I was experimenting with what should be raised here when things like a cancellation or termination occur. But based on how the rest of the SDK functions I've updated it to properly raise this error as documented.
…n defaults for id_reuse_policy and id_conflict_policy. Update integration tests with better typing and new assertions for the newly interceptable get_nexus_operation_result
…with a NexusOperationFailureError
ce1bade to
325d8bc
Compare
| rpc_metadata=rpc_metadata, | ||
| rpc_timeout=rpc_timeout, | ||
| ) | ||
| return await handle.result() |
There was a problem hiding this comment.
There are type-level tests for workflow nexus operations in tests/nexus/test_type_errors.py. Since the overloads in the Python SDK are fairly involved, could consider extending those to cover SANO.
There was a problem hiding this comment.
Great callout. I've added type tests that cover a variety of scenarios.
…ch start/execute operation. Fix hardcoded retryable=True in fallback error serialization. Add type tests and rename test/nexus/test_type_errors.py to ensure that the type test file properly executes nexus tests.
NOTE FOR REVIEWERS: This PR is pending the actual release of the API and Server and will not be merged until those are complete.
Add Standalone Nexus Operation Support
API Changes
Client.create_nexus_client()- Create a typedNexusClientfrom an endpoint & nexusrpc.ServiceClient.list_nexus_operations()- List operations via visibility queryClient.count_nexus_operations()- Count operations via visibility queryClient.get_nexus_operation_handle()- Create a typedNexusOperationHandleto an existing operationNexusClient.start_operation()- Start a Nexus Operation and return aNexusOperationHandle.NexusClient.execute_operation()- Same asstart_operation, but poll the handle for the final result.NexusOperationHandle.result()/.describe()/.cancel()/.terminate()/ property accessors - interact with an existing operation.Interceptor Support
The following methods have been added to
OutboundInterceptorstart_nexus_operation()describe_nexus_operation()cancel_nexus_operation()terminate_nexus_operation()list_nexus_operations()count_nexus_operations()Testing
Added integration test suite tests/nexus/test_standalone_operations.py (858 lines) covering start, get result, describe, cancel, terminate, list, count, ID conflict/reuse policies, and interceptor integration
Misc Changes
rufftarget version topy310to match the minimum support Python version.