chore: more consts
All checks were successful
build / build (push) Successful in 2m1s

This commit is contained in:
张泊明518370910136 2025-03-15 03:23:29 -04:00
parent cc000c93ff
commit 87dd8acb69
GPG Key ID: D47306D7062CDA9D
3 changed files with 9 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import os
from typing import Dict from typing import Dict
from joj3_config_generator.models import answer, joj1, repo, result, task from joj3_config_generator.models import answer, joj1, repo, result, task
from joj3_config_generator.models.const import CACHE_ROOT, JOJ3_CONFIG_ROOT from joj3_config_generator.models.const import ACTOR_CSV_PATH, JOJ3_LOG_ROOT
from joj3_config_generator.transformers.answer import get_task_conf_from_answers from joj3_config_generator.transformers.answer import get_task_conf_from_answers
from joj3_config_generator.transformers.joj1 import get_task_conf_from_joj1 from joj3_config_generator.transformers.joj1 import get_task_conf_from_joj1
from joj3_config_generator.transformers.repo import ( from joj3_config_generator.transformers.repo import (
@ -25,10 +25,10 @@ def convert_joj3_conf(repo_conf: repo.Config, task_conf: task.Config) -> result.
result_conf = result.Config( result_conf = result.Config(
name=task_conf.task.name, name=task_conf.task.name,
# exact folder difference specified by type # exact folder difference specified by type
log_path=str(CACHE_ROOT / "joj3" / f"{task_conf.task.type_}.log"), log_path=str(JOJ3_LOG_ROOT / f"{task_conf.task.type_}.log"),
expire_unix_timestamp=int(task_conf.release.end_time.timestamp()), expire_unix_timestamp=int(task_conf.release.end_time.timestamp()),
effective_unix_timestamp=int(task_conf.release.begin_time.timestamp()), effective_unix_timestamp=int(task_conf.release.begin_time.timestamp()),
actor_csv_path=str(JOJ3_CONFIG_ROOT / "students.csv"), # students.csv position actor_csv_path=str(ACTOR_CSV_PATH), # students.csv position
max_total_score=repo_conf.max_total_score, max_total_score=repo_conf.max_total_score,
stage=result.Stage(sandbox_token=repo_conf.sandbox_token), stage=result.Stage(sandbox_token=repo_conf.sandbox_token),
) )

View File

@ -9,3 +9,6 @@ DEFAULT_FILE_LIMIT = Memory("32m")
JOJ3_CONFIG_ROOT = Path("/home/tt/.config/joj") JOJ3_CONFIG_ROOT = Path("/home/tt/.config/joj")
TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot") TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot")
CACHE_ROOT = Path("/home/tt/.cache") CACHE_ROOT = Path("/home/tt/.cache")
JOJ3_LOG_ROOT = CACHE_ROOT / "joj3"
TEAPOT_LOG_ROOT = CACHE_ROOT
ACTOR_CSV_PATH = JOJ3_CONFIG_ROOT / "students.csv"

View File

@ -3,7 +3,7 @@ from pathlib import Path
from typing import List from typing import List
from joj3_config_generator.models import repo, result from joj3_config_generator.models import repo, result
from joj3_config_generator.models.const import CACHE_ROOT, TEAPOT_CONFIG_ROOT from joj3_config_generator.models.const import TEAPOT_CONFIG_ROOT, TEAPOT_LOG_ROOT
def get_teapot_stage(repo_conf: repo.Config) -> result.StageDetail: def get_teapot_stage(repo_conf: repo.Config) -> result.StageDetail:
@ -24,7 +24,7 @@ def get_teapot_stage(repo_conf: repo.Config) -> result.StageDetail:
with_=result.ExecutorWith( with_=result.ExecutorWith(
default=result.Cmd( default=result.Cmd(
args=args, args=args,
env=[f"LOG_FILE_PATH={CACHE_ROOT}/joint-teapot-debug.log"], env=[f"LOG_FILE_PATH={TEAPOT_LOG_ROOT}/joint-teapot-debug.log"],
), ),
cases=[], cases=[],
), ),
@ -78,7 +78,7 @@ def get_health_check_stage(repo_conf: repo.Config) -> result.StageDetail:
), ),
result.OptionalCmd( result.OptionalCmd(
args=get_teapot_check_args(repo_conf), args=get_teapot_check_args(repo_conf),
env=[f"LOG_FILE_PATH={CACHE_ROOT}/joint-teapot-debug.log"], env=[f"LOG_FILE_PATH={TEAPOT_LOG_ROOT}/joint-teapot-debug.log"],
), ),
], ],
), ),