diff --git a/requirements.txt b/requirements.txt index 55ed02db3..c9a4353fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ numpy==2.2.2 XlsxWriter==3.2.2 +PyYAML==6.0.2 diff --git a/scoreboard/data/performance.yml b/scoreboard/data/performance.yml new file mode 100644 index 000000000..e4d741028 --- /dev/null +++ b/scoreboard/data/performance.yml @@ -0,0 +1 @@ +performance: diff --git a/scoreboard/data/plagiarism.yml b/scoreboard/data/plagiarism.yml new file mode 100644 index 000000000..3a4d581a4 --- /dev/null +++ b/scoreboard/data/plagiarism.yml @@ -0,0 +1,8 @@ +plagiarism: + mpi: [] + omp: [] + seq: + - broken_example + stl: [] + tbb: [] + all: [] diff --git a/scoreboard/data/threads-config.yml b/scoreboard/data/threads-config.yml new file mode 100644 index 000000000..1c950787b --- /dev/null +++ b/scoreboard/data/threads-config.yml @@ -0,0 +1,40 @@ +scoreboard: + task: + mpi: + solution: + max: 0 + performance: + max: 0 + visible: true + omp: + solution: + max: 6 + performance: + max: 3 + visible: true + seq: + solution: + max: 4 + performance: + max: 0 + visible: true + stl: + solution: + max: 8 + performance: + max: 6 + visible: true + tbb: + solution: + max: 6 + performance: + max: 3 + visible: true + all: + solution: + max: 10 + performance: + max: 8 + visible: true + plagiarism: + coefficient: 0.5 diff --git a/scoreboard/main.py b/scoreboard/main.py index 241cc8eb0..c40344763 100644 --- a/scoreboard/main.py +++ b/scoreboard/main.py @@ -1,6 +1,7 @@ from pathlib import Path from collections import defaultdict import argparse +import yaml task_types = ['all', 'mpi', 'omp', 'seq', 'stl', 'tbb'] @@ -18,7 +19,15 @@ else: directories[task_name][task_type] = "done" -print(directories) +config_path = Path(__file__).parent / "data" / "threads-config.yml" +assert config_path.exists(), f"Config file not found: {config_path}" +with open(config_path, 'r') as file: + cfg = yaml.safe_load(file) +assert cfg, "Configuration is empty" +plagiarism_config_path = Path(__file__).parent / "data" / "plagiarism.yml" +with open(plagiarism_config_path, 'r') as file: + plagiarism_cfg = yaml.safe_load(file) +assert plagiarism_cfg, "Plagiarism configuration is empty" columns = ''.join(['' + task_type + '' for task_type in task_types]) html_content = f""" @@ -59,18 +68,30 @@ html_content += f"{dir}" total_count = 0 for task_type in task_types: + max_sol_points = int(cfg["scoreboard"]["task"][task_type]["solution"]["max"]) + task_count = 0 if directories[dir].get(task_type) == "done": - html_content += '1' - total_count += 1 + html_content += f'{max_sol_points}' + task_count += max_sol_points elif directories[dir].get(task_type) == "disabled": - html_content += '1' - total_count += 1 + html_content += f'{max_sol_points}' + task_count += max_sol_points else: html_content += '0' html_content += '0' html_content += '0' html_content += '0' - html_content += '0' + is_cheated = \ + dir in plagiarism_cfg["plagiarism"][task_type] or \ + dir[:-len("_disabled")] in plagiarism_cfg["plagiarism"][task_type] + if is_cheated: + plag_coeff = float(cfg["scoreboard"]["plagiarism"]["coefficient"]) + plagiarism_points = -plag_coeff * task_count + task_count += plagiarism_points + html_content += f'{plagiarism_points}' + else: + html_content += '0' + total_count += task_count html_content += f'{total_count}' html_content += ""