Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI check for scheduler(s) #14519

Merged
merged 1 commit into from
Feb 28, 2021
Merged

Add CLI check for scheduler(s) #14519

merged 1 commit into from
Feb 28, 2021

Conversation

mik-laj
Copy link
Member

@mik-laj mik-laj commented Feb 28, 2021

Part of: #11161

I miss a simple method to check if the scheduler is in good health, so I added a command that allows me to do it. Additionally, I updated docker-compose.yaml to take use it

For now, we've been doing without this command because we had a Python script implemented that did similar behavior, but that doesn't look right.

- 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)

I am not updating the Helm Chart yet to keep compatibilityy with Airflow 1.10, but when we drop support for Aiirflow 1.10, we will be able to use it.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

Comment on lines 130 to 132
return True
if value > 0:
return value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value is either bool or an int - is this inconsistency expected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks

@@ -20,6 +20,11 @@
Checking Airflow Health Status
==============================

Airflow has two methods to check the health of components. Their choice depends on the role of the component as well as what tools it uses to monitor the application.
Copy link
Member

@turbaszek turbaszek Feb 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the second method? This section (as defined by ====) mentions only API endpoint

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks

@github-actions
Copy link

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@mik-laj mik-laj changed the title Add CLI check for scheduler Add CLI check for scheduler(s) Feb 28, 2021
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Feb 28, 2021
@mik-laj mik-laj merged commit f25ec33 into apache:master Feb 28, 2021
potiuk pushed a commit that referenced this pull request Mar 3, 2021
Co-authored-by: Kamil Breguła <kamilbregula@apache.org>
(cherry picked from commit f25ec33)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:CLI kind:documentation okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants