alessandro trinca tornidor
commited on
Commit
·
5a8199e
1
Parent(s):
dbcbde8
ci: add HEALTH_MODELS env variable to make /health_models check optional
Browse files- scripts/healthcheck.py +13 -3
scripts/healthcheck.py
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
def run_healthcheck():
|
3 |
import os
|
@@ -14,9 +18,15 @@ def run_healthcheck():
|
|
14 |
|
15 |
r1 = requests.get(url1)
|
16 |
app_logger.info(r1.status_code)
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
if __name__ == "__main__":
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
HEALTH_MODELS = os.getenv("HEALTH_MODELS", "")
|
4 |
+
|
5 |
|
6 |
def run_healthcheck():
|
7 |
import os
|
|
|
18 |
|
19 |
r1 = requests.get(url1)
|
20 |
app_logger.info(r1.status_code)
|
21 |
+
msg = f"status health:{r1.status_code}!"
|
22 |
+
if HEALTH_MODELS:
|
23 |
+
r2 = requests.get(url2)
|
24 |
+
msg += f" status health_models:{r2.status_code}!"
|
25 |
+
app_logger.info(msg)
|
26 |
+
sys.exit(0) if r1.status_code == 200 and r2.status_code == 200 else sys.exit(1)
|
27 |
+
app_logger.info(msg)
|
28 |
+
sys.exit(0) if r1.status_code == 200 else sys.exit(1)
|
29 |
+
|
30 |
|
31 |
|
32 |
if __name__ == "__main__":
|