This is an automated email from the ASF dual-hosted git repository.
shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 6b264738614 Add High Obtainability (HO) mode support to Dataproc
operators (#74753)
6b264738614 is described below
commit 6b2647386149bd96a034df671b32dedf71b68600
Author: Jignesh Jain <[email protected]>
AuthorDate: Mon Oct 26 03:50:15 2026 -0700
Add High Obtainability (HO) mode support to Dataproc operators (#74753)
---
docs/spelling_wordlist.txt | 4 +
providers/google/README.rst | 2 +-
providers/google/docs/index.rst | 2 +-
providers/google/docs/operators/cloud/dataproc.rst | 51 +++++++
providers/google/pyproject.toml | 2 +-
.../example_dataproc_cluster_high_obtainability.py | 162 +++++++++++++++++++++
uv.lock | 8 +-
7 files changed, 224 insertions(+), 7 deletions(-)
diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt
index b339637a8f1..ec0b8690b39 100644
--- a/docs/spelling_wordlist.txt
+++ b/docs/spelling_wordlist.txt
@@ -1217,6 +1217,8 @@ oauth
objectORfile
objectstorage
observability
+Obtainability
+obtainability
od
OData
odbc
@@ -1699,6 +1701,8 @@ stderr
stdin
stdlib
stdout
+stockout
+stockouts
StorageClass
storages
StoredInfoType
diff --git a/providers/google/README.rst b/providers/google/README.rst
index c746e7681cf..dcf75dbbbe9 100644
--- a/providers/google/README.rst
+++ b/providers/google/README.rst
@@ -95,7 +95,7 @@ PIP package Version required
``google-cloud-dataflow-client`` ``>=0.13.0``
``google-cloud-dataform`` ``>=0.10.0``
``google-cloud-dataplex`` ``>=2.18.0``
-``google-cloud-dataproc`` ``>=5.27.0``
+``google-cloud-dataproc`` ``>=5.32.0``
``google-cloud-dataproc-metastore`` ``>=1.22.0``
``google-cloud-dlp`` ``>=3.36.0``
``google-cloud-kms`` ``>=3.12.0``
diff --git a/providers/google/docs/index.rst b/providers/google/docs/index.rst
index 8f5bad23423..ca4302c5434 100644
--- a/providers/google/docs/index.rst
+++ b/providers/google/docs/index.rst
@@ -148,7 +148,7 @@ PIP package Version required
``google-cloud-dataflow-client`` ``>=0.13.0``
``google-cloud-dataform`` ``>=0.10.0``
``google-cloud-dataplex`` ``>=2.18.0``
-``google-cloud-dataproc`` ``>=5.27.0``
+``google-cloud-dataproc`` ``>=5.32.0``
``google-cloud-dataproc-metastore`` ``>=1.22.0``
``google-cloud-dlp`` ``>=3.36.0``
``google-cloud-kms`` ``>=3.12.0``
diff --git a/providers/google/docs/operators/cloud/dataproc.rst
b/providers/google/docs/operators/cloud/dataproc.rst
index 056597b6399..65a214813d9 100644
--- a/providers/google/docs/operators/cloud/dataproc.rst
+++ b/providers/google/docs/operators/cloud/dataproc.rst
@@ -186,6 +186,44 @@ You can use deferrable mode for this action in order to
run the operator asynchr
:start-after: [START how_to_cloud_dataproc_create_cluster_operator_async]
:end-before: [END how_to_cloud_dataproc_create_cluster_operator_async]
+High Obtainability (HO) mode clusters
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+High Obtainability (HO) mode enables creating Dataproc clusters using abstract
hardware requirements
+(number of instances, core count, and hardware class) instead of concrete
machine types. The Dataproc backend
+resolves these requirements into a ranked list of widely available machine
families to minimize stockouts and
+improve cluster creation reliability. For more information, refer to the
+`Dataproc High Obtainability documentation
<https://docs.cloud.google.com/managed-spark/docs/concepts/configuring-clusters/high-obtainability>`_
+and the `FlexibleInstanceGroupConfig API reference
<https://cloud.google.com/dataproc/docs/reference/rest/v1/ClusterConfig#FlexibleInstanceGroupConfig>`_.
+
+High Obtainability clusters have the following characteristics:
+
+* **Mandatory AutoZone**: HO clusters require AutoZone to dynamically select
an optimal zone; do not specify a ``zone``.
+* **Cluster-wide flexible config**: Primary node (``master_flexible_config``)
and primary workers (``worker_flexible_config``) must both use flexible
configurations (or omit
+ ``worker_flexible_config`` and set ``dataproc:dataproc.allow.zero.workers``
to ``"true"`` in
+ ``software_config.properties`` for a single-node cluster).
+* **Mutual exclusivity**: Concrete node group configurations
(``master_config``,
+ ``worker_config``, ``secondary_worker_config``) cannot be mixed with
flexible configs.
+* **Secondary workers**: In HO mode, secondary workers are configured via
``secondary_worker_flexible_config``.
+* **Allowed core counts**: Supported core counts per instance are 2, 4, 8, 16,
and 32.
+* **Hardware classes**: Supported hardware classes are ``STANDARD`` and
``PERFORMANCE``.
+
+A High Obtainability cluster configuration can be defined directly as a
dictionary:
+
+.. exampleinclude::
/../../google/tests/system/google/cloud/dataproc/example_dataproc_cluster_high_obtainability.py
+ :language: python
+ :dedent: 0
+ :start-after: [START how_to_cloud_dataproc_create_ho_cluster_config]
+ :end-before: [END how_to_cloud_dataproc_create_ho_cluster_config]
+
+And created with
:class:`~airflow.providers.google.cloud.operators.dataproc.DataprocCreateClusterOperator`:
+
+.. exampleinclude::
/../../google/tests/system/google/cloud/dataproc/example_dataproc_cluster_high_obtainability.py
+ :language: python
+ :dedent: 4
+ :start-after: [START how_to_cloud_dataproc_create_ho_cluster_operator]
+ :end-before: [END how_to_cloud_dataproc_create_ho_cluster_operator]
+
Generating Cluster Config
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -259,6 +297,19 @@ You can use deferrable mode for this action in order to
run the operator asynchr
:start-after: [START how_to_cloud_dataproc_update_cluster_operator_async]
:end-before: [END how_to_cloud_dataproc_update_cluster_operator_async]
+Scaling High Obtainability (HO) clusters
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+For clusters created in High Obtainability mode, scale through the flexible
update paths:
+``config.worker_flexible_config.num_instances`` and
``config.secondary_worker_flexible_config.num_instances``
+using
:class:`~airflow.providers.google.cloud.operators.dataproc.DataprocUpdateClusterOperator`:
+
+.. exampleinclude::
/../../google/tests/system/google/cloud/dataproc/example_dataproc_cluster_high_obtainability.py
+ :language: python
+ :dedent: 4
+ :start-after: [START how_to_cloud_dataproc_scale_ho_cluster]
+ :end-before: [END how_to_cloud_dataproc_scale_ho_cluster]
+
Starting a cluster
---------------------------
diff --git a/providers/google/pyproject.toml b/providers/google/pyproject.toml
index c498db02809..eaa63bfc95d 100644
--- a/providers/google/pyproject.toml
+++ b/providers/google/pyproject.toml
@@ -104,7 +104,7 @@ dependencies = [
"google-cloud-dataflow-client>=0.13.0",
"google-cloud-dataform>=0.10.0",
"google-cloud-dataplex>=2.18.0",
- "google-cloud-dataproc>=5.27.0",
+ "google-cloud-dataproc>=5.32.0",
"google-cloud-dataproc-metastore>=1.22.0",
"google-cloud-dlp>=3.36.0",
"google-cloud-kms>=3.12.0",
diff --git
a/providers/google/tests/system/google/cloud/dataproc/example_dataproc_cluster_high_obtainability.py
b/providers/google/tests/system/google/cloud/dataproc/example_dataproc_cluster_high_obtainability.py
new file mode 100644
index 00000000000..b8570a88e33
--- /dev/null
+++
b/providers/google/tests/system/google/cloud/dataproc/example_dataproc_cluster_high_obtainability.py
@@ -0,0 +1,162 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example Airflow DAG for a Dataproc High Obtainability (HO) mode cluster.
+
+In High Obtainability mode node groups are described by abstract requirements
+(number of instances, core count, and hardware class) instead of concrete
machine
+types. Dataproc resolves them into a ranked list of widely available machine
+families to minimize stockouts. HO clusters are always auto-zoned.
+
+The DAG creates an HO cluster, scales its worker and secondary worker groups
+via ``DataprocUpdateClusterOperator``, submits a Spark job, and deletes the
+cluster.
+"""
+
+from __future__ import annotations
+
+import os
+from datetime import datetime
+
+from airflow.models.dag import DAG
+from airflow.providers.google.cloud.operators.dataproc import (
+ DataprocCreateClusterOperator,
+ DataprocDeleteClusterOperator,
+ DataprocSubmitJobOperator,
+ DataprocUpdateClusterOperator,
+)
+
+try:
+ from airflow.sdk import TriggerRule
+except ImportError:
+ # Compatibility for Airflow < 3.1
+ from airflow.utils.trigger_rule import TriggerRule # type:
ignore[no-redef,attr-defined]
+
+from system.google import DEFAULT_GCP_SYSTEM_TEST_PROJECT_ID
+
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID", "default")
+DAG_ID = "dataproc_cluster_high_obtainability"
+PROJECT_ID = os.environ.get("SYSTEM_TESTS_GCP_PROJECT") or
DEFAULT_GCP_SYSTEM_TEST_PROJECT_ID
+
+CLUSTER_NAME_BASE = f"cluster-{DAG_ID}".replace("_", "-")
+CLUSTER_NAME_FULL = CLUSTER_NAME_BASE + f"-{ENV_ID}".replace("_", "-")
+CLUSTER_NAME = CLUSTER_NAME_BASE if len(CLUSTER_NAME_FULL) >= 33 else
CLUSTER_NAME_FULL
+REGION = "us-central1"
+
+# [START how_to_cloud_dataproc_create_ho_cluster_config]
+# Note: no machine types, disk types or zone are specified. HO clusters are
+# cluster-wide: master and primary workers must both use a flexible config.
+HO_CLUSTER_CONFIG = {
+ "master_flexible_config": {
+ "num_instances": 1,
+ "core_count": 2,
+ "hardware_class": "STANDARD",
+ "boot_disk_size_gb": 32,
+ },
+ "worker_flexible_config": {
+ "num_instances": 2,
+ "core_count": 2,
+ "hardware_class": "STANDARD",
+ "boot_disk_size_gb": 32,
+ },
+ "secondary_worker_flexible_config": {
+ "num_instances": 1,
+ "core_count": 2,
+ "hardware_class": "STANDARD",
+ "boot_disk_size_gb": 32,
+ },
+ "software_config": {
+ "image_version": "2.2",
+ },
+}
+# [END how_to_cloud_dataproc_create_ho_cluster_config]
+
+SPARK_PI_JOB = {
+ "reference": {"project_id": PROJECT_ID},
+ "placement": {"cluster_name": CLUSTER_NAME},
+ "spark_job": {
+ "main_class": "org.apache.spark.examples.SparkPi",
+ "jar_file_uris":
["file:///usr/lib/spark/examples/jars/spark-examples.jar"],
+ "args": ["10"],
+ },
+}
+
+with DAG(
+ DAG_ID,
+ start_date=datetime(2026, 1, 1),
+ schedule="@once",
+ catchup=False,
+ tags=["example", "dataproc", "high-obtainability"],
+) as dag:
+ # [START how_to_cloud_dataproc_create_ho_cluster_operator]
+ create_cluster = DataprocCreateClusterOperator(
+ task_id="create_ho_cluster",
+ project_id=PROJECT_ID,
+ region=REGION,
+ cluster_name=CLUSTER_NAME,
+ cluster_config=HO_CLUSTER_CONFIG,
+ )
+ # [END how_to_cloud_dataproc_create_ho_cluster_operator]
+
+ # [START how_to_cloud_dataproc_scale_ho_cluster]
+ scale_cluster = DataprocUpdateClusterOperator(
+ task_id="scale_ho_cluster",
+ project_id=PROJECT_ID,
+ region=REGION,
+ cluster_name=CLUSTER_NAME,
+ cluster={
+ "config": {
+ "worker_flexible_config": {"num_instances": 3},
+ "secondary_worker_flexible_config": {"num_instances": 0},
+ }
+ },
+ update_mask={
+ "paths": [
+ "config.worker_flexible_config.num_instances",
+ "config.secondary_worker_flexible_config.num_instances",
+ ]
+ },
+ graceful_decommission_timeout={"seconds": 600},
+ )
+ # [END how_to_cloud_dataproc_scale_ho_cluster]
+
+ spark_pi = DataprocSubmitJobOperator(
+ task_id="spark_pi",
+ project_id=PROJECT_ID,
+ region=REGION,
+ job=SPARK_PI_JOB,
+ )
+
+ delete_cluster = DataprocDeleteClusterOperator(
+ task_id="delete_ho_cluster",
+ project_id=PROJECT_ID,
+ region=REGION,
+ cluster_name=CLUSTER_NAME,
+ trigger_rule=TriggerRule.ALL_DONE,
+ )
+
+ create_cluster >> scale_cluster >> spark_pi >> delete_cluster
+
+ from tests_common.test_utils.watcher import watcher
+
+ list(dag.tasks) >> watcher()
+
+
+from tests_common.test_utils.system_tests import get_test_run # noqa: E402
+
+# Needed to run the example DAG with pytest (see:
contributing-docs/testing/system_tests.rst)
+test_run = get_test_run(dag)
diff --git a/uv.lock b/uv.lock
index f85c9a55d70..3ab475fdd19 100644
--- a/uv.lock
+++ b/uv.lock
@@ -6074,7 +6074,7 @@ requires-dist = [
{ name = "google-cloud-dataflow-client", specifier = ">=0.13.0" },
{ name = "google-cloud-dataform", specifier = ">=0.10.0" },
{ name = "google-cloud-dataplex", specifier = ">=2.18.0" },
- { name = "google-cloud-dataproc", specifier = ">=5.27.0" },
+ { name = "google-cloud-dataproc", specifier = ">=5.32.0" },
{ name = "google-cloud-dataproc-metastore", specifier = ">=1.22.0" },
{ name = "google-cloud-dlp", specifier = ">=3.36.0" },
{ name = "google-cloud-kms", specifier = ">=3.12.0" },
@@ -13846,7 +13846,7 @@ wheels = [
[[package]]
name = "google-cloud-dataproc"
-version = "5.31.0"
+version = "5.32.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "google-api-core", extra = ["grpc"] },
@@ -13856,9 +13856,9 @@ dependencies = [
{ name = "proto-plus" },
{ name = "protobuf" },
]
-sdist = { url =
"https://files.pythonhosted.org/packages/f1/30/65ccd4456e0109b516593bc77b37693adf00e1f4414d96776ba1f4f8f1b3/google_cloud_dataproc-5.31.0.tar.gz",
hash =
"sha256:56edc831b4190abb4b3c3b951ae90ed511e1df596f0b3a96435e5c7a894b091c", size
= 571674, upload-time = "2026-10-01T18:16:05.539Z" }
+sdist = { url =
"https://files.pythonhosted.org/packages/2e/bf/03b94a6ec4ee0da35005bd43332dadcdc9e3b63f7ea79ddced76225ae3d1/google_cloud_dataproc-5.32.0.tar.gz",
hash =
"sha256:1d825c8df67cfa080835f421ce49b5d9d001d3fc6ddcd34d3b26230b0254fb36", size
= 573408, upload-time = "2026-10-15T17:49:47.588Z" }
wheels = [
- { url =
"https://files.pythonhosted.org/packages/04/fc/a0a83efef3f6fd42bb0e072d789507d472d96d4e9cc3f628c8382fc56d02/google_cloud_dataproc-5.31.0-py3-none-any.whl",
hash =
"sha256:3fd0111a72fdd23b56f7cd72a828c1e740b5aec835801ff8e2971e5fe8afa69c", size
= 485377, upload-time = "2026-10-01T18:09:43.127Z" },
+ { url =
"https://files.pythonhosted.org/packages/da/05/e3bb00b3c35fffcce375da7fc3904ef769936615af037b3269b485e71285/google_cloud_dataproc-5.32.0-py3-none-any.whl",
hash =
"sha256:424fb1fd8045f00d03df14ac1569bbdad32e3726a2d5388905fbd266a525ff85", size
= 487057, upload-time = "2026-10-15T17:49:17.934Z" },
]
[[package]]