Compare commits

..

No commits in common. "87dd8acb69d1ae5ce2cb4e2cd74c961d78911626" and "ce4605a22a91fefac578f6e62f86ae0a18ad4d8e" have entirely different histories.

5 changed files with 10 additions and 25 deletions

View File

@ -2,9 +2,7 @@ import os
from typing import Dict
from joj3_config_generator.models import answer, joj1, repo, result, task
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.models.const import CACHE_ROOT, JOJ3_CONFIG_ROOT
from joj3_config_generator.transformers.repo import (
get_health_check_stage,
get_teapot_stage,
@ -12,12 +10,14 @@ 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 get_task_conf_from_answers(answers)
return task.Config(task=task.Task(name=answers.name, type_=answers.type_))
# TODO: implement
def convert_joj1_conf(joj1_conf: joj1.Config) -> task.Config:
return get_task_conf_from_joj1(joj1_conf)
return task.Config()
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(JOJ3_LOG_ROOT / f"{task_conf.task.type_}.log"),
log_path=str(CACHE_ROOT / "joj3" / 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(ACTOR_CSV_PATH), # students.csv position
actor_csv_path=str(JOJ3_CONFIG_ROOT / "students.csv"), # students.csv position
max_total_score=repo_conf.max_total_score,
stage=result.Stage(sandbox_token=repo_conf.sandbox_token),
)

View File

@ -9,6 +9,3 @@ 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

@ -1,6 +0,0 @@
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

@ -1,6 +0,0 @@
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 TEAPOT_CONFIG_ROOT, TEAPOT_LOG_ROOT
from joj3_config_generator.models.const import CACHE_ROOT, TEAPOT_CONFIG_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={TEAPOT_LOG_ROOT}/joint-teapot-debug.log"],
env=[f"LOG_FILE_PATH={CACHE_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={TEAPOT_LOG_ROOT}/joint-teapot-debug.log"],
env=[f"LOG_FILE_PATH={CACHE_ROOT}/joint-teapot-debug.log"],
),
],
),