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 2021/12/02 10:23:39 UTC
[GitHub] [airflow] ephraimbuddy commented on a change in pull request #19950: Add clear logging to tasks killed due to a Dagrun timeout
ephraimbuddy commented on a change in pull request #19950:
URL: https://github.com/apache/airflow/pull/19950#discussion_r760953410
##########
File path: airflow/jobs/local_task_job.py
##########
@@ -208,6 +208,14 @@ def heartbeat_callback(self, session=None):
)
raise AirflowException("PID of job runner does not match")
elif self.task_runner.return_code() is None and hasattr(self.task_runner, 'process'):
+ if ti.state == State.SKIPPED:
+ # if the task was externally marked as skipped, its likely due to a timeout.
+ dagrun = ti.get_dagrun()
+ if dagrun.end_date:
+ execution_time = dagrun.end_date - dagrun.start_date
+ dagrun_timeout = dagrun.get_dag().dagrun_timeout
+ if dagrun_timeout and execution_time > dagrun_timeout:
+ self.log.warning("DagRun timed out after %s.", str(execution_time))
Review comment:
```suggestion
dagrun = ti.dag_run
if dagrun.end_date:
execution_time = dagrun.end_date - dagrun.start_date
dagrun_timeout = ti.task.dag.dagrun_timeout
if dagrun_timeout and execution_time > dagrun_timeout:
self.log.warning("DagRun timed out after %s.", str(execution_time))
```
Can you try if this will work
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org