kaxil closed pull request #3826: [AIRFLOW-2988] Run specifically python2 for dataflow URL: https://github.com/apache/incubator-airflow/pull/3826
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/airflow/contrib/hooks/gcp_dataflow_hook.py b/airflow/contrib/hooks/gcp_dataflow_hook.py index a9b7e71a5e..95abce632b 100644 --- a/airflow/contrib/hooks/gcp_dataflow_hook.py +++ b/airflow/contrib/hooks/gcp_dataflow_hook.py @@ -235,8 +235,10 @@ def start_python_dataflow(self, task_id, variables, dataflow, py_options, def label_formatter(labels_dict): return ['--labels={}={}'.format(key, value) for key, value in labels_dict.items()] + # TODO: Change python2 to python when Beam supports both python 2 and 3 + # Remember to change the test case too self._start_dataflow(task_id, variables, name, - ["python"] + py_options + [dataflow], + ["python2"] + py_options + [dataflow], label_formatter) @staticmethod diff --git a/tests/contrib/hooks/test_gcp_dataflow_hook.py b/tests/contrib/hooks/test_gcp_dataflow_hook.py index a86db5b12b..27a1f4764b 100644 --- a/tests/contrib/hooks/test_gcp_dataflow_hook.py +++ b/tests/contrib/hooks/test_gcp_dataflow_hook.py @@ -94,7 +94,7 @@ def test_start_python_dataflow(self, mock_conn, self.dataflow_hook.start_python_dataflow( task_id=TASK_ID, variables=DATAFLOW_OPTIONS_PY, dataflow=PY_FILE, py_options=PY_OPTIONS) - EXPECTED_CMD = ['python', '-m', PY_FILE, + EXPECTED_CMD = ['python2', '-m', PY_FILE, '--region=us-central1', '--runner=DataflowRunner', '--project=test', '--labels=foo=bar', ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services