Skip to content

Move Compute Engine validation out of constructors - #70454

Merged
shahar1 merged 2 commits into
apache:mainfrom
daesung9511:fix-compute-operator-init-logic
Jul 26, 2026
Merged

Move Compute Engine validation out of constructors#70454
shahar1 merged 2 commits into
apache:mainfrom
daesung9511:fix-compute-operator-init-logic

Conversation

@daesung9511

Copy link
Copy Markdown
Contributor

Move Compute Engine input validation and template-dependent transformations out of operator constructors.

The affected operators previously performed validation and derived values such as resource_id during init. Because template fields are rendered after operator initialization, this caused validation and transformation logic to run against unrendered values.

@shahar1

This change:

  • Move Compute Engine input validation from operator constructors to execution time
  • Defer template-dependent transformations, including resolving resource_id from rendered body fields
  • Create body validators after template rendering
  • Preserve runtime validation for existing Compute Engine start and stop operators
  • Update unit tests to verify validation during execution
  • Remove the corresponding operators from the constructor logic exemption list

Tests:

breeze testing providers-tests providers/google/tests/unit/google/cloud/operators/test_compute.py

related: #70296


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

@shahar1 shahar1 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.

Well done! Minor comments to handle and we're good to go

Comment thread providers/google/tests/unit/google/cloud/operators/test_compute.py Outdated
Comment thread providers/google/tests/unit/google/cloud/operators/test_compute.py Outdated
Comment thread providers/google/tests/unit/google/cloud/operators/test_compute.py
Comment thread providers/google/tests/unit/google/cloud/operators/test_compute.py Outdated
Comment thread providers/google/src/airflow/providers/google/cloud/operators/compute.py Outdated

@shahar1 shahar1 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.

Great!!!

@shahar1 shahar1 removed the backport-to-v3-3-test Backport to v3-3-test label Jul 26, 2026
@shahar1
shahar1 merged commit 33c2363 into apache:main Jul 26, 2026
86 checks passed
Kunal8954 pushed a commit to Kunal8954/airflow that referenced this pull request Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants