This commit is contained in:
parent
87dd8acb69
commit
80ba2f1451
|
@ -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 ACTOR_CSV_PATH, JOJ3_LOG_ROOT
|
from joj3_config_generator.models.const import ACTOR_CSV_PATH, JOJ3_LOG_PATH
|
||||||
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,7 +25,7 @@ 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(JOJ3_LOG_ROOT / f"{task_conf.task.type_}.log"),
|
log_path=str(JOJ3_LOG_PATH),
|
||||||
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(ACTOR_CSV_PATH), # students.csv position
|
actor_csv_path=str(ACTOR_CSV_PATH), # students.csv position
|
||||||
|
|
|
@ -11,7 +11,6 @@ from joj3_config_generator.models import answer, joj1, repo, task
|
||||||
def load_joj3_task_toml_answers() -> answer.Answers:
|
def load_joj3_task_toml_answers() -> answer.Answers:
|
||||||
questions = [
|
questions = [
|
||||||
inquirer.Text(name="name", message="What's the task name?"),
|
inquirer.Text(name="name", message="What's the task name?"),
|
||||||
inquirer.Text(name="type", message="What's the task type?"),
|
|
||||||
inquirer.Checkbox(
|
inquirer.Checkbox(
|
||||||
"stages",
|
"stages",
|
||||||
message="What kind of stages do you need?",
|
message="What kind of stages do you need?",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from pydantic import AliasChoices, BaseModel, Field
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class StageEnum(str, Enum):
|
class StageEnum(str, Enum):
|
||||||
|
@ -13,8 +13,4 @@ class StageEnum(str, Enum):
|
||||||
|
|
||||||
class Answers(BaseModel):
|
class Answers(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
type_: str = Field(
|
|
||||||
serialization_alias="type",
|
|
||||||
validation_alias=AliasChoices("type_", "type"),
|
|
||||||
)
|
|
||||||
stages: List[str]
|
stages: List[str]
|
||||||
|
|
|
@ -9,6 +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"
|
JOJ3_LOG_PATH = CACHE_ROOT / "joj3.log"
|
||||||
TEAPOT_LOG_ROOT = CACHE_ROOT
|
TEAPOT_LOG_PATH = CACHE_ROOT / "joint-teapot-debug.log"
|
||||||
ACTOR_CSV_PATH = JOJ3_CONFIG_ROOT / "students.csv"
|
ACTOR_CSV_PATH = JOJ3_CONFIG_ROOT / "students.csv"
|
||||||
|
|
|
@ -3,14 +3,7 @@ from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Type
|
from typing import Any, Dict, List, Type
|
||||||
|
|
||||||
from pydantic import (
|
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
||||||
AliasChoices,
|
|
||||||
BaseModel,
|
|
||||||
ConfigDict,
|
|
||||||
Field,
|
|
||||||
field_validator,
|
|
||||||
model_validator,
|
|
||||||
)
|
|
||||||
|
|
||||||
from joj3_config_generator.models.common import Memory, Time
|
from joj3_config_generator.models.common import Memory, Time
|
||||||
from joj3_config_generator.models.const import (
|
from joj3_config_generator.models.const import (
|
||||||
|
@ -148,11 +141,6 @@ class Release(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class Task(BaseModel):
|
class Task(BaseModel):
|
||||||
type_: str = Field(
|
|
||||||
"unknown",
|
|
||||||
serialization_alias="type",
|
|
||||||
validation_alias=AliasChoices("type_", "type"),
|
|
||||||
)
|
|
||||||
name: str = "unknown"
|
name: str = "unknown"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,4 @@ from joj3_config_generator.models import answer, task
|
||||||
|
|
||||||
# TODO: implement
|
# TODO: implement
|
||||||
def get_task_conf_from_answers(answers: answer.Answers) -> task.Config:
|
def get_task_conf_from_answers(answers: answer.Answers) -> task.Config:
|
||||||
return task.Config(task=task.Task(name=answers.name, type_=answers.type_))
|
return task.Config(task=task.Task(name=answers.name))
|
||||||
|
|
|
@ -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 TEAPOT_CONFIG_ROOT, TEAPOT_LOG_ROOT
|
from joj3_config_generator.models.const import TEAPOT_CONFIG_ROOT, TEAPOT_LOG_PATH
|
||||||
|
|
||||||
|
|
||||||
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={TEAPOT_LOG_ROOT}/joint-teapot-debug.log"],
|
env=[f"LOG_FILE_PATH={TEAPOT_LOG_PATH}"],
|
||||||
),
|
),
|
||||||
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={TEAPOT_LOG_ROOT}/joint-teapot-debug.log"],
|
env=[f"LOG_FILE_PATH={TEAPOT_LOG_PATH}"],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
|
"logPath": "/home/tt/.cache/joj3.log",
|
||||||
"expireUnixTimestamp": 1735574399,
|
"expireUnixTimestamp": 1735574399,
|
||||||
"effectiveUnixTimestamp": 1735487999,
|
"effectiveUnixTimestamp": 1735487999,
|
||||||
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
"actorCsvPath": "/home/tt/.config/joj/students.csv",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# general task configuration
|
# general task configuration
|
||||||
task.name = "hw7 ex2" # task name
|
task.name = "hw7 ex2" # task name
|
||||||
task.type = "homework/h7/e2" # remove this task type later
|
|
||||||
|
|
||||||
release.end_time = 2024-12-30 23:59:59+08:00
|
release.end_time = 2024-12-30 23:59:59+08:00
|
||||||
release.begin_time = 2024-12-29 23:59:59+08:00
|
release.begin_time = 2024-12-29 23:59:59+08:00
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"name": "hw7 ex2",
|
"name": "hw7 ex2",
|
||||||
"type": "homework/h7/e2",
|
|
||||||
"stages": ["Compilation"]
|
"stages": ["Compilation"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
[task]
|
[task]
|
||||||
name = "hw7 ex2"
|
name = "hw7 ex2"
|
||||||
type = "homework/h7/e2"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user