kaxil commented on a change in pull request #6601: [AIRFLOW-6010] Remove cyclic 
imports and pylint disables
URL: https://github.com/apache/airflow/pull/6601#discussion_r348517076
 
 

 ##########
 File path: airflow/serialization/serialized_dag.py
 ##########
 @@ -111,27 +95,26 @@ def deserialize_dag(cls, encoded_dag: dict) -> 
"SerializedDAG":
 
             setattr(dag, k, v)
 
-        # pylint: disable=protected-access
-        keys_to_set_none = dag._serialized_fields - encoded_dag.keys() - 
cls._CONSTRUCTOR_PARAMS.keys()
+        keys_to_set_none = dag.get_serialized_fields() - encoded_dag.keys() - 
cls._CONSTRUCTOR_PARAMS.keys()
         for k in keys_to_set_none:
             setattr(dag, k, None)
 
         setattr(dag, 'full_filepath', dag.fileloc)
         for task in dag.task_dict.values():
             task.dag = dag
-            task = cast(SerializedBaseOperator, task)
+            serializable_task: SerializedBaseOperator = 
cast(SerializedBaseOperator, task)
 
             for date_attr in ["start_date", "end_date"]:
-                if getattr(task, date_attr) is None:
-                    setattr(task, date_attr, getattr(dag, date_attr))
+                if getattr(serializable_task, date_attr) is None:
+                    setattr(serializable_task, date_attr, getattr(dag, 
date_attr))
 
-            if task.subdag is not None:
-                setattr(task.subdag, 'parent_dag', dag)
-                task.subdag.is_subdag = True
+            if serializable_task.subdag is not None:
+                setattr(serializable_task.subdag, 'parent_dag', dag)
+                serializable_task.subdag.is_subdag = True
 
-            for task_id in task.downstream_task_ids:
+            for task_id in serializable_task.downstream_task_ids:
                 # Bypass set_upstream etc here - it does more than we want
-                dag.task_dict[task_id]._upstream_task_ids.add(task_id)  # 
pylint: disable=protected-access
+                dag.task_dict[task_id].upstream_task_ids.add(task_id)
 
 Review comment:
   The DAG.sub_dag uses `_upstream_task_ids`.
   
   Setting `_upstream_task_ids` set `upstream_task_ids` too but not sure if the 
reverse is True.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to