You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2021/11/05 23:24:53 UTC

[airflow] 01/06: Check if job object is None before calling .is_alive() (#19380)

This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 36c7308d9250b5804af3e8d183562fc680808552
Author: Jonathan Fernandes <in...@yahoo.in>
AuthorDate: Wed Nov 3 12:49:49 2021 +0530

    Check if job object is None before calling .is_alive() (#19380)
    
    Co-authored-by: Jonathan Fernandes <jf...@virtela.net>
    (cherry picked from commit 5c157047b2cc887130fb46fd1a9e88a354c1fb19)
---
 airflow/cli/commands/standalone_command.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/airflow/cli/commands/standalone_command.py b/airflow/cli/commands/standalone_command.py
index 58c24fb..41c1684 100644
--- a/airflow/cli/commands/standalone_command.py
+++ b/airflow/cli/commands/standalone_command.py
@@ -228,7 +228,10 @@ class StandaloneCommand:
         Checks if the given job name is running and heartbeating correctly
         (used to tell if scheduler is alive)
         """
-        return job.most_recent_job().is_alive()
+        recent = job.most_recent_job()
+        if not recent:
+            return False
+        return recent.is_alive()
 
     def print_ready(self):
         """