jannisko commented on code in PR #37297:
URL: https://github.com/apache/airflow/pull/37297#discussion_r1485018215
##########
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:
I would argue since it's an explicit parameter, the dag author should be
responsible for making sure they aren't overloading the xcom. I believe that
Airflow already doesn't limit xcom sizes, but instead it's just a warning in
the documentation. It could be the same for the split values.
There is also no limit in the existing implementation for the decorator
tasks:
https://github.com/apache/airflow/blob/8fac799a250a222bf85d484947a9b3f2065d5ba4/airflow/decorators/base.py#L244
--
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]