[ 
https://issues.apache.org/jira/browse/AIRFLOW-2971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17098601#comment-17098601
 ] 

ASF GitHub Bot commented on AIRFLOW-2971:
-----------------------------------------

mik-laj commented on a change in pull request #6277:
URL: https://github.com/apache/airflow/pull/6277#discussion_r419176878



##########
File path: tests/cli/test_cli.py
##########
@@ -488,3 +490,26 @@ def test_run_naive_taskinstance(self, mock_local_job):
             pickle_id=None,
             pool=None,
         )
+
+    @mock.patch("airflow.bin.cli.jobs.SchedulerJob.most_recent_job")
+    def test_health_scheduler(self, mock_most_recent):
+        """
+        Test that the 'scheduler' subcommand for health works
+        """
+        job = SchedulerJob(
+            state='running',
+            latest_heartbeat=timezone.utcnow()
+        )
+        mock_most_recent.return_value = job
+
+        with conf_vars({("scheduler", "scheduler_health_check_threshold"): 
'60'}):
+            with mock.patch('sys.exit') as mock_exit:

Review comment:
       The cat on this method does not sound good because the question will not 
be able to use this method either. Can you catch the SystemExit exception 
instead?




----------------------------------------------------------------
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:
us...@infra.apache.org


> Health check command for scheduler
> ----------------------------------
>
>                 Key: AIRFLOW-2971
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2971
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: scheduler
>            Reporter: Jon Davies
>            Priority: Major
>
> As part of a Kubernetes deployment of Airflow, I would like to define an exec 
> command based health check for the Airflow scheduler:
> - 
> https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
> ...the webserver is simple as all that needs is checking that the HTTP port 
> is available. For the scheduler, it would be neat to have a command such as:
> airflow scheduler health
> That returned OK and exit 0/NOT OK and a non-zero value when it cannot reach 
> the database for instance.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to