WIP: dev #6
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
from typing import List
 | 
			
		||||
 | 
			
		||||
from joj3_config_generator.models import joj1, repo, result, task
 | 
			
		||||
from joj3_config_generator.processers.repo import getHealthcheckConfig, getTeapotConfig
 | 
			
		||||
from joj3_config_generator.processers.repo import get_healthcheck_config, get_teapot_config
 | 
			
		||||
from joj3_config_generator.processers.task import (
 | 
			
		||||
    fix_diff,
 | 
			
		||||
    fix_dummy,
 | 
			
		||||
| 
						 | 
				
			
			@ -24,11 +24,11 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
 | 
			
		|||
            else -1
 | 
			
		||||
        ),
 | 
			
		||||
        stage=result.Stage(stages=[], sandbox_token=repo_conf.sandbox_token),
 | 
			
		||||
        teapot=result.Teapot(),
 | 
			
		||||
        teapot=get_teapot_config(repo_conf, task_conf),
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    # Construct healthcheck stage
 | 
			
		||||
    healthcheck_stage = getHealthcheckConfig(repo_conf)
 | 
			
		||||
    healthcheck_stage = get_healthcheck_config(repo_conf)
 | 
			
		||||
    result_conf.stage.stages.append(healthcheck_stage)
 | 
			
		||||
    cached: list[str] = []
 | 
			
		||||
    # Convert each stage in the task configuration
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,25 +6,25 @@ from pathlib import Path
 | 
			
		|||
from joj3_config_generator.models import repo, result, task
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getGradingRepoName() -> str:
 | 
			
		||||
def get_grading_repo_name() -> str:
 | 
			
		||||
    # FIXME: uncomment back when everything is ready!
 | 
			
		||||
    host_name = "engr151"
 | 
			
		||||
    # host_name = socket.gethostname()
 | 
			
		||||
    return f"{host_name.split('-')[0]}-joj"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getTeapotConfig(repo_conf: Repo, task_conf: Task) -> TeapotConfig:
 | 
			
		||||
    teapot = TeapotConfig(
 | 
			
		||||
def get_teapot_config(repo_conf: repo.Config, task_conf: task.Config) -> result.Teapot:
 | 
			
		||||
    teapot = result.Teapot(
 | 
			
		||||
        # TODO: fix the log path
 | 
			
		||||
        log_path=f"{task_conf.task.replace(' ', '-')}-joint-teapot-debug.log",
 | 
			
		||||
        scoreboard_path=f"{task_conf.task.replace(' ', '-')}-scoreboard.csv",
 | 
			
		||||
        failed_table_path=f"{task_conf.task.replace(' ', '-')}-failed-table.md",
 | 
			
		||||
        grading_repo_name=getGradingRepoName(),
 | 
			
		||||
        grading_repo_name=get_grading_repo_name(),
 | 
			
		||||
    )
 | 
			
		||||
    return teapot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getHealthcheckCmd(repo_conf: Repo) -> Cmd:
 | 
			
		||||
def get_healthcheck_cmd(repo_conf: repo.Config) -> result.Cmd:
 | 
			
		||||
    repoSize = repo_conf.max_size
 | 
			
		||||
    immutable = repo_conf.files.immutable
 | 
			
		||||
    repo_size = f"-repoSize={str(repoSize)} "
 | 
			
		||||
| 
						 | 
				
			
			@ -61,13 +61,13 @@ def getHealthcheckCmd(repo_conf: Repo) -> Cmd:
 | 
			
		|||
    return cmd
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getHealthcheckConfig(repo_conf: repo.Config) -> result.StageDetail:
 | 
			
		||||
def get_healthcheck_config(repo_conf: repo.Config) -> result.StageDetail:
 | 
			
		||||
    healthcheck_stage = result.StageDetail(
 | 
			
		||||
        name="healthcheck",
 | 
			
		||||
        group="",
 | 
			
		||||
        executor=ExecutorConfig(
 | 
			
		||||
            name="sandbox",
 | 
			
		||||
            with_=ExecutorWithConfig(default=getHealthcheckCmd(repo_conf), cases=[]),
 | 
			
		||||
            with_=result.ExecutorWith(default=get_healthcheck_cmd(repo_conf), cases=[]),
 | 
			
		||||
        ),
 | 
			
		||||
        parsers=[ParserConfig(name="healthcheck", with_={"score": 0, "comment": ""})],
 | 
			
		||||
    )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user