lucafuji commented on a change in pull request #6870: [AIRFLOW-0578] Check
return code
URL: https://github.com/apache/airflow/pull/6870#discussion_r372642576
##########
File path: airflow/jobs/local_task_job.py
##########
@@ -95,6 +95,15 @@ 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:
+ print(self.task_instance.state)
+ # there is one case we should not treat non zero return
+ # code as failed: the job has been killed externally.
+ if return_code != 0 and ((not self.terminating) or
+ self.task_instance.state ==
Review comment:
> Additionally though: why do we care about calling on-failure/raising when
the task_instance is already set to failure.
>
> You are overloading two subtly different concepts here:
>
> 1. The task executed to completion, but it was marked as a failure.
> 2. The task process died without managing to tidy up.
>
> Case 1 is already handled and the TI ends up in a "terminal" state
successfully. It's Case 2 is the only place we need to change. What do you
think?
In theory there is only one case, the process exited with non zero exit
code. We need to set the correct states for task and job.
1. The task state may or may not be set correctly, that's what on_failure is
handling.
2. The job state is definitely not set as FAILED, so that's why raise
another exception to let BaseJob to handle this.
----------------------------------------------------------------
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