Compare commits
2 Commits
ce4605a22a
...
87dd8acb69
Author | SHA1 | Date | |
---|---|---|---|
87dd8acb69 | |||
cc000c93ff |
|
@ -2,7 +2,9 @@ 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.joj1 import get_task_conf_from_joj1
|
||||||
from joj3_config_generator.transformers.repo import (
|
from joj3_config_generator.transformers.repo import (
|
||||||
get_health_check_stage,
|
get_health_check_stage,
|
||||||
get_teapot_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
|
from joj3_config_generator.transformers.task import get_conf_stage
|
||||||
|
|
||||||
|
|
||||||
# TODO: implement
|
|
||||||
def create_joj3_task_conf(answers: answer.Answers) -> task.Config:
|
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:
|
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:
|
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(
|
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),
|
||||||
)
|
)
|
||||||
|
|
|
@ -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"
|
||||||
|
|
6
joj3_config_generator/transformers/answer.py
Normal file
6
joj3_config_generator/transformers/answer.py
Normal 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_))
|
6
joj3_config_generator/transformers/joj1.py
Normal file
6
joj3_config_generator/transformers/joj1.py
Normal 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()
|
|
@ -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"],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user