buxizhizhoum commented on a change in pull request #16584:
URL: https://github.com/apache/airflow/pull/16584#discussion_r657022881



##########
File path: airflow/models/dag.py
##########
@@ -1564,72 +1600,78 @@ def filter_task_group(group, parent_group):
             group.upstream_task_ids = 
group.upstream_task_ids.intersection(dag.task_dict.keys())
             group.downstream_task_ids = 
group.downstream_task_ids.intersection(dag.task_dict.keys())
 
-        for t in dag.tasks:
+        for task in dag.tasks:
             # Removing upstream/downstream references to tasks that did not
             # make the cut
-            t._upstream_task_ids = 
t.upstream_task_ids.intersection(dag.task_dict.keys())
-            t._downstream_task_ids = 
t.downstream_task_ids.intersection(dag.task_dict.keys())
+            task._upstream_task_ids = 
task.upstream_task_ids.intersection(dag.task_dict.keys())  # pylint: 
disable=protected-access
+            task._downstream_task_ids = 
task.downstream_task_ids.intersection(dag.task_dict.keys())  # pylint: 
disable=protected-access
 
         if len(dag.tasks) < len(self.tasks):
             dag.partial = True
 
         return dag
 
     def has_task(self, task_id: str):
+        """check whether task specified by task_id belongs to this dag"""
         return task_id in (t.task_id for t in self.tasks)
 
     def get_task(self, task_id: str, include_subdags: bool = False) -> 
BaseOperator:
+        """get task from dag"""
         if task_id in self.task_dict:
             return self.task_dict[task_id]
         if include_subdags:
-            for dag in self.subdags:
+            for dag in self.subdags:  # pylint: disable=redefined-outer-name
                 if task_id in dag.task_dict:
                     return dag.task_dict[task_id]
         raise TaskNotFound(f"Task {task_id} not found")
 
-    def pickle_info(self):
-        d = {}
-        d['is_picklable'] = True
-        try:
-            dttm = timezone.utcnow()
-            pickled = pickle.dumps(self)
-            d['pickle_len'] = len(pickled)
-            d['pickling_duration'] = str(timezone.utcnow() - dttm)
-        except Exception as e:
-            self.log.debug(e)
-            d['is_picklable'] = False
-            d['stacktrace'] = traceback.format_exc()
-        return d
+    # def pickle_info(self):
+    #     d = {}
+    #     d['is_picklable'] = True
+    #     try:
+    #         dttm = timezone.utcnow()
+    #         pickled = pickle.dumps(self)
+    #         d['pickle_len'] = len(pickled)
+    #         d['pickling_duration'] = str(timezone.utcnow() - dttm)
+    #     except Exception as e:
+    #         self.log.debug(e)
+    #         d['is_picklable'] = False
+    #         d['stacktrace'] = traceback.format_exc()
+    #     return d

Review comment:
       It is better than what I did, thanks for the advice.




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


Reply via email to