ashb commented on a change in pull request #6870: [AIRFLOW-0578] Check return 
code
URL: https://github.com/apache/airflow/pull/6870#discussion_r376487438
 
 

 ##########
 File path: airflow/jobs/local_task_job.py
 ##########
 @@ -95,6 +95,14 @@ def signal_handler(signum, frame):
                 # Monitor the task to see if it's done
                 return_code = self.task_runner.return_code()
                 if return_code is not None:
+                    if return_code != 0:
+                        self.task_instance.refresh_from_db()
+                        # there is one case we should not treat non zero return
+                        # code as failed: the job has been killed externally.
+                        if (not self.terminating) or self.task_instance.state 
== State.FAILED:
 
 Review comment:
   How does `state="failed"` relate to job been killed externally?
   
   I'm also not that happy about having very similar conditions here and inside 
on_failure. And again: Why throw an exception only to have it caught later, why 
not just call `self.on_failure`?

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