chore: remove joj1 part
This commit is contained in:
		
							parent
							
								
									10f2d5c94b
								
							
						
					
					
						commit
						4b3668d772
					
				|  | @ -1,9 +1,7 @@ | ||||||
| import os | import os | ||||||
| from pathlib import Path |  | ||||||
| from typing import List | from typing import List | ||||||
| 
 | 
 | ||||||
| from joj3_config_generator.models import joj1, repo, result, task | from joj3_config_generator.models import joj1, repo, result, task | ||||||
| from joj3_config_generator.processers.joj1 import get_joj1_run_stage |  | ||||||
| from joj3_config_generator.processers.repo import ( | from joj3_config_generator.processers.repo import ( | ||||||
|     get_healthcheck_config, |     get_healthcheck_config, | ||||||
|     get_teapot_stage, |     get_teapot_stage, | ||||||
|  | @ -54,13 +52,4 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def convert_joj1(joj1_conf: joj1.Config) -> task.Config: | def convert_joj1(joj1_conf: joj1.Config) -> task.Config: | ||||||
|     stages = [get_joj1_run_stage(joj1_conf)] |     return task.Config() | ||||||
|     return task.Config( |  | ||||||
|         root=Path(""), |  | ||||||
|         path=Path(""), |  | ||||||
|         task=task.Task( |  | ||||||
|             name=(""), |  | ||||||
|         ), |  | ||||||
|         release=task.Release(), |  | ||||||
|         stages=stages, |  | ||||||
|     ) |  | ||||||
|  |  | ||||||
|  | @ -122,13 +122,13 @@ class Release(BaseModel): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Task(BaseModel): | class Task(BaseModel): | ||||||
|     type_: str = Field("", serialization_alias="type", validation_alias="type") |     type_: str = Field("unknown", serialization_alias="type", validation_alias="type") | ||||||
|     name: str |     name: str = "unknown" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Config(BaseModel): | class Config(BaseModel): | ||||||
|     root: Path = Path(".") |     root: Path = Path(".") | ||||||
|     path: Path = Path("task.toml") |     path: Path = Path("task.toml") | ||||||
|     task: Task  # Task name (e.g., hw3 ex5) |     task: Task = Task()  # Task name (e.g., hw3 ex5) | ||||||
|     release: Release  # Release configuration |     release: Release = Release()  # Release configuration | ||||||
|     stages: List[Stage]  # list of stage configurations |     stages: List[Stage] = []  # list of stage configurations | ||||||
|  |  | ||||||
|  | @ -1,31 +0,0 @@ | ||||||
| from joj3_config_generator.models import joj1, task |  | ||||||
| from joj3_config_generator.models.common import Memory, Time |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| def get_joj1_run_stage(joj1_config: joj1.Config) -> task.Stage: |  | ||||||
|     cases_conf = [] |  | ||||||
|     for i, case in enumerate(joj1_config.cases): |  | ||||||
|         cases_conf.append( |  | ||||||
|             task.Stage( |  | ||||||
|                 score=case.score, |  | ||||||
|                 command=case.execute_args if case.execute_args else "", |  | ||||||
|                 limit=task.Limit(cpu=Time(case.time), mem=Memory(case.memory)), |  | ||||||
|             ) |  | ||||||
|         ) |  | ||||||
|     for i, case in enumerate(joj1_config.cases): |  | ||||||
|         cases_conf[i].in_ = case.input |  | ||||||
|         cases_conf[i].out_ = case.output |  | ||||||
|     run_config = task.Stage( |  | ||||||
|         name="This is the converted joj1 run stage", |  | ||||||
|         parsers=["diff", "result-status"], |  | ||||||
|         score=100, |  | ||||||
|         limit=task.Limit( |  | ||||||
|             cpu=Time(joj1_config.cases[0].time), |  | ||||||
|             mem=Memory(joj1_config.cases[0].memory), |  | ||||||
|         ), |  | ||||||
|         cases={f"case{i}": cases_conf[i] for i, _ in enumerate(cases_conf)}, |  | ||||||
|     )  # TODO: no strong pattern match here, use dict instead |  | ||||||
|     return run_config |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # TODO: get formatted joj1 config, match the criterion in the doc |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user