jedcunningham commented on a change in pull request #22143:
URL: https://github.com/apache/airflow/pull/22143#discussion_r823867006



##########
File path: chart/templates/_helpers.yaml
##########
@@ -607,6 +607,42 @@ Create the name of the cleanup service account to use
   {{- end }}
 {{- end }}
 
+{{define "scheduler_liveness_check_command"}}
+
+  {{- if semverCompare ">=2.0.0" .Values.airflowVersion }}
+  - sh
+  - -c
+  - |
+    CONNECTION_CHECK_MAX_COUNT=0 exec /entrypoint bash -c \
+    "export AIRFLOW__LOGGING__LOGGING_LEVEL=ERROR && export 
AIRFLOW__CORE__LOGGING_LEVEL=ERROR && \

Review comment:
       ```suggestion
       "export AIRFLOW__LOGGING__LOGGING_LEVEL=ERROR && \
   ```
   
   With 2.0.0+, this should be enough now.

##########
File path: chart/templates/_helpers.yaml
##########
@@ -607,6 +607,42 @@ Create the name of the cleanup service account to use
   {{- end }}
 {{- end }}
 
+{{define "scheduler_liveness_check_command"}}
+
+  {{- if semverCompare ">=2.0.0" .Values.airflowVersion }}
+  - sh
+  - -c
+  - |
+    CONNECTION_CHECK_MAX_COUNT=0 exec /entrypoint bash -c \
+    "export AIRFLOW__LOGGING__LOGGING_LEVEL=ERROR && export 
AIRFLOW__CORE__LOGGING_LEVEL=ERROR && \
+    airflow jobs check --job-type SchedulerJob --hostname $(hostname)"
+  {{- else }}
+  - sh
+  - -c
+  - |
+    CONNECTION_CHECK_MAX_COUNT=0 exec /entrypoint python -Wignore -c "
+    import os
+    os.environ['AIRFLOW__CORE__LOGGING_LEVEL'] = 'ERROR'
+    os.environ['AIRFLOW__LOGGING__LOGGING_LEVEL'] = 'ERROR'
+    from airflow.jobs.scheduler_job import SchedulerJob
+    from airflow.utils.db import create_session
+    from airflow.utils.net import get_hostname
+    import sys
+    with create_session() as session:
+        job = 
session.query(SchedulerJob).filter_by(hostname=get_hostname()).order_by(
+            SchedulerJob.latest_heartbeat.desc()).limit(1).first()
+    sys.exit(0 if job.is_alive() else 1)"
+  {{- end }}
+{{- end }}
+{{define "triggerer_liveness_check_command"}}

Review comment:
       ```suggestion
   
   {{define "triggerer_liveness_check_command"}}
   ```

##########
File path: chart/templates/scheduler/scheduler-deployment.yaml
##########
@@ -165,9 +165,11 @@ spec:
             periodSeconds: {{ .Values.scheduler.livenessProbe.periodSeconds }}
             exec:
               command:
-{{- with .Values.scheduler.livenessProbe.command }}
-{{ toYaml . | indent 16 }}
-{{- end }}
+                  {{- if .Values.scheduler.livenessProbe.command }}
+                  {{ toYaml .Values.scheduler.livenessProbe.command  | indent 
16 }}
+                  {{- else}}
+                  {{- include "scheduler_liveness_check_command" . | indent 16 
}}

Review comment:
       ```suggestion
                     {{ toYaml .Values.scheduler.livenessProbe.command  | 
nindent 16 }}
                     {{- else}}
                     {{- include "scheduler_liveness_check_command" . | nindent 
16 }}
   ```
   
   We want this, no?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to