oferze opened a new issue #13108:
URL: https://github.com/apache/airflow/issues/13108


   My Windows 10 machine has Airflow 1.10.11 installed within WSL 2 
(Ubuntu-20.04).
   
   I have a `BashOperator` task which invokes an .EXE on Windows (via 
`/mnt/c/...` or via symlink).
   The task fails. Log shows:
   
   ```
   [2020-12-16 18:34:11,833] {bash_operator.py:134} INFO - Temporary script 
location: /tmp/airflowtmp2gz6d79p/download.legacyFilesnihvszli
   [2020-12-16 18:34:11,833] {bash_operator.py:146} INFO - Running command: 
/mnt/c/Windows/py.exe
   [2020-12-16 18:34:11,836] {bash_operator.py:153} INFO - Output:
   [2020-12-16 18:34:11,840] {bash_operator.py:159} INFO - Command exited with 
return code 1
   [2020-12-16 18:34:11,843] {taskinstance.py:1150} ERROR - Bash command failed
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.8/dist-packages/airflow/models/taskinstance.py", line 
984, in _run_raw_task
       result = task_copy.execute(context=context)
     File 
"/usr/local/lib/python3.8/dist-packages/airflow/operators/bash_operator.py", 
line 165, in execute
       raise AirflowException("Bash command failed")
   airflow.exceptions.AirflowException: Bash command failed
   [2020-12-16 18:34:11,844] {taskinstance.py:1187} INFO - Marking task as 
FAILED. dag_id=test-dag, task_id=download.files, 
execution_date=20201216T043701, start_date=20201216T073411, 
end_date=20201216T073411
   ```
   
   And that's it. Return code `1` with no further useful info.
   
   Running the very same EXE via bash works perfectly, with no error (I also 
tried it on my own program which emits something to the console - in bash it 
emits just fine, but via `airflow scheduler` it's the same error 1).
   
   **Some more data and things I've done to rule out any other issue:**
   
   * `airflow scheduler` runs as root. I also confirmed it's running in a 
`root` context by putting an `whoami` command in my BashOperator, which indeed 
emitted `root` (I should also note that all native Linux programs run just 
fine! only the Windows programs don't.)
   * The Windows EXE I'm trying to execute and its directory have full 
'Everyone' permissions (on my own program of course, wouldn't dare doing it on 
my Windows folder - that was just an example.)
   * The failure happens both when accessing via /mnt/c as well as via symlink. 
In the case of a symlink, the symlink has 777 permissions.
   * I tried running `airflow test` on a BashOperator task - it runs perfectly 
- emits output to the console and returns 0 (success).
   * Tried with various EXE files - both "native" (e.g. ones that come with 
Windows) as well as my C#-made programs. Same behavior in all.
   * Didn't find any similar issue documented in Airflow's GitHub repo nor here 
in Stack Overflow.
   
   **The question is: what might cause an `error 1` just when running via 
airflow scheduler, and how to fix?**
   
   Alternatively, is there a way to get more insight into the log produced by 
the `airflow scheduler` run? i.e. to see "what happened" that makes it return 
error 1 on certain commands.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to