dev #10

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

View File

@ -30,6 +30,8 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
if task_conf.release.deadline
else -1
),
jon-lee marked this conversation as resolved Outdated

Make this Path.home() default to /home/tt. For now, create a const for this dir.

Make this `Path.home()` default to `/home/tt`. For now, create a const for this dir.

fixed

fixed
# FIXME: don't hardcode
actor_csv_path="/home/tt/.config/joj/students.csv",
stage=result.Stage(stages=[], sandbox_token=repo_conf.sandbox_token),
teapot=get_teapot_config(repo_conf, task_conf),
)
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.

View File

@ -72,7 +72,10 @@ def convert(root: Path = Path(".")) -> Dict[str, Any]:
# FIXME: change the path to the server
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 = (
"/mnt/c/Users/Nuvole/Desktop/engr151-joj/home/tt/.config/joj/tests/homework"
)
assert os.path.exists(folder_path), f"there exists no {folder_path}"
distribute_json(folder_path, repo_obj)
return result_dict

View File

@ -144,5 +144,6 @@ class Config(BaseModel):
name: str = "unknown"
log_path: str = Field("", serialization_alias="logPath")
expire_unix_timestamp: int = Field(-1, serialization_alias="expireUnixTimestamp")
actor_csv_path: str = Field("", serialization_alias="actorCsvPath")
stage: Stage
teapot: Teapot

View File

@ -56,8 +56,15 @@ def get_executorWithConfig(
if task_stage.command is not None
else []
),
# FIXME: remove this trick
copy_in={
file: result.CmdFile(src=f"/home/tt/.config/joj/{file}")
("./.clang-tidy" if file.endswith("clang-tidy") else file): (
result.CmdFile(src=f"/home/tt/.config/joj/{file}")
if not file.endswith("main.cpp")
jon-lee marked this conversation as resolved Outdated

not necessary

not necessary

resolved.

resolved.
else result.CmdFile(
src=f"/home/tt/.config/joj/tests/homework/h7/e3/ex3-main.cpp"
)
)
for file in copy_in_files
},
stdin=(
@ -242,8 +249,8 @@ def fix_diff(
stage_cases.append(
result.OptionalCmd(
stdin=result.CmdFile(
# src=f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}"
src=f"/home/tt/.config/joj/{task_stage.path}/{stdin}"
src=f"/home/tt/.config/joj/{task_conf.task.type_}/{stdin}"
# src=f"/home/tt/.config/joj/{task_stage.path}/{stdin}"
),
args=(
shlex.split(case_stage.command) if command is not None else None
@ -268,8 +275,8 @@ def fix_diff(
{
"score": diff_output.score,
"fileName": "stdout",
# "answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}",
"answerPath": f"/home/tt/.config/joj/{task_stage.path}/{stdin}",
"answerPath": f"/home/tt/.config/joj/{task_conf.task.type_}/{stdout}",
# "answerPath": f"/home/tt/.config/joj/{task_stage.path}/{stdin}",
"forceQuitOnDiff": diff_output.forcequit,
"alwaysHide": diff_output.hide,
"compareSpace": not diff_output.ignorespaces,

View File

@ -7,4 +7,4 @@ sandbox_token = "test"
whitelist_patterns = ["*.py", "*.txt", "*.md"]
whitelist_file = ".whitelist"
required = ["README.md" ]
immutable = [".gitignore", ".gitattributes", ".gitea/workflows/release.yaml" ]
immutable = [".gitignore", ".gitattributes",".gitea/workflows/push.yaml", ".gitea/workflows/release.yaml" ]

View File

@ -2,6 +2,7 @@
"name": "e2",
"logPath": "/home/tt/.cache/joj3/exam/e2.log",
"expireUnixTimestamp": 1735574399,
"actorCsvPath": "/home/tt/.config/joj/students.csv",
"stage": {
"sandboxExecServer": "172.17.0.1:5051",
"sandboxToken": "test",
@ -18,8 +19,8 @@
"-root=.",
"-repoSize=50.5",
"-meta=README.md",
"-checkFileSumList=12e3ffc45b2cf64a83f208d982b23559ac6b73e68055ba396fe291efeec3732a,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,46b08d7120f3947261eba15fd6323561f310b4732e8528c01e0144db1ce18375",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/release.yaml"
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,ad7ba6fbee5d80e018e4190e31bd842553d540044f0faf13592d73cef93a061b",
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
],
"env": [
"PATH=/usr/bin:/bin:/usr/local/bin"

View File

@ -10,10 +10,14 @@
!.gitignore
!.gitattributes
!.gitea/
!.gitea/issue_template/
!.gitea/workflows/
!*.yaml
!Makefile
!CMakeLists.txt
!h[0-8]/
!*.m
!*.c
!*.cpp
!*.h
!*.md

View File

@ -18,4 +18,4 @@ jobs:
fetch-depth: 0
- name: run joj3
run: |
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/exam" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"
sudo -E -u tt joj3 -conf-root "/home/tt/.config/joj/tests/homework" -conf-name "conf-release.json" -tag "${{ github.ref_name }}"