airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-2665) No BASH will cause the dag to fail
Date Mon, 29 Oct 2018 17:31:14 GMT

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

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

ashb closed pull request #3799: [AIRFLOW-2665] Use shlex to split args and remove shell true
URL: https://github.com/apache/incubator-airflow/pull/3799
 
 
   

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/executors/local_executor.py b/airflow/executors/local_executor.py
index 291d6e1277..2212933f66 100644
--- a/airflow/executors/local_executor.py
+++ b/airflow/executors/local_executor.py
@@ -46,8 +46,10 @@
 
 import multiprocessing
 import subprocess
+import shlex
 import time
 
+
 from builtins import range
 
 from airflow.executors.base_executor import BaseExecutor
@@ -82,8 +84,11 @@ def execute_work(self, key, command):
         if key is None:
             return
         self.log.info("%s running %s", self.__class__.__name__, command)
+        if isinstance(command, list):
+            command = " ".join(command)
+        args = shlex.split(command)
         try:
-            subprocess.check_call(command, close_fds=True)
+            subprocess.check_call(args, close_fds=True)
             state = State.SUCCESS
         except subprocess.CalledProcessError as e:
             state = State.FAILED


 

----------------------------------------------------------------
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


> No BASH will cause the dag to fail
> ----------------------------------
>
>                 Key: AIRFLOW-2665
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2665
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Christian Barra
>            Priority: Major
>              Labels: easy-fix
>
> If you are a running airflow in a system where bash is not available the dags will fail,
with no logs inside the UI (you have to scroll through the local logs).
> How to replicate this? just use an alpine based image:
> ```
> [2018-06-22 21:05:20,659] \{jobs.py:1386} INFO - Processing DAG_1
>  [2018-06-22 21:05:20,667] \{local_executor.py:43} INFO - LocalWorker running airflow
run DAG_1 stackoverflow 2018-06-22T21:05:19.384402 --local -sd /usr/local/airflow/dags/my_dag.py
>  /bin/sh: exec: line 1: bash: not found
>  [2018-06-22 21:05:20,671] \{local_executor.py:50} ERROR - Failed to execute task Command
'exec bash -c 'airflow run DAG_1 my_task 2018-06-22T21:05:19.384402 --local -sd /usr/local/airflow/dags/my_dag.py''
returned non-zero exit status 127..
>  /bin/sh: exec: line 1: bash: not found
> ```



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

Mime
View raw message