-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_postgres_scheduler.sh
More file actions
executable file
·55 lines (43 loc) · 1.86 KB
/
Copy pathstart_postgres_scheduler.sh
File metadata and controls
executable file
·55 lines (43 loc) · 1.86 KB
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
49
50
51
52
53
54
55
#!/bin/bash
# Простой и надежный запуск Airflow Scheduler для PostgreSQL
echo " Запуск Airflow Scheduler (PostgreSQL + LocalExecutor)"
# Остановим старые процессы
pkill -f "airflow scheduler" 2>/dev/null || true
sleep 2
# Активируем окружение
source venv/bin/activate
# Устанавливаем переменные окружения
export AIRFLOW_HOME="$PWD/airflow"
export AIRFLOW__CORE__EXECUTOR="LocalExecutor"
export AIRFLOW__DATABASE__SQL_ALCHEMY_CONN="postgresql+psycopg2://airflow:airflow@localhost:5432/airflow"
export AIRFLOW__WEBSERVER__WEB_SERVER_PORT="8082"
# Критические настройки для macOS
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
export PYTHONUNBUFFERED=1
# Попробуем сначала с SequentialExecutor, потом переключим на LocalExecutor
echo " Тестовый запуск с SequentialExecutor..."
export AIRFLOW__CORE__EXECUTOR="SequentialExecutor"
# Проверим подключение к БД
echo " Проверка подключения к базе данных..."
airflow db check
if [ $? -eq 0 ]; then
echo " База данных доступна"
# Переключаемся на LocalExecutor
export AIRFLOW__CORE__EXECUTOR="LocalExecutor"
echo " Запуск scheduler с LocalExecutor..."
nohup airflow scheduler > logs/scheduler_simple.log 2>&1 &
SCHEDULER_PID=$!
echo " Scheduler запущен (PID: $SCHEDULER_PID)"
# Ждем немного и проверяем
sleep 5
if ps -p $SCHEDULER_PID > /dev/null; then
echo " Scheduler работает стабильно"
else
echo " Scheduler завершился с ошибкой"
echo " Последние 10 строк лога:"
tail -10 logs/scheduler_simple.log
fi
else
echo " Проблема с подключением к базе данных"
exit 1
fi