many updates
This commit is contained in:
27
FitnessSync/backend/verify_jobs.py
Normal file
27
FitnessSync/backend/verify_jobs.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from src.services.postgresql_manager import PostgreSQLManager
|
||||
from src.utils.config import config
|
||||
from src.models.scheduled_job import ScheduledJob
|
||||
from src.services.scheduler import scheduler
|
||||
|
||||
def verify_jobs():
|
||||
db = PostgreSQLManager(config.DATABASE_URL)
|
||||
|
||||
# Run ensure_defaults to populate DB
|
||||
scheduler.ensure_defaults()
|
||||
|
||||
with db.get_db_session() as session:
|
||||
jobs = session.query(ScheduledJob).all()
|
||||
print("Scheduled Jobs in DB:")
|
||||
for j in jobs:
|
||||
print(f"- {j.name} (Type: {j.job_type}, Enabled: {j.enabled})")
|
||||
|
||||
reparse = next((j for j in jobs if j.job_type == 'reparse_local_files'), None)
|
||||
estimate = next((j for j in jobs if j.job_type == 'estimate_power'), None)
|
||||
|
||||
if reparse and estimate:
|
||||
print("\nSUCCESS: Both new jobs found.")
|
||||
else:
|
||||
print("\nFAILURE: Missing new jobs.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
verify_jobs()
|
||||
Reference in New Issue
Block a user