dev #10

Merged
李衍志523370910113 merged 238 commits from dev into master 2025-03-05 16:20:39 +08:00
17 changed files with 27 additions and 294 deletions
Showing only changes of commit c7917efac7 - Show all commits

View File

@ -34,17 +34,15 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
stage=result.Stage(
stages=[],
sandbox_token=repo_conf.sandbox_token,
poststages=[get_teapot_stage(repo_conf)],
post_stages=[],
jon-lee marked this conversation as resolved Outdated

where is it used?

where is it used?

this should be storing all the files that are about to be copy in or out

this should be storing all the files that are about to be copy in or out

It is as the input and output for the following functions about parsers

It is as the input and output for the following functions about parsers

so this feature is not implemented?

so this feature is not implemented?
    if not repo_conf.force_skip_health_check_on_test or not current_test:
        result_conf.stage.stages.append(get_health_check_config(repo_conf))
    cached: List[str] = []
    # Convert each stage in the task configuration
    for task_stage in task_conf.stages:
        executor_with_config, cached = get_executor_with_config(task_stage, cached)
        conf_stage = get_conf_stage(task_stage, executor_with_config)
        conf_stage = fix_result_detail(task_stage, conf_stage)
        conf_stage = fix_dummy(task_stage, conf_stage)
        conf_stage = fix_keyword(task_stage, conf_stage)
        conf_stage = fix_file(task_stage, conf_stage)
        conf_stage = fix_diff(task_stage, conf_stage, task_conf)
        result_conf.stage.stages.append(conf_stage)

it is

    for task_stage in task_conf.stages:
        executor_with_config, cached = get_executor_with_config(task_stage, cached)

this is a loop, so this cached will be updated in every round of stage

```python if not repo_conf.force_skip_health_check_on_test or not current_test: result_conf.stage.stages.append(get_health_check_config(repo_conf)) cached: List[str] = [] # Convert each stage in the task configuration for task_stage in task_conf.stages: executor_with_config, cached = get_executor_with_config(task_stage, cached) conf_stage = get_conf_stage(task_stage, executor_with_config) conf_stage = fix_result_detail(task_stage, conf_stage) conf_stage = fix_dummy(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) conf_stage = fix_file(task_stage, conf_stage) conf_stage = fix_diff(task_stage, conf_stage, task_conf) result_conf.stage.stages.append(conf_stage) ``` it is ```python for task_stage in task_conf.stages: executor_with_config, cached = get_executor_with_config(task_stage, cached) ``` this is a loop, so this `cached` will be updated in every round of stage

The return value is unnecessary.

The return value is unnecessary.

I have a lazing coding style here, everything has get imported would get exported, so should maintain this until the end of the loop. Everything is exported in previous stage would be imported in the next stage.

I have a lazing coding style here, everything has get imported would get exported, so should maintain this until the end of the loop. Everything is exported in previous stage would be imported in the next stage.
  1. The return value is unnecessary
  2. It should be a set
1. The return value is unnecessary 2. It should be a `set`

try it yourself

try it yourself

I see why

I see why

resolved.

resolved.
),
)
current_test = os.environ.get("PYTEST_CURRENT_TEST") is not None
# Construct healthcheck stage
if (
not repo_conf.force_skip_health_check_on_test
or os.environ.get("PYTEST_CURRENT_TEST") is None
):
healthcheck_stage = get_healthcheck_config(repo_conf)
result_conf.stage.stages.append(healthcheck_stage)
print(current_test)
if not repo_conf.force_skip_health_check_on_test or not current_test:
result_conf.stage.stages.append(get_healthcheck_config(repo_conf))
stages: List[str] = []
# Convert each stage in the task configuration
for task_stage in task_conf.stages:
jon-lee marked this conversation as resolved Outdated

forgot to uncommented 😭

forgot to uncommented 😭

fixed

fixed
@ -56,6 +54,8 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
conf_stage = fix_file(task_stage, conf_stage)
conf_stage = fix_diff(task_stage, conf_stage, task_conf)
result_conf.stage.stages.append(conf_stage)
if not repo_conf.force_skip_teapot_on_test or not current_test:
result_conf.stage.post_stages.append(get_teapot_stage(repo_conf))
return result_conf

View File

@ -21,6 +21,7 @@ class Config(BaseModel):
sandbox_token: str = Field("")
max_total_score: int = Field(100)
force_skip_health_check_on_test: bool = False
force_skip_teapot_on_test: bool = False
groups: Groups = Groups()
root: Path = Path(".")
path: Path = Path("repo.toml")

View File

@ -142,8 +142,8 @@ class Stage(BaseModel):
"/tmp/joj3_result.json", serialization_alias="outputPath"
) # nosec: B108
stages: List[StageDetail]
prestages: Optional[List[StageDetail]] = None
poststages: List[StageDetail]
pre_stages: List[StageDetail] = Field([], serialization_alias="preStages")
post_stages: List[StageDetail] = Field([], serialization_alias="postStages")
class Config(BaseModel):

View File

@ -1,6 +1,5 @@
import hashlib
import shlex
import socket
from pathlib import Path
from joj3_config_generator.models import repo, result

View File

@ -1,6 +1,5 @@
import re
jon-lee marked this conversation as resolved

Path should not be relative to JOJ3_CONFIG_ROOT in this file, should be relative to task.toml dir

Path should not be relative to `JOJ3_CONFIG_ROOT` in this file, should be relative to `task.toml` dir

I reckon you said things is relative to JOJ3_CONFIG_ROOT in JTC before. we have a task.type in task.toml to mend the path

I reckon you said things is relative to `JOJ3_CONFIG_ROOT` in JTC before. we have a `task.type` in `task.toml` to mend the path

config.path is relative to JOJ3_CONFIG_ROOT.

`config.path` is relative to `JOJ3_CONFIG_ROOT`.

could you explain further? I m not quite sure my understanding is clear.

could you explain further? I m not quite sure my understanding is clear.

In joj3_config_generator/models/task.py, Config.path is relative to JOJ3_CONFIG_ROOT, so task.toml will located at JOJ3_CONFIG_ROOT / task_conf.path in JTC.

In `joj3_config_generator/models/task.py`, `Config.path` is relative to `JOJ3_CONFIG_ROOT`, so `task.toml` will located at `JOJ3_CONFIG_ROOT / task_conf.path` in JTC.
import shlex
jon-lee marked this conversation as resolved

Some with_.update is still using raw dict, not model with model_dump.

Some `with_.update` is still using raw dict, not model with `model_dump`.
from pathlib import Path
from typing import List, Tuple
from joj3_config_generator.models import result, task

View File

@ -765,7 +765,8 @@
]
}
],
"poststages": [
"preStages": [],
"postStages": [
{
"name": "teapot",
"group": "",

View File

@ -1 +1,2 @@
force_skip_health_check_on_test = true
force_skip_teapot_on_test = true

View File

@ -141,61 +141,7 @@
]
}
],
"poststages": [
{
"name": "teapot",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"args": [
"/usr/local/bin/joint-teapot",
"joj3-all-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--max-total-score",
"100"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 0,
"realCpuLimit": 0,
"clockLimit": 2,
"memoryLimit": 128000000,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": []
}
},
"parsers": [
{
"name": "log",
"with": {
"msg": "joj3 summary"
}
}
]
}
]
"preStages": [],
"postStages": []
}
}

View File

@ -1 +1,2 @@
force_skip_health_check_on_test = true
force_skip_teapot_on_test = true

View File

@ -111,61 +111,7 @@
]
}
],
"poststages": [
{
"name": "teapot",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"args": [
"/usr/local/bin/joint-teapot",
"joj3-all-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--max-total-score",
"100"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 0,
"realCpuLimit": 0,
"clockLimit": 2,
"memoryLimit": 128000000,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": []
}
},
"parsers": [
{
"name": "log",
"with": {
"msg": "joj3 summary"
}
}
]
}
]
"preStages": [],
"postStages": []
}
}

View File

@ -1 +1,2 @@
force_skip_health_check_on_test = true
force_skip_teapot_on_test = true

View File

@ -113,61 +113,7 @@
]
}
],
"poststages": [
{
"name": "teapot",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"args": [
"/usr/local/bin/joint-teapot",
"joj3-all-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--max-total-score",
"100"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 0,
"realCpuLimit": 0,
"clockLimit": 2,
"memoryLimit": 128000000,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": []
}
},
"parsers": [
{
"name": "log",
"with": {
"msg": "joj3 summary"
}
}
]
}
]
"preStages": [],
"postStages": []
}
}

View File

@ -1 +1,2 @@
force_skip_health_check_on_test = true
force_skip_teapot_on_test = true

View File

@ -138,61 +138,7 @@
]
}
],
"poststages": [
{
"name": "teapot",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"args": [
"/usr/local/bin/joint-teapot",
"joj3-all-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--max-total-score",
"100"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 0,
"realCpuLimit": 0,
"clockLimit": 2,
"memoryLimit": 128000000,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": []
}
},
"parsers": [
{
"name": "log",
"with": {
"msg": "joj3 summary"
}
}
]
}
]
"preStages": [],
"postStages": []
}
}

View File

@ -1 +1,2 @@
force_skip_health_check_on_test = true
force_skip_teapot_on_test = true

View File

@ -110,61 +110,7 @@
]
}
],
"poststages": [
{
"name": "teapot",
"group": "",
"executor": {
"name": "local",
"with": {
"default": {
"args": [
"/usr/local/bin/joint-teapot",
"joj3-all-env",
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--max-total-score",
"100"
],
"env": [
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
],
"cpuLimit": 0,
"realCpuLimit": 0,
"clockLimit": 2,
"memoryLimit": 128000000,
"stackLimit": 0,
"procLimit": 50,
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {},
"copyInDir": ".",
"copyOut": [
"stdout",
"stderr"
],
"copyOutCached": [],
"copyOutMax": 0,
"copyOutDir": "",
"tty": false,
"strictMemoryLimit": false,
"dataSegmentLimit": false,
"addressSpaceLimit": false
},
"cases": []
}
},
"parsers": [
{
"name": "log",
"with": {
"msg": "joj3 summary"
}
}
]
}
]
"preStages": [],
"postStages": []
}
}

View File

@ -1,5 +1,3 @@
import pytest
from tests.convert_joj1.utils import load_case