Skip to content

Commit

Permalink
Added append_job_name parameter to DataflowTemplatedJobStartOperator (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Voldurk authored Aug 26, 2022
1 parent 5b9aa48 commit 62a46c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions airflow/providers/google/cloud/operators/dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ class DataflowTemplatedJobStartOperator(BaseOperator):
<https://cloud.google.com/dataflow/docs/reference/rest/v1b3/RuntimeEnvironment>`__
:param cancel_timeout: How long (in seconds) operator should wait for the pipeline to be
successfully cancelled when task is being killed.
:param append_job_name: True if unique suffix has to be appended to job name.
:param wait_until_finished: (Optional)
If True, wait for the end of pipeline execution before exiting.
If False, only submits job.
Expand Down Expand Up @@ -612,6 +613,7 @@ def __init__(
environment: Optional[Dict] = None,
cancel_timeout: Optional[int] = 10 * 60,
wait_until_finished: Optional[bool] = None,
append_job_name: bool = True,
**kwargs,
) -> None:
super().__init__(**kwargs)
Expand All @@ -631,6 +633,7 @@ def __init__(
self.environment = environment
self.cancel_timeout = cancel_timeout
self.wait_until_finished = wait_until_finished
self.append_job_name = append_job_name

def execute(self, context: 'Context') -> dict:
self.hook = DataflowHook(
Expand All @@ -657,6 +660,7 @@ def set_current_job(current_job):
project_id=self.project_id,
location=self.location,
environment=self.environment,
append_job_name=self.append_job_name,
)

return job
Expand Down
1 change: 1 addition & 0 deletions tests/providers/google/cloud/operators/test_dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ def test_exec(self, dataflow_mock):
project_id=None,
location=TEST_LOCATION,
environment={'maxWorkers': 2},
append_job_name=True,
)


Expand Down

0 comments on commit 62a46c1

Please sign in to comment.