You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/07/29 07:33:46 UTC

[GitHub] [airflow] ckdarby opened a new issue #10040: Importing 'BashOperator' directly from 'airflow.operators' only way module loads

ckdarby opened a new issue #10040:
URL: https://github.com/apache/airflow/issues/10040


   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
   Don't worry if they're not all applicable; just try to include what you can :-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   <!--
   
   IMPORTANT!!!
   
   PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
   NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
   
   PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
   
   Please complete the next sections or the issue will be closed.
   This questions are the first thing we need to know to understand the context.
   
   -->
   
   **Apache Airflow version**: 1.10.10
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   `Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
   Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.6-eks-4e7f64", GitCommit:"4e7f642f9f4cbb3c39a4fc6ee84fe341a8ade94c", GitTreeState:"clean", BuildDate:"2020-06-11T13:55:35Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
   `
   
   **Environment**:
   
   - **Install Tool**:
   `helm install stable/airflow  --namespace "airflow" --generate-name`
   
   **What happened**:
   
   Using the examples from here & running `python` or `airflow list_dags` would result in:
   ```text
   [2020-07-29 00:14:17,178] {dagbag.py:239} ERROR - Failed to import: /opt/airflow/dags/example_bash_operator.py
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.6/site-packages/airflow/models/dagbag.py", line 236, in process_file
       m = imp.load_source(mod_name, filepath)
     File "/usr/local/lib/python3.6/imp.py", line 172, in load_source
       module = _load(spec)
     File "<frozen importlib._bootstrap>", line 684, in _load
     File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 678, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
     File "/opt/airflow/dags/example_bash_operator.py", line 24, in <module>
       from airflow.operators.bash import BashOperator
   ModuleNotFoundError: No module named 'airflow.operators.bash'
   '```
   
   Worked when I switched to the deprecated way of importing it:
   ```diff
   -from airflow.operators.bash import BashOperator
   +from airflow.operators import BashOperator
   ```
   
   **What you expected to happen**:
   Module to properly load and not require me to use the deprecated import.
   
   
   **How to reproduce it**:
   
   ```shell
   # Repo with the examples
   helm install stable/airflow  --namespace "airflow" --generate-name
   ```
   
   ```shell
   #Attempt to list dags
   kubectl exec --namespace airflow -it $SCHEDULER_NAME -- /bin/bash
   
   airflow list_dags
   ```
   


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



[GitHub] [airflow] ckdarby closed issue #10040: Importing 'BashOperator' directly from 'airflow.operators' only way module loads

Posted by GitBox <gi...@apache.org>.
ckdarby closed issue #10040:
URL: https://github.com/apache/airflow/issues/10040


   


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



[GitHub] [airflow] ckdarby commented on issue #10040: Importing 'BashOperator' directly from 'airflow.operators' only way module loads

Posted by GitBox <gi...@apache.org>.
ckdarby commented on issue #10040:
URL: https://github.com/apache/airflow/issues/10040#issuecomment-665732064


   I was reading the master branch examples and it looks like there was a major refactor of module imports.
   
   Obviously once I switched the branch over to the current tag I'm using the examples switched to the prior way and I was able to use those examples correctly.


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



[GitHub] [airflow] boring-cyborg[bot] commented on issue #10040: Importing 'BashOperator' directly from 'airflow.operators' only way module loads

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #10040:
URL: https://github.com/apache/airflow/issues/10040#issuecomment-665367610


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


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