fix(scripts): fix verify_gaps.py Gap 1 check — call start_scheduler() before checking registered jobs
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
This commit is contained in:
@@ -29,7 +29,11 @@ def main():
|
|||||||
# ── Gap 1: hourly job registered ──────────────────────────────────────────
|
# ── Gap 1: hourly job registered ──────────────────────────────────────────
|
||||||
print("── Gap 1: Hourly APScheduler job ──")
|
print("── Gap 1: Hourly APScheduler job ──")
|
||||||
try:
|
try:
|
||||||
from app.jobs.mitre_sync_job import scheduler
|
from app.jobs.mitre_sync_job import scheduler, start_scheduler
|
||||||
|
# start_scheduler() adds all jobs to the module-level scheduler instance
|
||||||
|
# (idempotent due to replace_existing=True); call it to populate jobs
|
||||||
|
if not scheduler.running:
|
||||||
|
start_scheduler()
|
||||||
job_ids = [j.id for j in scheduler.get_jobs()]
|
job_ids = [j.id for j in scheduler.get_jobs()]
|
||||||
check("alert_evaluation job registered", "alert_evaluation" in job_ids,
|
check("alert_evaluation job registered", "alert_evaluation" in job_ids,
|
||||||
f"registered jobs: {job_ids}")
|
f"registered jobs: {job_ids}")
|
||||||
@@ -38,7 +42,7 @@ def main():
|
|||||||
trigger_str = str(job.trigger)
|
trigger_str = str(job.trigger)
|
||||||
check("alert_evaluation trigger is interval", "interval" in trigger_str.lower(),
|
check("alert_evaluation trigger is interval", "interval" in trigger_str.lower(),
|
||||||
trigger_str)
|
trigger_str)
|
||||||
print(f" next run: {job.next_run_time}")
|
print(f" trigger: {trigger_str}")
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
check("scheduler import", False, str(exc))
|
check("scheduler import", False, str(exc))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user