feat: add limitation adaptation
This commit is contained in:
parent
e5530ae580
commit
bbda876180
|
@ -73,9 +73,12 @@ def convert(root: Path = Path(".")) -> Dict[str, Any]:
|
||||||
# FIXME: change the path to the server
|
# FIXME: change the path to the server
|
||||||
homework_name = "h8"
|
homework_name = "h8"
|
||||||
# folder_path = f"/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/homework/{homework_name}"
|
# folder_path = f"/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/homework/{homework_name}"
|
||||||
folder_path = (
|
# folder_path = (
|
||||||
"/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/homework"
|
# "/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/homework"
|
||||||
)
|
# )
|
||||||
|
folder_path = "/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/homework/h7"
|
||||||
|
# for projects
|
||||||
|
folder_path = "/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/projects/p3/p3m1"
|
||||||
assert os.path.exists(folder_path), f"there exists no {folder_path}"
|
assert os.path.exists(folder_path), f"there exists no {folder_path}"
|
||||||
distribute_json(folder_path, repo_obj)
|
distribute_json(folder_path, repo_obj)
|
||||||
return result_dict
|
return result_dict
|
||||||
|
|
|
@ -4,11 +4,13 @@ from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
class Files(BaseModel):
|
class Files(BaseModel):
|
||||||
whitelist_patterns: List[str]
|
|
||||||
whitelist_file: Optional[str]
|
|
||||||
required: List[str]
|
required: List[str]
|
||||||
immutable: List[str]
|
immutable: List[str]
|
||||||
|
|
||||||
|
class Group(BaseModel):
|
||||||
|
name: List[str]
|
||||||
|
max_count: List[int]
|
||||||
|
time_period_hour: List[int]
|
||||||
|
|
||||||
class Config(BaseModel):
|
class Config(BaseModel):
|
||||||
teaching_team: List[str]
|
teaching_team: List[str]
|
||||||
|
@ -16,3 +18,5 @@ class Config(BaseModel):
|
||||||
release_tags: List[str]
|
release_tags: List[str]
|
||||||
files: Files
|
files: Files
|
||||||
sandbox_token: str
|
sandbox_token: str
|
||||||
|
max_total_score: int = Field(100)
|
||||||
|
groups : Group
|
||||||
|
|
|
@ -13,6 +13,22 @@ def get_grading_repo_name() -> str:
|
||||||
|
|
||||||
|
|
||||||
def get_teapot_config(repo_conf: repo.Config, task_conf: task.Config) -> result.Teapot:
|
def get_teapot_config(repo_conf: repo.Config, task_conf: task.Config) -> result.Teapot:
|
||||||
|
groups_config = []
|
||||||
|
for group_name in repo_conf.groups.name:
|
||||||
|
groups_config.append(
|
||||||
|
{
|
||||||
|
"name": group_name,
|
||||||
|
"maxCount": 1000,
|
||||||
|
"timePeriodHour": 24,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
for idx, max_count in enumerate(repo_conf.groups.max_count):
|
||||||
|
groups_config[idx]["maxCount"] = max_count
|
||||||
|
|
||||||
|
for idx, time_period_hour in enumerate(repo_conf.groups.time_period_hour):
|
||||||
|
groups_config[idx]["timePeriodHour"] = time_period_hour
|
||||||
|
|
||||||
teapot = result.Teapot(
|
teapot = result.Teapot(
|
||||||
# TODO: fix the log path
|
# TODO: fix the log path
|
||||||
log_path=f"/home/tt/.cache/joj3/{task_conf.task.type_}-joint-teapot-debug.log",
|
log_path=f"/home/tt/.cache/joj3/{task_conf.task.type_}-joint-teapot-debug.log",
|
||||||
|
@ -28,6 +44,8 @@ def get_teapot_config(repo_conf: repo.Config, task_conf: task.Config) -> result.
|
||||||
else "failed-table.md"
|
else "failed-table.md"
|
||||||
),
|
),
|
||||||
grading_repo_name=get_grading_repo_name(),
|
grading_repo_name=get_grading_repo_name(),
|
||||||
|
max_total_score=repo_conf.max_total_score,
|
||||||
|
groups=groups_config
|
||||||
)
|
)
|
||||||
return teapot
|
return teapot
|
||||||
|
|
||||||
|
@ -73,7 +91,7 @@ def get_healthcheck_cmd(repo_conf: repo.Config) -> result.Cmd:
|
||||||
def get_healthcheck_config(repo_conf: repo.Config) -> result.StageDetail:
|
def get_healthcheck_config(repo_conf: repo.Config) -> result.StageDetail:
|
||||||
healthcheck_stage = result.StageDetail(
|
healthcheck_stage = result.StageDetail(
|
||||||
name="healthcheck",
|
name="healthcheck",
|
||||||
group=None,
|
group="",
|
||||||
executor=result.Executor(
|
executor=result.Executor(
|
||||||
name="sandbox",
|
name="sandbox",
|
||||||
with_=result.ExecutorWith(default=get_healthcheck_cmd(repo_conf), cases=[]),
|
with_=result.ExecutorWith(default=get_healthcheck_cmd(repo_conf), cases=[]),
|
||||||
|
@ -95,7 +113,7 @@ def get_hash(immutable_files: list[str]) -> str: # input should be a list
|
||||||
# FIXME: should be finalized when get into the server
|
# FIXME: should be finalized when get into the server
|
||||||
current_file_path = Path(__file__).resolve()
|
current_file_path = Path(__file__).resolve()
|
||||||
project_root = current_file_path.parents[2]
|
project_root = current_file_path.parents[2]
|
||||||
file_path = f"{project_root}/tests/immutable_file/"
|
file_path = f"{project_root}/tests/immutable_p3-test/"
|
||||||
immutable_hash = []
|
immutable_hash = []
|
||||||
for i, file in enumerate(immutable_files):
|
for i, file in enumerate(immutable_files):
|
||||||
immutable_files[i] = file_path + file.rsplit("/", 1)[-1]
|
immutable_files[i] = file_path + file.rsplit("/", 1)[-1]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user