Skip to content

Commit

Permalink
Merge pull request #126 from meedan/cv2-5709-no-http-on-worker
Browse files Browse the repository at this point in the history
CV2-5709 dont start http servers on workers
  • Loading branch information
DGaffney authored Nov 18, 2024
2 parents 3828efb + caf1549 commit 7dd7544
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions start_all.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/sh

# Start the first process in the background
uvicorn main:app --host 0.0.0.0 --port ${PRESTO_PORT} --reload &
if [ "$ROLE" != "worker" ]; then
# Start the HTTP server process in the background if not a worker
uvicorn main:app --host 0.0.0.0 --port ${PRESTO_PORT} --reload &
fi

# Check if ROLE is set to "worker" and start workers if true
if [ "$ROLE" = "worker" ]; then
# Start worker processes
NUM_WORKERS=${NUM_WORKERS:-1} # Default to 1 worker if not specified

for i in $(seq 1 $NUM_WORKERS)
Expand All @@ -16,9 +18,9 @@ if [ "$ROLE" = "worker" ]; then
echo "run_worker.py instance $i exited. Restarting..."
sleep 30 # Prevent potential rapid restart loop
done
) & # run workers as background processes
) & # Run workers as background processes
done
fi

# Start the second process in the foreground
python run_processor.py
# Start the processor process in the foreground
python run_processor.py

0 comments on commit 7dd7544

Please sign in to comment.