You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/12 21:39:00 UTC

[jira] [Commented] (AIRFLOW-2988) GCP Dataflow hook should specifically run python2

    [ https://issues.apache.org/jira/browse/AIRFLOW-2988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16612769#comment-16612769 ] 

ASF GitHub Bot commented on AIRFLOW-2988:
-----------------------------------------

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:
users@infra.apache.org


> GCP Dataflow hook should specifically run python2
> -------------------------------------------------
>
>                 Key: AIRFLOW-2988
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2988
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: Dataflow, gcp, hooks
>            Reporter: Jimmy Cao
>            Priority: Major
>             Fix For: 2.0.0
>
>
> Currently the GCP dataflow hook invokes 'python' [here|https://github.com/apache/incubator-airflow/blob/c3939c8e721870d263997e7aeaebc28e678d544b/airflow/contrib/hooks/gcp_dataflow_hook.py#L239].  This can fail if the user's 'python' in PATH starts python 3, which Apache Beam does not yet support, (see BEAM-1251).
> It should be changed to 'python2' to ensure that Apache Beam is run with the correct version of Python. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)