dd
Browse filesFiles changed (2)
63 unmodified lines64656667686914 unmodified lines84858687888957 unmodified lines14714814915015115263 unmodified linesThis task runs every 5 minutes to check for new or updated schedules."""try:logger.info("Loading schedules from database...")# Get Supabase configuration14 unmodified lines)schedules = response.data if response.data else []logger.info(f"Found {len(schedules)} schedules")# Get current beat schedule57 unmodified lines# Update the beat schedulecurrent_app.conf.beat_schedule = new_schedulelogger.info("Updated Celery Beat schedule")return {63 unmodified lines6465666768697014 unmodified lines8586878889909157 unmodified lines14915015115215315415563 unmodified linesThis task runs every 5 minutes to check for new or updated schedules."""try:print(f"[CELERY BEAT] Loading schedules from database at {datetime.now()}...")logger.info("Loading schedules from database...")# Get Supabase configuration14 unmodified lines)schedules = response.data if response.data else []print(f"[CELERY BEAT] Found {len(schedules)} schedules in database")logger.info(f"Found {len(schedules)} schedules")# Get current beat schedule57 unmodified lines# Update the beat schedulecurrent_app.conf.beat_schedule = new_scheduleprint(f"[CELERY BEAT] Successfully updated Celery Beat schedule with {len(new_schedule)} jobs")logger.info("Updated Celery Beat schedule")return {
50 unmodified lines5152535455565758596061626364656667686950 unmodified lines]if platform.system() == "Windows":# Windows: Use subprocess to start background processessubprocess.Popen(worker_cmd, cwd=backend_dir,stdout=subprocess.PIPE, stderr=subprocess.PIPE,creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)subprocess.Popen(beat_cmd, cwd=backend_dir,stdout=subprocess.PIPE, stderr=subprocess.PIPE,creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)else:# Linux/Mac: Use subprocess with proper signal handlingsubprocess.Popen(worker_cmd, cwd=backend_dir,stdout=subprocess.PIPE, stderr=subprocess.PIPE)subprocess.Popen(beat_cmd, cwd=backend_dir,stdout=subprocess.PIPE, stderr=subprocess.PIPE)print("Celery worker and beat scheduler started in background")time.sleep(2) # Give Celery components time to start50 unmodified lines5152535455565758596061626364656667686950 unmodified lines]if platform.system() == "Windows":# Windows: Use subprocess to start background processes with visible logssubprocess.Popen(worker_cmd, cwd=backend_dir,stdout=sys.stdout, stderr=sys.stderr,creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)subprocess.Popen(beat_cmd, cwd=backend_dir,stdout=sys.stdout, stderr=sys.stderr,creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)else:# Linux/Mac: Use subprocess with visible logssubprocess.Popen(worker_cmd, cwd=backend_dir,stdout=sys.stdout, stderr=sys.stderr)subprocess.Popen(beat_cmd, cwd=backend_dir,stdout=sys.stdout, stderr=sys.stderr)print("Celery worker and beat scheduler started in background")time.sleep(2) # Give Celery components time to start
backend/celery_tasks/schedule_loader.py+3
start_app.py+6-6