Проект аудита отелей: основные скрипты и документация
- Краулеры: smart_crawler.py, regional_crawler.py - Аудит: audit_orel_to_excel.py, audit_chukotka_to_excel.py - РКН проверка: check_rkn_registry.py, recheck_unclear_rkn.py - Отчёты: create_orel_horizontal_report.py - Обработка: process_all_hotels_embeddings.py - Документация: README.md, DB_SCHEMA_REFERENCE.md
This commit is contained in:
47
check_crawler.py
Normal file
47
check_crawler.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import glob
|
||||
import os
|
||||
|
||||
# Проверяем процессы
|
||||
print("🔍 АКТИВНЫЕ ПРОЦЕССЫ КРАУЛЕРА:\n")
|
||||
try:
|
||||
result = subprocess.run(['ps', 'aux'], capture_output=True, text=True)
|
||||
for line in result.stdout.split('\n'):
|
||||
if 'mass_crawler.py' in line and 'grep' not in line:
|
||||
print(f" {line}")
|
||||
except:
|
||||
print(" ❌ Ошибка проверки процессов")
|
||||
|
||||
# Проверяем логи
|
||||
print("\n📄 ФАЙЛЫ ЛОГОВ КРАУЛЕРА:\n")
|
||||
log_files = glob.glob('/root/engine/public_oversight/hotels/mass_crawler_*.log')
|
||||
log_files.sort(key=os.path.getmtime, reverse=True)
|
||||
for i, log_file in enumerate(log_files[:5]):
|
||||
size = os.path.getsize(log_file) / 1024 # KB
|
||||
mtime = os.path.getmtime(log_file)
|
||||
from datetime import datetime
|
||||
mod_time = datetime.fromtimestamp(mtime).strftime('%Y-%m-%d %H:%M:%S')
|
||||
print(f" {i+1}. {os.path.basename(log_file)}")
|
||||
print(f" Размер: {size:.1f} KB")
|
||||
print(f" Изменён: {mod_time}")
|
||||
|
||||
# Читаем последние строки
|
||||
try:
|
||||
with open(log_file, 'r') as f:
|
||||
lines = f.readlines()
|
||||
if lines:
|
||||
print(f" Строк: {len(lines)}")
|
||||
# Последние 3 строки
|
||||
for line in lines[-3:]:
|
||||
line = line.strip()
|
||||
if line:
|
||||
print(f" {line[:80]}...")
|
||||
except:
|
||||
pass
|
||||
print()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user