Created
July 11, 2021 06:53
-
-
Save sayakpaul/b23c9c86dadcb6b89ff790d90d8b0163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_healthz import healthz | |
from flask_healthz import HealthError | |
app = Flask(__name__) | |
app.register_blueprint(healthz, url_prefix="/") | |
def printok(): | |
print("Everything is fine") | |
def liveness(): | |
try: | |
printok() | |
except Exception: | |
raise HealthError("Can't connect to the file") | |
def readiness(): | |
try: | |
printok() | |
except Exception: | |
raise HealthError("Can't connect to the file") | |
app.config.update( | |
HEALTHZ = { | |
"alive": "main.liveness", | |
"ready": "main.readiness", | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment