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 2020/01/25 21:36:45 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #7257: [AIRFLOW-6636] Avoid exceptions when printing task instance

potiuk commented on a change in pull request #7257: [AIRFLOW-6636] Avoid exceptions when printing task instance
URL: https://github.com/apache/airflow/pull/7257#discussion_r370957648
 
 

 ##########
 File path: airflow/models/taskinstance.py
 ##########
 @@ -1137,18 +1143,30 @@ def handle_failure(self, error, test_mode=None, context=None, session=None):
                         'dag_id=%s, task_id=%s, execution_date=%s, start_date=%s, end_date=%s',
                         self.dag_id,
                         self.task_id,
-                        self.execution_date.strftime('%Y%m%dT%H%M%S'),
-                        self.start_date.strftime('%Y%m%dT%H%M%S'),
-                        self.end_date.strftime('%Y%m%dT%H%M%S'))
+                        self.execution_date.strftime('%Y%m%dT%H%M%S') if hasattr(
+                            self,
+                            'execution_date') and self.execution_date else '',
+                        self.start_date.strftime('%Y%m%dT%H%M%S') if hasattr(
+                            self,
+                            'start_date') and self.start_date else '',
+                        self.end_date.strftime('%Y%m%dT%H%M%S') if hasattr(
 
 Review comment:
   I agree in principle. It should be as you described. But currently we face different reality. Solving it in the way you describe is much bigger task.
   
   I just want to solve current tests not to show failures where there are no failures at all. Failing exception in "log" is not a good "test" so it does not hide the problem. Logs should never "detect" a problem - they should print the current state of the object and not randomly fail.
   
   Right now in logs you see unrelated failures, you have inconsistency in the way how those attributes are treated - and sometimes you think those are the problems with tests - where they aren't. 
   
   So right now I am not trying to solve this "bigger" problem only the small one. But I created 
   the issue and marked you there https://issues.apache.org/jira/browse/AIRFLOW-6640 to solve the bigger issue. 

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