Skip to content

Commit

Permalink
Add all tasks to compose, update app to not run a worker, pin numpy t…
Browse files Browse the repository at this point in the history
…o v1
  • Loading branch information
DGaffney committed Jul 3, 2024
1 parent a4ee831 commit a53d4d3
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 14 deletions.
75 changes: 75 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,78 @@ services:
condition: service_healthy
redis:
condition: service_healthy
video:
build: .
platform: linux/amd64
volumes:
- "./:/app"
env_file:
- ./.env_file
environment:
ROLE: worker
MODEL_NAME: video.Model
depends_on:
elasticmq:
condition: service_healthy
redis:
condition: service_healthy
mean_tokens:
build: .
platform: linux/amd64
volumes:
- "./:/app"
env_file:
- ./.env_file
environment:
ROLE: worker
MODEL_NAME: mean_tokens.Model
depends_on:
elasticmq:
condition: service_healthy
redis:
condition: service_healthy
fasttext:
build: .
platform: linux/amd64
volumes:
- "./:/app"
env_file:
- ./.env_file
environment:
ROLE: worker
MODEL_NAME: fasttext.Model
depends_on:
elasticmq:
condition: service_healthy
redis:
condition: service_healthy
fptg:
build: .
platform: linux/amd64
volumes:
- "./:/app"
env_file:
- ./.env_file
environment:
ROLE: worker
MODEL_NAME: fptg.Model
depends_on:
elasticmq:
condition: service_healthy
redis:
condition: service_healthy
indian_sbert:
build: .
platform: linux/amd64
volumes:
- "./:/app"
env_file:
- ./.env_file
environment:
ROLE: worker
MODEL_NAME: indian_sbert.Model
depends_on:
elasticmq:
condition: service_healthy
redis:
condition: service_healthy
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ opentelemetry-api==1.24.0
opentelemetry-exporter-otlp-proto-http==1.24.0
opentelemetry-sdk==1.24.0
redis==5.0.6
pact-python==2.2.0
pact-python==2.2.0
numpy==1.26.4
29 changes: 16 additions & 13 deletions start_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
# Start the first process in the background
uvicorn main:app --host 0.0.0.0 --port ${PRESTO_PORT} --reload &

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

for i in $(seq 1 $NUM_WORKERS)
do
(
while true; do
echo "Starting run_worker.py instance $i..."
python run_worker.py worker-$i
echo "run_worker.py instance $i exited. Restarting..."
sleep 30 # Prevent potential rapid restart loop
done
) &. # run workers as background processes
done
for i in $(seq 1 $NUM_WORKERS)
do
(
while true; do
echo "Starting run_worker.py instance $i..."
python run_worker.py worker-$i
echo "run_worker.py instance $i exited. Restarting..."
sleep 30 # Prevent potential rapid restart loop
done
) & # run workers as background processes
done
fi

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

0 comments on commit a53d4d3

Please sign in to comment.