Repository navigation
Add High Obtainability (HO) mode support to Dataproc operators - #74753
Conversation
…ataproc operators Adds support for Dataproc High Obtainability (HO) mode declarative instance group configurations: - Adds FlexibleInstanceGroupConfig dataclass and HardwareClass enum (STANDARD, PERFORMANCE). - Adds master_flexible_config, worker_flexible_config, and secondary_worker_flexible_config parameters to ClusterGenerator. - Validates mutual exclusivity against standard machine types, disk configs, accelerators, instance flexibility policies, and zone. - Supports dual-path scaling in DataprocUpdateClusterOperator (flexible update masks config.worker_flexible_config.num_instances and config.secondary_worker_flexible_config.num_instances, with conflict checks against legacy paths). - Adds helper flexible_scale_cluster_update for scaling HO clusters. - Adds comprehensive unit tests, system test example DAG, and documentation.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
…terOperator cluster_config Address review feedback from Colin-Cheng: ClusterGenerator is deprecated and scheduled for removal after September 2027. Revert HO additions to ClusterGenerator and move flexible config validation and normalization directly into DataprocCreateClusterOperator(cluster_config=...). Update documentation, example DAG, and unit tests accordingly.
…dation - Safely access software_config and gce_cluster_config when None - Reject concrete worker_config on single-node HO clusters - Disallow boolean values for num_instances, core_count, boot_disk_size_gb, and worker scaling counts - Validate hardware_class type and values strictly - Add unit tests covering these edge cases
Colin-Cheng
left a comment
There was a problem hiding this comment.
Thanks for removing the ClusterGenerator changes and updating the tests! Left a few inline comments on the updated implementation (mainly a mypy [union-attr] issue in _validate_and_normalize_flexible_cluster_config, a leftover num_workers=0 reference in the docs, and a couple of minor validation edge cases).
Also, could you confirm whether the minimum google-cloud-dataproc version in providers/google/pyproject.toml (currently >=5.23.0) needs to be bumped so that ClusterConfig proto-plus messages recognize master_flexible_config / worker_flexible_config / secondary_worker_flexible_config?
…pport - Tighten _to_flexible_config return type annotation to avoid mypy union-attr errors. - Disallow scaling primary workers to 0 in flexible_scale_cluster_update while allowing 0 for secondary workers. - Avoid reading proto3 default 0 for unset submessages in proto-plus Cluster messages in _get_num_instances. - Explicitly exclude boolean values from being coerced as integer counts in _get_num_instances. - Skip parse-time conflicting scaling path validation in DataprocUpdateClusterOperator when cluster is templated or None. - Update docs to describe single-node HO cluster configuration via allow.zero.workers property. - Handle AirflowProviderDeprecationWarning in unit tests for ClusterGenerator.
Colin-Cheng
left a comment
There was a problem hiding this comment.
Thanks for addressing all the inline comments! One last thing regarding the google-cloud-dataproc dependency version:
… 5.32.0 - Raise minimum google-cloud-dataproc from >=5.27.0 to >=5.32.0 in pyproject.toml, README.rst, and docs/index.rst. - Support for FlexibleInstanceGroupConfig (master_flexible_config, worker_flexible_config, secondary_worker_flexible_config) in ClusterConfig was added in google-cloud-dataproc 5.32.0. - Reformat example_dataproc_cluster_high_obtainability.py to satisfy ruff format check. - Add unit test verifying proto Cluster accepts all flexible config fields.
…pport - Remove redundant client-side HO validation and custom dataclass FlexibleInstanceGroupConfig from dataproc.py, relying on native google-cloud-dataproc types and backend API validation. - Remove flexible_scale_cluster_update helper function and update_mask validation in DataprocUpdateClusterOperator. - Update uv.lock for google-cloud-dataproc>=5.32.0. - Update example_dataproc_cluster_high_obtainability.py with minimized resources (2 cores, 32GB boot disk, plain dicts) and single DataprocUpdateClusterOperator call scaling worker group to 3 and secondary worker to 0. - Update documentation in dataproc.rst linking to official Google Cloud documentation and API reference. - Refactor unit tests in test_dataproc_high_obtainability.py to verify operator pass-through and proto compatibility.
|
Thanks for the review @olegkachur-e! All feedback has been addressed in commit
|
# Conflicts: # uv.lock
olegkachur-e
left a comment
There was a problem hiding this comment.
Thanks for the updates, the PR looks much cleaner now!
A few thoughts on test_dataproc_high_obtainability.py:
TestProtoClusterFlexibleConfigtests thegoogle-cloud-dataprocclient rather than the Airflow operator, so I don't think it should be unit tested here.DataprocCreateClusterOperatoraccepts any validClusterConfigand passes it to the API as is, and the validation happens on the API side.- We usually don't write unit tests for system tests (e.g. TestExampleDag).
- These tests depend on the
google-cloud-dataprocversion rather than on the operator code, so they could fail with older client versions even though the operator code is unchanged.
I'd suggest removing this file completely. The example_dataproc_cluster_high_obtainability.py system test already covers this feature end to end.
Thanks again for your work on this!
…lity.py unit test file
|
Thanks for the feedback @olegkachur-e! Agreed on all points — I have removed |
MaksYermak
left a comment
There was a problem hiding this comment.
Hello @jigneshjain25, thank you for the PR!
LGTM, could I ask you to provide a screenshots of successful run for example_dataproc_cluster_high_obtainability.py system tests?
@shahar1 what do you think about this PR?
|
Thank you for the review and approval @MaksYermak! Here are the screenshots from the successful execution of the 1. Airflow UI — DAG Graph (
|
shahar1
left a comment
There was a problem hiding this comment.
Overall LGTM, pleas fix failing CI job
|
Hi @shahar1, I have fixed the failing CI job (
Could you please take another look and merge when you get a chance? Thank you! |
Approved, please do not merge from main and let the CI run until it finishes :) |
|
Thanks @shahar1! All CI checks have now completed and passed 100% green. Ready to be merged whenever you get a chance! |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |




Adds support for Dataproc High Obtainability (HO) mode declarative instance group configurations (
master_flexible_config,worker_flexible_config,secondary_worker_flexible_config):google-cloud-dataproc>=5.32.0(anduv.lock) for nativeFlexibleInstanceGroupConfigsupport.example_dataproc_cluster_high_obtainability.pydemonstrating creating and scaling an HO cluster.dataproc.rstoperator documentation with High Obtainability mode usage examples and links to the official Google Cloud documentation.