Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change setup for services initialization #9

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: Create script to kill all services
  • Loading branch information
esloch committed Apr 23, 2024
commit 7361e7df81a2ce83db8f6530a0fbbcb45d9a1086
4 changes: 2 additions & 2 deletions scripts/start_celery_and_flower.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Function to wait for a service to be available on a specific port
# Wait for a service to be available on a specific port
wait_for_service() {
local host=$1
local port=$2
Expand Down Expand Up @@ -40,4 +40,4 @@ celery -A src.poc_celery.celery_app worker --loglevel=INFO &
echo "Starting Flower for monitoring Celery..."
celery -A src.poc_celery.celery_app flower &

echo "Celery and Flower dashboard have been started."
echo "Celery and Flower have been started."
25 changes: 25 additions & 0 deletions scripts/stop_celery_and_flower.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

echo "Forcefully killing Celery and Flower processes..."

# Function to forcefully kill a process by its name
force_kill_process() {
local process_name=$1
echo "Searching for processes named $process_name to kill..."

# Use pgrep to find all process IDs matching the process name and kill them
pids=$(pgrep -f "$process_name")
if [ ! -z "$pids" ]; then
echo "Found processes with IDs: $pids. Force killing..."
echo $pids | xargs kill -9
echo "$process_name processes have been forcefully terminated."
else
echo "No $process_name processes found running."
fi
}

# Specific names or part of the command that was used to start Celery and Flower
force_kill_process "celery -A src.poc_celery.celery_app worker"
force_kill_process "celery -A src.poc_celery.celery_app flower"

echo "All relevant Celery and Flower processes have been forcefully killed."
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from src import *
from src import *
22 changes: 0 additions & 22 deletions src/poc_celery/config/celeryconfig

This file was deleted.

Loading