This is an automated email from the ASF dual-hosted git repository.
jscheffl 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 f6789d3843b Revert "Add 'ignore_if_missing' to
DataprocDeleteClusterOperator (#60433)" (#60623)
f6789d3843b is described below
commit f6789d3843b0c6901f8f9ca71025785d44d4581d
Author: Shahar Epstein <[email protected]>
AuthorDate: Fri Jan 16 22:06:05 2026 +0200
Revert "Add 'ignore_if_missing' to DataprocDeleteClusterOperator (#60433)"
(#60623)
This reverts commit 173f80c26ab05d49c5224c6a546749fe6736276b.
---
.../providers/google/cloud/operators/dataproc.py | 18 ++++--------
.../unit/google/cloud/operators/test_dataproc.py | 32 ----------------------
2 files changed, 6 insertions(+), 44 deletions(-)
diff --git
a/providers/google/src/airflow/providers/google/cloud/operators/dataproc.py
b/providers/google/src/airflow/providers/google/cloud/operators/dataproc.py
index 55aa554ecdb..c7c23c3c21d 100644
--- a/providers/google/src/airflow/providers/google/cloud/operators/dataproc.py
+++ b/providers/google/src/airflow/providers/google/cloud/operators/dataproc.py
@@ -949,8 +949,6 @@ class
DataprocDeleteClusterOperator(GoogleCloudBaseOperator):
account from the list granting this role to the originating account
(templated).
:param deferrable: Run operator in the deferrable mode.
:param polling_interval_seconds: Time (seconds) to wait between calls to
check the cluster status.
- :param ignore_if_missing: If True, the operator will not raise an
exception if the cluster does not exist.
- Defaults to False.
"""
template_fields: Sequence[str] = (
@@ -976,7 +974,6 @@ class
DataprocDeleteClusterOperator(GoogleCloudBaseOperator):
impersonation_chain: str | Sequence[str] | None = None,
deferrable: bool = conf.getboolean("operators", "default_deferrable",
fallback=False),
polling_interval_seconds: int = 10,
- ignore_if_missing: bool = False,
**kwargs,
):
super().__init__(**kwargs)
@@ -994,7 +991,6 @@ class
DataprocDeleteClusterOperator(GoogleCloudBaseOperator):
self.impersonation_chain = impersonation_chain
self.deferrable = deferrable
self.polling_interval_seconds = polling_interval_seconds
- self.ignore_if_missing = ignore_if_missing
def execute(self, context: Context) -> None:
hook = DataprocHook(gcp_conn_id=self.gcp_conn_id,
impersonation_chain=self.impersonation_chain)
@@ -1002,14 +998,12 @@ class
DataprocDeleteClusterOperator(GoogleCloudBaseOperator):
op: operation.Operation = self._delete_cluster(hook)
except NotFound:
- if self.ignore_if_missing:
- self.log.info(
- "Cluster %s not found in region %s. Ignoring.",
- self.cluster_name,
- self.region,
- )
- return
- raise
+ self.log.info(
+ "Cluster %s not found in region %s. might have been deleted
already.",
+ self.cluster_name,
+ self.region,
+ )
+ return
except Exception as e:
raise AirflowException(str(e))
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_dataproc.py
b/providers/google/tests/unit/google/cloud/operators/test_dataproc.py
index b4cb2a19061..bbfc702914b 100644
--- a/providers/google/tests/unit/google/cloud/operators/test_dataproc.py
+++ b/providers/google/tests/unit/google/cloud/operators/test_dataproc.py
@@ -1289,7 +1289,6 @@ class TestDataprocClusterDeleteOperator:
retry=RETRY,
timeout=TIMEOUT,
metadata=METADATA,
- ignore_if_missing=True,
)
delete_cluster_op.execute(context=mock.MagicMock())
@@ -1320,7 +1319,6 @@ class TestDataprocClusterDeleteOperator:
timeout=TIMEOUT,
metadata=METADATA,
deferrable=True,
- ignore_if_missing=True,
)
delete_cluster_op.execute(context=mock.MagicMock())
@@ -1337,36 +1335,6 @@ class TestDataprocClusterDeleteOperator:
assert not mock_deffer.called
- @mock.patch(DATAPROC_PATH.format("DataprocHook"))
- def
test_execute_cluster_not_found_raises_when_ignore_if_missing_false(self,
mock_hook):
- mock_hook.return_value.delete_cluster.side_effect = NotFound("test")
- delete_cluster_op = DataprocDeleteClusterOperator(
- task_id="test_task",
- region=GCP_REGION,
- cluster_name=CLUSTER_NAME,
- project_id=GCP_PROJECT,
- cluster_uuid=None,
- request_id=REQUEST_ID,
- retry=RETRY,
- timeout=TIMEOUT,
- metadata=METADATA,
- ignore_if_missing=False,
- )
-
- with pytest.raises(NotFound):
- delete_cluster_op.execute(context=mock.MagicMock())
-
- mock_hook.return_value.delete_cluster.assert_called_once_with(
- project_id=GCP_PROJECT,
- region=GCP_REGION,
- cluster_name=CLUSTER_NAME,
- cluster_uuid=None,
- request_id=REQUEST_ID,
- retry=RETRY,
- timeout=TIMEOUT,
- metadata=METADATA,
- )
-
class TestDataprocSubmitJobOperator(DataprocJobTestBase):
@mock.patch(DATAPROC_PATH.format("DataprocHook"))