rawwar commented on code in PR #37297:
URL: https://github.com/apache/airflow/pull/37297#discussion_r1484897715
##########
airflow/models/taskinstance.py:
##########
@@ -450,7 +450,16 @@ def _execute_callable(context, **execute_callable_kwargs):
else:
xcom_value = None
if xcom_value is not None: # If the task returns a result, push an
XCom containing it.
- task_instance.xcom_push(key=XCOM_RETURN_KEY, value=xcom_value,
session=session)
+ if task_to_execute.multiple_outputs:
+ if not isinstance(xcom_value, Mapping):
+ raise AirflowException(
+ "The returned value from the task is not a Mapping.
The `multiple_outputs`"
+ "parameter is set to True, so the result has to be a
Mapping."
+ )
+ for key, value in xcom_value.items():
Review Comment:
An alternative I can think of is using `return_value_count`(or probably some
good variable name for this) instead of just `multiple_outputs`. But, just a
suggestion.
--
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]