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 2021/01/11 22:02:49 UTC

[GitHub] [airflow] fjmacagno opened a new issue #13623: Error passing `provide_context` to ShortCircuitOperator if value `False`

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



[GitHub] [airflow] boring-cyborg[bot] commented on issue #13623: Error passing `provide_context` to ShortCircuitOperator if value `False`

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


   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



[GitHub] [airflow] eladkal commented on issue #13623: Error passing `provide_context` to ShortCircuitOperator if value `False`

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


   ShortCircuitOperator inherits from PythonOperator.
   As explained in [Updating.md](https://github.com/apache/airflow/blob/master/UPDATING.md#airflowoperatorspythonpythonoperator) in Airflow 2.0 `provide_context` argument on the PythonOperator was removed and there is no need to explicitly provide or not provide the context anymore.
   
   So your code should be:
   ```
   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,
           op_args=(False))
   
   ```
   
   Closing as this is not a bug.


----------------------------------------------------------------
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] eladkal closed issue #13623: Error passing `provide_context` to ShortCircuitOperator if value `False`

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


   


----------------------------------------------------------------
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] fjmacagno commented on issue #13623: Error passing `provide_context` to ShortCircuitOperator if value `False`

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


   Fair enough, thanks!


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