Skip to content

Instantly share code, notes, and snippets.

@sayakpaul
Created July 11, 2021 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayakpaul/b23c9c86dadcb6b89ff790d90d8b0163 to your computer and use it in GitHub Desktop.
Save sayakpaul/b23c9c86dadcb6b89ff790d90d8b0163 to your computer and use it in GitHub Desktop.
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