From a5a4974de977b03c0c92e3f0503e066ce73103e2 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 1 Jul 2024 16:12:33 +0800 Subject: [PATCH] Refresh data outside of main because flask loads this script in production --- ml/digest-score/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ml/digest-score/app.py b/ml/digest-score/app.py index 0e83dab9d..8d1000b40 100644 --- a/ml/digest-score/app.py +++ b/ml/digest-score/app.py @@ -215,6 +215,8 @@ def batch(): app.logger.error(f"exception in batch endpoint: {request.get_json()}\n{e}") return jsonify({'error': str(e)}), 500 +## Run this on startup in both production and development modes +refresh_data() + if __name__ == '__main__': - refresh_data() app.run(debug=True, port=5000) \ No newline at end of file