Compare commits

...

2 Commits

Author SHA1 Message Date
87dd8acb69
chore: more consts
All checks were successful
build / build (push) Successful in 2m1s
2025-03-15 03:23:29 -04:00
cc000c93ff
chore: move functions 2025-03-15 03:19:01 -04:00
5 changed files with 25 additions and 10 deletions

View File

@ -2,7 +2,9 @@ import os
from typing import Dict
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.joj1 import get_task_conf_from_joj1
from joj3_config_generator.transformers.repo import (
get_health_check_stage,
get_teapot_stage,
@ -10,14 +12,12 @@ from joj3_config_generator.transformers.repo import (
from joj3_config_generator.transformers.task import get_conf_stage
# TODO: implement
def create_joj3_task_conf(answers: answer.Answers) -> task.Config:
return task.Config(task=task.Task(name=answers.name, type_=answers.type_))
return get_task_conf_from_answers(answers)
# TODO: implement
def convert_joj1_conf(joj1_conf: joj1.Config) -> task.Config:
return task.Config()
return get_task_conf_from_joj1(joj1_conf)
def convert_joj3_conf(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
@ -25,10 +25,10 @@ def convert_joj3_conf(repo_conf: repo.Config, task_conf: task.Config) -> result.
result_conf = result.Config(
name=task_conf.task.name,
# 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()),
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,
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")
TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot")
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

@ -0,0 +1,6 @@
from joj3_config_generator.models import answer, task
# TODO: implement
def get_task_conf_from_answers(answers: answer.Answers) -> task.Config:
return task.Config(task=task.Task(name=answers.name, type_=answers.type_))

View File

@ -0,0 +1,6 @@
from joj3_config_generator.models import joj1, task
# TODO: implement
def get_task_conf_from_joj1(joj1_conf: joj1.Config) -> task.Config:
return task.Config()

View File

@ -3,7 +3,7 @@ from pathlib import Path
from typing import List
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:
@ -24,7 +24,7 @@ def get_teapot_stage(repo_conf: repo.Config) -> result.StageDetail:
with_=result.ExecutorWith(
default=result.Cmd(
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=[],
),
@ -78,7 +78,7 @@ def get_health_check_stage(repo_conf: repo.Config) -> result.StageDetail:
),
result.OptionalCmd(
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"],
),
],
),