Skip to content

Commit

Permalink
use items for dict iteration (PLC0206)
Browse files Browse the repository at this point in the history
  • Loading branch information
helylle committed Dec 6, 2024
1 parent 950d80d commit 6fcdfdd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/eduid/workers/job_runner/scheduler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from apscheduler.schedulers.asyncio import AsyncIOScheduler

from eduid.common.config.exceptions import BadConfiguration
from eduid.workers.job_runner.config import EnvironmentOrWorkerName, JobCronConfig
from eduid.workers.job_runner.config import EnvironmentOrWorkerName, JobCronConfig, JobName
from eduid.workers.job_runner.context import Context
from eduid.workers.job_runner.jobs.skv import check_skv_users, gather_skv_users

Expand All @@ -22,7 +22,7 @@ def schedule_jobs(self, context: Context) -> None:
jobs_config = context.config.jobs
context.logger.debug(f"jobs_config: {jobs_config}")

jobs: dict = {}
jobs: dict[JobName, JobCronConfig] = {}

# Gather jobs for current environment and worker in a dictionary
if environment in jobs_config:
Expand All @@ -42,8 +42,7 @@ def schedule_jobs(self, context: Context) -> None:
context.logger.info(f"Setting up jobs {jobs} for {worker_name} running {environment}")

# Add all configured jobs to the scheduler
for job in jobs:
cron_settings: JobCronConfig = jobs[job]
for job, cron_settings in jobs.items():
params = cron_settings.model_dump()
context.logger.info(f"Setting up job {job} with parameters {params}")

Expand Down

0 comments on commit 6fcdfdd

Please sign in to comment.