-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
48 lines (35 loc) · 1.2 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Function to handle errors
handle_error() {
local error_file=$1
local error_line=$2
local error_msg=$3
echo "[$(date)] Error in $error_file:$error_line - $error_msg" >> /app/logs/container.log
# Run verify and fix script
/app/scripts/verify_and_fix.sh
# Run tests
python -m pytest tests/
# Restart affected services
pkill -f "python -m" || true
sleep 2
# Start services again
python -m src.error_management &
python -m src.agent.main &
}
# Set up error trap
trap 'handle_error "${BASH_SOURCE}" "${LINENO}" "${BASH_COMMAND}"' ERR
# Start file monitoring
inotifywait -m -r -e modify,create,delete /app/src /app/tests | while read path action file; do
echo "[$(date)] File change detected: $path$file" >> /app/logs/container.log
/app/scripts/verify_and_fix.sh
done &
# Start error management service
python -m src.error_management &
# Start agent
python -m src.agent.main &
# Start autonomous agent
/app/scripts/start_autonomous_agent.sh &
# Start dashboard
streamlit run src/dashboard/error_dashboard.py --server.port=8502 --server.address=0.0.0.0 &
# Keep container running and monitor logs
tail -f /app/logs/*.log