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/01/19 10:09:31 UTC

[GitHub] [airflow] ephraimbuddy commented on a change in pull request #20931: Set dependencies in MappedOperator via XComArgs

ephraimbuddy commented on a change in pull request #20931:
URL: https://github.com/apache/airflow/pull/20931#discussion_r787576941



##########
File path: airflow/serialization/serialized_objects.py
##########
@@ -970,6 +997,14 @@ def deserialize_dag(cls, encoded_dag: Dict[str, Any]) -> 'SerializedDAG':
             if serializable_task.subdag is not None:
                 setattr(serializable_task.subdag, 'parent_dag', dag)
 
+            if isinstance(task, MappedOperator):
+                for d in (task.mapped_kwargs, task.partial_kwargs):
+                    for k in d:
+                        if not isinstance(d[k], _XcomRef):
+                            continue
+
+                        d[k] = XComArg(operator=dag.get_task(d[k].task_id), key=d[k].key)

Review comment:
       ```suggestion
                       for k, v in d.items():
                           if not isinstance(v, _XcomRef):
                               continue
   
                           d[k] = XComArg(operator=dag.get_task(v.task_id), key=v.key)
   ```
   Wondering if this would be easier to read this way




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