Naved commited on
Commit
03b540b
·
verified ·
1 Parent(s): 0827d30

Delete run.sh

Browse files
Files changed (1) hide show
  1. run.sh +0 -44
run.sh DELETED
@@ -1,44 +0,0 @@
1
- # Start the cog server in the background - Ensure correct path to cog
2
- cd /src && python3 -m cog.server.http --threads=10 &
3
-
4
- # Initialize counter for the first loop
5
- counter1=0
6
-
7
- # Continuous loop for reliably checking cog server's readiness on port 5000
8
- while true; do
9
- if nc -z localhost 5000; then
10
- echo "Cog server is running on port 5000."
11
- break # Exit the loop when the server is up
12
- fi
13
- echo "Waiting for cog server to start on port 5000..."
14
- sleep 5
15
- ((counter1++))
16
- if [ $counter1 -ge 250 ]; then
17
- echo "Error: Cog server did not start on port 5000 after 250 attempts."
18
- exit 1 # Exit the script with an error status
19
- fi
20
- done
21
-
22
- # Initialize counter for the second loop
23
- counter2=0
24
-
25
- # New check: Waiting for the cog server to be fully ready
26
- while true; do
27
- response=$(curl -s http://localhost:5000/health-check) # Replace localhost:5000 with actual hostname and port if necessary
28
- status=$(echo $response | jq -r '.status') # Parse status from JSON response
29
- if [ "$status" = "READY" ]; then
30
- echo "Cog server is fully ready."
31
- break # Exit the loop when the server is fully ready
32
- else
33
- echo "Waiting for cog server (models loading) on port 5000..."
34
- sleep 5
35
- fi
36
- ((counter2++))
37
- if [ $counter2 -ge 250 ]; then
38
- echo "Error: Cog server did not become fully ready after 250 attempts."
39
- exit 1 # Exit the script with an error status
40
- fi
41
- done
42
-
43
- # Run the application - only when cog server is fully ready
44
- cd $HOME/app && . $HOME/.venv/bin/activate && python app.py