Implements a generic and expandable health monitoring for sub-processes and use it to monitor the health of Airflow components based on health metrics and database connectivity.
To keep the implementation generic and make it expandable for future requirements, I introduced the concept of process conditions. Conditions runs regular and do certain checks to determine whether the process should continue or it should be stopped. For example, for a time-limited process, e.g. requirements installation, the TimeoutCondition can be used. Or, if a process needs to connect to the Airflow database, then the AirflowDbHealthCondition can be employed. This makes it easy in the future to add further conditions and easily plug them to any subprocess.
For now, the following process conditions are introduced:
AirflowDbHealthCondition: Ensures the connectivity with the Airflow database.
SidecarHealthCondition: Monitors the health of a scheduler or a worker based on signals from the sidecar (part of MWAA setup, and thus won't work currently with the open source setup.)
TimeoutCondition: Ensures a process finishes within a specified time.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available: #16
Description of changes:
Implements a generic and expandable health monitoring for sub-processes and use it to monitor the health of Airflow components based on health metrics and database connectivity.
To keep the implementation generic and make it expandable for future requirements, I introduced the concept of process conditions. Conditions runs regular and do certain checks to determine whether the process should continue or it should be stopped. For example, for a time-limited process, e.g. requirements installation, the
TimeoutCondition
can be used. Or, if a process needs to connect to the Airflow database, then theAirflowDbHealthCondition
can be employed. This makes it easy in the future to add further conditions and easily plug them to any subprocess.For now, the following process conditions are introduced:
AirflowDbHealthCondition
: Ensures the connectivity with the Airflow database.SidecarHealthCondition
: Monitors the health of a scheduler or a worker based on signals from the sidecar (part of MWAA setup, and thus won't work currently with the open source setup.)TimeoutCondition
: Ensures a process finishes within a specified time.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.