implement health query for monitoring

This commit is contained in:
Yannik Schmidt
2020-06-22 21:31:33 +02:00
parent 02dc8a8371
commit 5e21681efa
2 changed files with 33 additions and 0 deletions

View File

@@ -17,6 +17,14 @@ def run(port, parser):
app.run(port=port)
## SERVER QUERIES ###
@app.route('/health')
def health():
try:
count, avgPred = db.check()
return ("Rounds: {}, AvgPrediction (lower than 0.5 is good): {}".format(count, avgPred))
except AssertionError as e:
return ("{}".format(e), 200)
@app.route('/get-player-rating-msg')
def getPlayer():
playerId = flask.request.args.get("id")