diff --git a/hworker/config/__init__.py b/hworker/config/__init__.py index ba473cc..34835be 100755 --- a/hworker/config/__init__.py +++ b/hworker/config/__init__.py @@ -407,3 +407,8 @@ def need_screenreplay() -> bool: def get_deadline_gap() -> datetime.time: return config()["make"]["deadline_gap"] + + +def user_checks() -> bool: + """Return False if user-defined checks are ignored.""" + return config()["check"].get("user_checks", True) diff --git a/hworker/config/default_hworker.toml b/hworker/config/default_hworker.toml index a12db1b..fce30f6 100644 --- a/hworker/config/default_hworker.toml +++ b/hworker/config/default_hworker.toml @@ -65,6 +65,7 @@ deadline_gap = 03:00:00 [check] directory = "/tmp/hworker_check" +user_checks = true [formalization] prog_name = "prog.py" diff --git a/hworker/make/__init__.py b/hworker/make/__init__.py index c9cd604..af89ca1 100644 --- a/hworker/make/__init__.py +++ b/hworker/make/__init__.py @@ -14,6 +14,7 @@ get_task_info, need_screenreplay, get_deadline_gap, + user_checks, ) from ..depot import store, search from ..depot.objects import ( @@ -103,14 +104,14 @@ def get_solution(hw: Homework) -> Solution: get_logger(__name__).warning(f"Incorrect remote content at {hw.ID} homework") remote_checks = remote_content.get("remote", {}) - own_checks = {check.ID: [] for check in get_checks(hw)} + own_checks = {check.ID: [] for check in get_checks(hw)} if user_checks() else {} config_checks = get_task_info(hw.TASK_ID).get("checks", {}) solution_id = f"{hw.USER_ID}:{hw.TASK_ID}" get_logger(__name__).debug(f"Extracted {solution_id} solution from {hw.ID} homework") return Solution( content=content, - checks=dict(own_checks, **remote_checks, **config_checks), + checks=own_checks | remote_checks | config_checks, ID=solution_id, TASK_ID=hw.TASK_ID, USER_ID=hw.USER_ID,