fjmacagno opened a new issue #13623:
URL: https://github.com/apache/airflow/issues/13623


   **Apache Airflow version**: 2.0
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: Local docker image
   - **OS** (e.g. from /etc/os-release): OSX
   - **Kernel** (e.g. `uname -a`): Linux a40a8eb931e9 4.19.121-linuxkit #1 SMP 
Tue Dec 1 17:50:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
   - **Install tools**: pip3
   - **Others**:
   
   **What happened**:
   ```
   ERROR - Failed to import: /usr/local/airflow/dags/test_dag.py
   Traceback (most recent call last):
     File "/usr/local/lib/python3.8/site-packages/airflow/models/dagbag.py", 
line 294, in _load_modules_from_file
       loader.exec_module(new_module)
     File "<frozen importlib._bootstrap_external>", line 783, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
     File "/usr/local/airflow/dags/test_dag.py", line 5, in <module>
       task = ShortCircuitOperator(
     File 
"/usr/local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 
89, in __call__
       obj: BaseOperator = type.__call__(cls, *args, **kwargs)
     File "/usr/local/lib/python3.8/site-packages/airflow/utils/decorators.py", 
line 94, in wrapper
       result = func(*args, **kwargs)
     File "/usr/local/lib/python3.8/site-packages/airflow/operators/python.py", 
line 101, in __init__
       super().__init__(**kwargs)
     File "/usr/local/lib/python3.8/site-packages/airflow/utils/decorators.py", 
line 94, in wrapper
       result = func(*args, **kwargs)
     File 
"/usr/local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 
392, in __init__
       raise AirflowException(
   airflow.exceptions.AirflowException: Invalid arguments were passed to 
ShortCircuitOperator (task_id: check). Invalid arguments were:
   **kwargs: {'provide_context': False}
   ```
   
   **What you expected to happen**:
   
   No error
   
   **How to reproduce it**:
   DAG:
   ```
   from airflow.operators.python import ShortCircuitOperator
   from airflow import DAG
   
   with DAG(dag_id="ASD") as dag:
       task = ShortCircuitOperator(
           task_id="check",
           python_callable=lambda var: not var,
           provide_context=False,
           op_args=(False))
   ```
   Run `python3 -c 'from airflow.models.dagbag import DagBag; DagBag();'`
   
   
   **Anything else we need to know**:
   If in the dag you set `provide_context=True`, there is no error.
   
   Admittedly not a big problem since false is default, but some of my users do 
this anyway.
   
   


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