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

   ### Apache Airflow version
   
   2.3.2 (latest released)
   
   ### What happened
   
   Testing example_xcom_args via CLI throws following exception.
   ````
   airflow.exceptions.AirflowException: XComArg result from generate_value at 
example_xcom_args with key="return_value" is not found!
   
   full exception stack:
   [2022-06-05 08:46:48,081] {taskinstance.py:1889} ERROR - Task failed with 
exception
   Traceback (most recent call last):
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 
1451, in _run_raw_task
       self._execute_task_with_callbacks(context, test_mode)
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 
1555, in _execute_task_with_callbacks
       task_orig = self.render_templates(context=context)
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 
2212, in render_templates
       rendered_task = self.task.render_template_fields(context)
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/baseoperator.py", line 
1185, in render_template_fields
       self._do_render_template_fields(self, self.template_fields, context, 
jinja_env, set())
     File "/venv-af/lib/python3.9/site-packages/airflow/utils/session.py", line 
71, in wrapper
       return func(*args, session=session, **kwargs)
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/abstractoperator.py", line 
344, in _do_render_template_fields
       rendered_content = self.render_template(
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/abstractoperator.py", line 
398, in render_template
       return tuple(self.render_template(element, context, jinja_env) for 
element in value)
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/abstractoperator.py", line 
398, in <genexpr>
       return tuple(self.render_template(element, context, jinja_env) for 
element in value)
     File 
"/venv-af/lib/python3.9/site-packages/airflow/models/abstractoperator.py", line 
394, in render_template
       return value.resolve(context)
     File "/venv-af/lib/python3.9/site-packages/airflow/utils/session.py", line 
71, in wrapper
       return func(*args, session=session, **kwargs)
     File "/venv-af/lib/python3.9/site-packages/airflow/models/xcom_arg.py", 
line 152, in resolve
       raise AirflowException(
   airflow.exceptions.AirflowException: XComArg result from generate_value at 
example_xcom_args with key="return_value" is not found!
   ````
   
   ### What you think should happen instead
   
   It should have return the results without any exception. 
   
   However, test dags works without exceptions. 
   ````
   airflow dags test example_xcom_args 2022-06-05
   ````
   
   It seems that can't test individual tasks via CLI if the task has xcom.  I 
think, since airflow 2.3.x, xcom stores the task results in-memory instead of 
DB, it couldn't retrieve previous task result from xcom.   
   
   ### How to reproduce
   
   Run tasks from airflow example_dags/example_xcomargs.py or example_xcom.py
   
   ````
   airflow tasks test example_xcom_args generate_value 2022-06-05
   airflow tasks test example_xcom_args print_value 2022-06-05
   ````
   
   ### Operating System
   
   Mac OS and Python 3.9.12 
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   I believe it is a regression since airflow 2.3.x release xcom changes.
   
   ### 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: [email protected]

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

Reply via email to