Coverage for sel_tools/code_evaluation/jobs/sel.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-04 21:22 +0000

1"""Example evaluation job module. 

2 

3This module is used by default for the `evaluate_code` task. Customize the 

4factory below to return the jobs you want to use for your evaluation 

5""" 

6 

7from pathlib import Path 

8 

9from sel_tools.code_evaluation.jobs.common import EvaluationJob 

10from sel_tools.code_evaluation.jobs.cpp import CleanRepoJob, CMakeBuildJob, MakeTestJob 

11from sel_tools.code_evaluation.jobs.factory import EvaluationJobFactory 

12from sel_tools.code_evaluation.jobs.gitlab import CIStatusTestJob 

13from sel_tools.utils.repo import GitlabProject 

14 

15 

16class ExampleJob(EvaluationJob): 

17 """Custom Example Job.""" 

18 

19 name = "Example" 

20 

21 def _run(self, repo_path: Path) -> int: 

22 # Do whatevery you want to evaluate here 

23 # Return 0 for failures and a positive score for successful evaluations 

24 return 1 

25 

26 

27class ExampleEvaluationJobFactory(EvaluationJobFactory): 

28 """Example Evaluation Job Factory.""" 

29 

30 @staticmethod 

31 def create(gitlab_projects: list[GitlabProject], homework_number: int) -> list[EvaluationJob]: 

32 homework_evaluations_jobs_map = { 

33 1: [CleanRepoJob(), CMakeBuildJob(), ExampleJob()], 

34 2: [CleanRepoJob(), MakeTestJob(), CIStatusTestJob(gitlab_projects)], 

35 } 

36 return homework_evaluations_jobs_map[homework_number]