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 2022/08/17 20:31:31 UTC

[GitHub] [airflow] hfzvc opened a new issue, #25778: provide_context: False provided to PythonOperator raises Airflow Exception, provide_context: True is allowed

hfzvc opened a new issue, #25778:
URL: https://github.com/apache/airflow/issues/25778

   ### Apache Airflow version
   
   2.3.3
   
   ### What happened
   
   While moving to Airflow 2.x our team noticed a strange thing occur in a recent DAG we were converting to Airflow 2.x code.
   
   When using `PythonOperator`s and setting `provide_context: False`, Airflow Webserver will raise an AirflowException that invalid arguments were passed to `PythonOperator`.
   
   If we set `provide_context: True`, this error goes away with no complaint from the DAG.
   
   ### What you think should happen instead
   
   As the update.md for Airflow 2.x states that `provide_context` is now removed from `PythonOperators`, whether the value is set to `True` or `False` should be irrelevant? That is an error should be raised either way, as the argument would be technically an invalid argument irrespective of the value set.
   
   ### How to reproduce
   
   ```
   dag = DAG("irrelevant_args", schedule_interval=None, start_date=datetime(2022, 3, 8))
   PythonOperator(task_id='Task_A', python_callable=lambda x: x, op_args=[], dag=dag, provide_context=True) # This is fine
   PythonOperator(task_id='Task_B', python_callable=lambda x: x, op_args=[], dag=dag, provide_context=False) # This will raise a DAG Import Error in webserver
   ```
   
   ### Operating System
   
   Debian GNU/Linux 11 (bullseye)
   
   ### Versions of Apache Airflow Providers
   
   N/A
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on issue #25778: provide_context: False provided to PythonOperator raises Airflow Exception, provide_context: True is allowed

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

   This is OK. the import error is because provide_context =False is invalid and it fails your DAG. Where provide_context=True works as expected (because context is always provided). So all is fine here.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] hfzvc commented on issue #25778: provide_context: False provided to PythonOperator raises Airflow Exception, provide_context: True is allowed

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

   Awesome, thank you for that explanation.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on issue #25778: provide_context: False provided to PythonOperator raises Airflow Exception, provide_context: True is allowed

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

   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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk closed issue #25778: provide_context: False provided to PythonOperator raises Airflow Exception, provide_context: True is allowed

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #25778: provide_context: False provided to PythonOperator raises Airflow Exception, provide_context: True is allowed
URL: https://github.com/apache/airflow/issues/25778


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org