formating and mointoring change (#136)

This commit is contained in:
Co Tran 2024-10-07 15:21:05 -07:00 committed by GitHub
parent 976b2eaae0
commit 93abe553e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 83 additions and 47 deletions

View file

@ -10,6 +10,7 @@ import tempfile
# Path to the file where the server process ID will be stored
PID_FILE = os.path.join(tempfile.gettempdir(), "model_server.pid")
def run_server():
"""Start, stop, or restart the Uvicorn server based on command-line arguments."""
if len(sys.argv) > 1:
@ -45,10 +46,11 @@ def start_server():
f.write(str(process.pid))
print(f"ARCH GW Model Server started with PID {process.pid}")
else:
#Add model_server boot-up logs
# Add model_server boot-up logs
print(f"ARCH GW Model Server - Didn't Sart In Time. Shutting Down")
process.terminate()
def wait_for_health_check(url, timeout=180):
"""Wait for the Uvicorn server to respond to health-check requests."""
start_time = time.time()
@ -92,6 +94,7 @@ def stop_server():
process.kill() # Forcefully kill the process
os.remove(PID_FILE)
def restart_server():
"""Restart the Uvicorn server."""
print("Check: Is Archgw Model Server running?")