Skip to content

Commit 3f6d5ee

Browse files
authored
DataprocHook: Remove deprecated function submit (#23389)
1 parent d670e57 commit 3f6d5ee

File tree

3 files changed

+3
-32
lines changed

3 files changed

+3
-32
lines changed

β€Žairflow/providers/google/CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ Breaking changes
9191

9292
* ``DataprocHook``: order of parameters in ``wait_for_job`` function has changed.
9393

94+
* ``DataprocHook``: Remove function ``submit``. Please use ``submit_job``
95+
9496
* ``DataprocSubmitJobOperator``: order of parameters has changed.
9597

9698
* ``CloudDatastoreImportEntitiesOperator`` : Remove ``xcom_push``. Please use ``BaseOperator.do_xcom_push``

β€Žairflow/providers/google/cloud/hooks/dataproc.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
import time
2222
import uuid
23-
import warnings
24-
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
23+
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
2524

2625
from google.api_core.client_options import ClientOptions
2726
from google.api_core.exceptions import ServerError
@@ -767,27 +766,6 @@ def submit_job(
767766
metadata=metadata,
768767
)
769768

770-
def submit(
771-
self,
772-
project_id: str,
773-
job: dict,
774-
region: str = 'global',
775-
job_error_states: Optional[Iterable[str]] = None,
776-
) -> None:
777-
"""
778-
Submits Google Cloud Dataproc job.
779-
780-
:param project_id: The id of Google Cloud Dataproc project.
781-
:param job: The job to be submitted
782-
:param region: The region of Google Dataproc cluster.
783-
:param job_error_states: Job states that should be considered error states.
784-
"""
785-
# TODO: Remover one day
786-
warnings.warn("This method is deprecated. Please use `submit_job`", DeprecationWarning, stacklevel=2)
787-
job_object = self.submit_job(region=region, project_id=project_id, job=job)
788-
job_id = job_object.reference.job_id
789-
self.wait_for_job(job_id=job_id, region=region, project_id=project_id)
790-
791769
@GoogleBaseHook.fallback_to_default_project_id
792770
def cancel_job(
793771
self,

β€Žtests/providers/google/cloud/hooks/test_dataproc.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,6 @@ def test_submit_job_missing_region(self, mock_client):
372372
with pytest.raises(TypeError):
373373
self.hook.submit_job(job=JOB, project_id=GCP_PROJECT)
374374

375-
@mock.patch(DATAPROC_STRING.format("DataprocHook.wait_for_job"))
376-
@mock.patch(DATAPROC_STRING.format("DataprocHook.submit_job"))
377-
def test_submit(self, mock_submit_job, mock_wait_for_job):
378-
mock_submit_job.return_value.reference.job_id = JOB_ID
379-
with pytest.warns(DeprecationWarning):
380-
self.hook.submit(project_id=GCP_PROJECT, job=JOB, region=GCP_LOCATION)
381-
mock_submit_job.assert_called_once_with(region=GCP_LOCATION, project_id=GCP_PROJECT, job=JOB)
382-
mock_wait_for_job.assert_called_once_with(region=GCP_LOCATION, project_id=GCP_PROJECT, job_id=JOB_ID)
383-
384375
@mock.patch(DATAPROC_STRING.format("DataprocHook.get_job_client"))
385376
def test_cancel_job(self, mock_client):
386377
self.hook.cancel_job(region=GCP_LOCATION, job_id=JOB_ID, project_id=GCP_PROJECT)

0 commit comments

Comments
 (0)