Skip to content

Conversation

@Quinn-With-Two-Ns
Copy link

Add sample for Nexus cancellation based on the similar samples for Dotnet and Java

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e0e4878ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +68 to +73
handle = await self.nexus_client.start_operation(
MyNexusService.my_workflow_run_operation,
MyInput(name),
)
# Create a task that waits for the operation result
tasks.append(asyncio.create_task(handle))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid passing Nexus handle directly to create_task

In this workflow the object returned by start_operation is an awaitable handle (see the hello_nexus sample where it is only awaited). asyncio.create_task requires a coroutine object, so passing the handle directly will raise TypeError: a coroutine was expected at runtime and prevent any operation from running. To run these concurrently, wrap the awaitable in a coroutine or use asyncio.ensure_future(handle) (which accepts awaitables) so the tasks can actually be scheduled.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant