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 2019/10/30 12:47:26 UTC

[GitHub] [airflow] Fokko commented on a change in pull request #6461: [AIRFLOW-5804] Batch the xcom pull operation

Fokko commented on a change in pull request #6461: [AIRFLOW-5804] Batch the xcom pull operation
URL: https://github.com/apache/airflow/pull/6461#discussion_r340592142
 
 

 ##########
 File path: airflow/models/taskinstance.py
 ##########
 @@ -1376,17 +1375,20 @@ def xcom_pull(
         if dag_id is None:
             dag_id = self.dag_id
 
-        pull_fn = functools.partial(
-            XCom.get_one,
+        result = XCom.compose_query(
             execution_date=self.execution_date,
             key=key,
             dag_id=dag_id,
-            include_prior_dates=include_prior_dates)
+            task_id=task_ids,
+            include_prior_dates=include_prior_dates
+        )
 
         if is_container(task_ids):
-            return tuple(pull_fn(task_id=t) for t in task_ids)
+            return [XCom.deserialize_value(xcom) for xcom in result.all()]
 
 Review comment:
   Good point Ash, I've missed the `@reconstructor` and this caused tests to fail. I've added the `.with_entities(XCom.value)` to the query, and therefore we bypass the reconstructor. I must admit that I'm not a big fan of the `@reconstructor` in general (Explicit is better than implicit). The `.with_entities` will only fetch the `value` object, therefore we only select this field from the database.

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


With regards,
Apache Git Services