Skip to content

fix: reject async generators as SDK job functions - #944

Open
satiricalguru wants to merge 1 commit into
kubeflow:mainfrom
satiricalguru:fix/reject-async-generator-functions
Open

satiricalguru wants to merge 1 commit into
kubeflow:mainfrom
satiricalguru:fix/reject-async-generator-functions

Conversation

@satiricalguru

Copy link
Copy Markdown

What this PR does

Trainer and Spark run submitted Python functions with a regular function call. An async def containing yield passes the existing coroutine check, but calling it only creates an async iterator. The job can exit successfully without executing the function body.

Reject async generator functions in the shared validator with the existing ValueError for unsupported async functions. The regression test exercises an async def containing yield alongside the existing coroutine case.

Verification

  • The new case failed against the unchanged validator and passed with this change.
  • The full SDK unit suite, package build, Ruff lint and format checks, Hub type check, and applicable pre-commit hooks passed locally.

Codex helped reproduce the bug, implement the fix, add the regression test, and run verification.

Trainer and Spark invoke job functions synchronously. Calling an async generator returns an iterator without running its body, so reject it through the existing async function validation.

Signed-off-by: Jatin Pandey <jatinjio1212@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 10:41
@github-project-automation github-project-automation Bot moved this to Ready to Merge in Kubeflow SDK Nov 10, 2026
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign electronic-waste for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

🎉 Welcome to the Kubeflow SDK! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards
  • Our team will review your PR soon! cc @kubeflow/kubeflow-sdk-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

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

Labels

Projects

Status: Ready to Merge

Development

Successfully merging this pull request may close these issues.

2 participants