Skip to content

fix: accept enable_preflight_validations in preview PipelineJob.submit so run() works - #7243

Open
abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix/preview-pipeline-job-run-preflight
Open

abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix/preview-pipeline-job-run-preflight

Conversation

@abhishekacharya200

Copy link
Copy Markdown

Fixes #7242 🦕

The preview _PipelineJob does not override run(), so it uses the GA PipelineJob.run(). That run() calls self.submit(..., enable_preflight_validations=enable_preflight_validations), but the preview submit() has no enable_preflight_validations parameter. So every run() on a preview job failed with a TypeError before sending a request, whatever value was passed. With sync=False the error happened in the background thread and wait() raised it as RuntimeError: _PipelineJob resource has not been created.

This adds enable_preflight_validations as a keyword argument to the preview submit(), documented with the same wording as the GA one, and sets preflight_validations on the v1beta1 job when it is True, the same way the GA submit() does. When it is False, whatever __init__ set is left as is, which also matches the GA behavior. The argument is keyword only, so existing positional calls to the preview submit() are not affected.

With sockets blocked and only create_pipeline_job replaced by a recorder:

Before (main, 9b9f2b3):

run(sync=True, enable_preflight_validations=False):
  TypeError: _PipelineJob.submit() got an unexpected keyword argument 'enable_preflight_validations'
run(sync=True, enable_preflight_validations=True):
  TypeError: _PipelineJob.submit() got an unexpected keyword argument 'enable_preflight_validations'

After (this branch):

run(sync=True, enable_preflight_validations=False):
  create_pipeline_job: parent=projects/p/locations/us-central1 preflight_validations=False
run(sync=True, enable_preflight_validations=True):
  create_pipeline_job: parent=projects/p/locations/us-central1 preflight_validations=True

Tests: added test_run_v1beta1_pipeline_job_passes_preflight_validations, which runs a preview job with sync=True and sync=False and with the flag on and off, and checks that the create request is sent with preflight_validations set to the value passed. All four cases fail on main (the TypeError, or the RuntimeError from wait()) and pass with this change. tests/unit/aiplatform/test_pipeline_jobs.py and test_pipeline_job_schedules.py pass locally (264 passed), and flake8==6.1.0 and black==24.8.0 report nothing on the changed code (black still flags the two older setup_method lines in the test file that are the same on main, which I left alone).

This is independent of #7240, which changes the parent, client and timeout lines further down in the same submit(). The two branches merge cleanly in either order, and both test files pass on the merged result (266 passed).

…t so run() works

The preview _PipelineJob inherits run() from PipelineJob, which passes
enable_preflight_validations to submit(). The preview submit() had no such
parameter, so every run() raised TypeError before sending a request.
Add the keyword argument and set preflight_validations on the job when it
is True, the same way the GA submit() does.
@abhishekacharya200
abhishekacharya200 requested a review from a team as a code owner October 23, 2026 01:18
@product-auto-label product-auto-label Bot added size: s Pull request size is small. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preview PipelineJob.run() raises TypeError: submit() got an unexpected keyword argument 'enable_preflight_validations'

1 participant