feat: remove nested conf fields
All checks were successful
build / build (push) Successful in 2m2s
build / trigger-build-image (push) Successful in 11s

This commit is contained in:
张泊明518370910136 2025-09-27 01:05:45 -07:00
parent 09f15f21ad
commit 32997cfdcb
GPG Key ID: D47306D7062CDA9D
13 changed files with 2973 additions and 3001 deletions

View File

@ -36,20 +36,18 @@ def convert_joj3_conf(repo_conf: repo.Config, task_conf: task.Config) -> result.
if not task_conf.max_total_score
else task_conf.max_total_score
),
stage=result.Stage(sandbox_token=repo_conf.sandbox_token),
sandbox_token=repo_conf.sandbox_token,
)
current_test = os.environ.get("PYTEST_CURRENT_TEST") is not None
# Construct health check stage
if not repo_conf.force_skip_health_check_on_test or not current_test:
result_conf.stage.stages.append(get_health_check_stage(repo_conf, task_conf))
result_conf.stages.append(get_health_check_stage(repo_conf, task_conf))
cached: Dict[str, None] = {}
# Convert each stage in the task configuration
for task_stage in task_conf.stages:
result_conf.stage.stages.append(get_conf_stage(task_conf, task_stage, cached))
result_conf.stages.append(get_conf_stage(task_conf, task_stage, cached))
if not repo_conf.force_skip_teapot_on_test or not current_test:
result_conf.stage.post_stages.append(
get_teapot_post_stage(repo_conf, task_conf)
)
result_conf.post_stages.append(get_teapot_post_stage(repo_conf, task_conf))
return result_conf

View File

@ -151,7 +151,11 @@ class StageDetail(BaseModel):
parsers: List[Parser]
class Stage(BaseModel):
class Config(BaseModel):
name: str = ""
log_path: str = Field("", serialization_alias="logPath")
actor_csv_path: str = Field("", serialization_alias="actorCsvPath")
max_total_score: int = Field(100, serialization_alias="maxTotalScore")
sandbox_exec_server: str = Field(
"172.17.0.1:5051", serialization_alias="sandboxExecServer"
)
@ -159,19 +163,11 @@ class Stage(BaseModel):
output_path: str = Field(
"/tmp/joj3_result.json", serialization_alias="outputPath"
) # nosec: B108
stages: List[StageDetail] = []
pre_stages: List[StageDetail] = Field([], serialization_alias="preStages")
stages: List[StageDetail] = []
post_stages: List[StageDetail] = Field([], serialization_alias="postStages")
class Config(BaseModel):
name: str = ""
log_path: str = Field("", serialization_alias="logPath")
actor_csv_path: str = Field("", serialization_alias="actorCsvPath")
max_total_score: int = Field(100, serialization_alias="maxTotalScore")
stage: Stage
class DummyConfig(BaseModel):
score: int = 0
comment: Optional[str] = None

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 10245871,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "Health Check",
@ -875,7 +875,6 @@
]
}
],
"preStages": [],
"postStages": [
{
"name": "teapot",
@ -959,5 +958,4 @@
]
}
]
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] Clang-tidy",
@ -143,7 +143,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] Cppcheck",
@ -113,7 +113,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] Cpplint",
@ -115,7 +115,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[joj] ex2-asan",
@ -688,7 +688,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] elf",
@ -123,7 +123,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/health/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "Health Check",
@ -96,7 +96,6 @@
]
}
],
"preStages": [],
"postStages": [
{
"name": "teapot",
@ -176,5 +175,4 @@
]
}
]
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "Health Check",
@ -424,7 +424,6 @@
]
}
],
"preStages": [],
"postStages": [
{
"name": "teapot",
@ -509,5 +508,4 @@
]
}
]
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] Filelength",
@ -112,7 +112,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] Filelength",
@ -93,7 +93,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}

View File

@ -3,10 +3,10 @@
"logPath": "/home/tt/.cache/joj3/hw7/joj3.log",
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"maxTotalScore": 100,
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "",
"outputPath": "/tmp/joj3_result.json",
"preStages": [],
"stages": [
{
"name": "[cq] Filelength",
@ -90,7 +90,5 @@
]
}
],
"preStages": [],
"postStages": []
}
}