Skip to content

Commit

Permalink
Merge pull request #722 from SUNET/ylle-misc-cleanup
Browse files Browse the repository at this point in the history
miscellaneous  cleanup and fixes
  • Loading branch information
johanlundberg authored Dec 6, 2024
2 parents b02789a + 6fcdfdd commit fb8569b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ vscode_venv:

vscode_pip: vscode_venv
$(info Installing pip packages in devcontainer)
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r requirements/test_requirements.txt
.venv/bin/pip install uv
.venv/bin/uv pip install -r requirements/test_requirements.txt
.venv/bin/mypy --install-types

# This target is used by the devcontainer.json to configure the devcontainer
Expand Down
2 changes: 0 additions & 2 deletions requirements/test_requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
-r satosa_scim_requirements.in
-r webapp_requirements.in
-r worker_requirements.in
black
isort
mock
mypy
pip-tools
Expand Down
5 changes: 2 additions & 3 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ line-length = 120
target-version = "py311"

[lint]
select = ["E", "F", "W", "I", "ASYNC", "UP", "FLY", "PERF", "FURB", "ERA", "ANN", "PIE"]
select = ["E", "F", "W", "I", "ASYNC", "UP", "FLY", "PERF", "FURB", "ERA", "ANN", "PIE", "PL"]

# ANN101 and ANN102 are depracated
ignore = ["E501", "ANN1"]
ignore = ["E501", "PLR", "PLW"]

[lint.flake8-annotations]
allow-star-arg-any = true
2 changes: 1 addition & 1 deletion src/eduid/queue/workers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def run(self) -> None:
main_task = asyncio.create_task(self.run_subtasks(), name="run subtasks")
# set up signal handling to be a well behaved service
loop = asyncio.get_running_loop()
for signame in {"SIGINT", "SIGTERM"}:
for signame in ("SIGINT", "SIGTERM"):
loop.add_signal_handler(getattr(signal, signame), functools.partial(cancel_task, signame, main_task))

logger.info(f"Running: {main_task.get_name()}")
Expand Down
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 fb8569b

Please sign in to comment.