add
This commit is contained in:
48
scripts/verify_scheduler.py
Normal file
48
scripts/verify_scheduler.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
from datetime import datetime
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
print("🔍 VERIFYING SCHEDULER SETUP")
|
||||
print("=" * 50)
|
||||
|
||||
# Check current time
|
||||
ist = ZoneInfo('Asia/Kolkata')
|
||||
now = datetime.now(ist)
|
||||
print(f"Current IST time: {now.strftime('%Y-%m-%d %H:%M:%S %Z')}")
|
||||
|
||||
# Check 8 PM today
|
||||
eight_pm = now.replace(hour=20, minute=0, second=0, microsecond=0)
|
||||
print(f"8:00 PM today: {eight_pm.strftime('%Y-%m-%d %H:%M:%S %Z')}")
|
||||
|
||||
# Test scheduler
|
||||
try:
|
||||
from app_core.services.scheduler_service import SchedulerService
|
||||
s = SchedulerService()
|
||||
s.start_scheduler()
|
||||
print(f"✅ Scheduler started: {s.is_running()}")
|
||||
|
||||
next_run = s.get_next_run_time()
|
||||
if next_run:
|
||||
next_run_ist = next_run.astimezone(ist)
|
||||
print(f"✅ Next run: {next_run_ist.strftime('%Y-%m-%d %H:%M:%S %Z')}")
|
||||
else:
|
||||
print("❌ No next run time found")
|
||||
|
||||
s.stop_scheduler()
|
||||
print("✅ Scheduler stopped")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Scheduler error: {e}")
|
||||
|
||||
# Test daily report
|
||||
try:
|
||||
from app_core.services.daily_report import main
|
||||
print("\n🧪 Testing daily report...")
|
||||
result = main()
|
||||
print(f"✅ Daily report result: {result}")
|
||||
except Exception as e:
|
||||
print(f"❌ Daily report error: {e}")
|
||||
|
||||
print("\n" + "=" * 50)
|
||||
print("✅ VERIFICATION COMPLETE")
|
||||
print("=" * 50)
|
||||
Reference in New Issue
Block a user