feat: remove task.type from task.toml
Some checks failed
build / build (push) Failing after 2m2s

This commit is contained in:
张泊明518370910136 2025-03-15 05:10:42 -04:00
parent 87dd8acb69
commit 80ba2f1451
GPG Key ID: D47306D7062CDA9D
23 changed files with 17 additions and 43 deletions

View File

@ -2,7 +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.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.joj1 import get_task_conf_from_joj1
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(
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(JOJ3_LOG_PATH),
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

View File

@ -11,7 +11,6 @@ from joj3_config_generator.models import answer, joj1, repo, task
def load_joj3_task_toml_answers() -> answer.Answers:
questions = [
inquirer.Text(name="name", message="What's the task name?"),
inquirer.Text(name="type", message="What's the task type?"),
inquirer.Checkbox(
"stages",
message="What kind of stages do you need?",

View File

@ -1,7 +1,7 @@
from enum import Enum
from typing import List
from pydantic import AliasChoices, BaseModel, Field
from pydantic import BaseModel
class StageEnum(str, Enum):
@ -13,8 +13,4 @@ class StageEnum(str, Enum):
class Answers(BaseModel):
name: str
type_: str = Field(
serialization_alias="type",
validation_alias=AliasChoices("type_", "type"),
)
stages: List[str]

View File

@ -9,6 +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
JOJ3_LOG_PATH = CACHE_ROOT / "joj3.log"
TEAPOT_LOG_PATH = CACHE_ROOT / "joint-teapot-debug.log"
ACTOR_CSV_PATH = JOJ3_CONFIG_ROOT / "students.csv"

View File

@ -3,14 +3,7 @@ from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Type
from pydantic import (
AliasChoices,
BaseModel,
ConfigDict,
Field,
field_validator,
model_validator,
)
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
from joj3_config_generator.models.common import Memory, Time
from joj3_config_generator.models.const import (
@ -148,11 +141,6 @@ class Release(BaseModel):
class Task(BaseModel):
type_: str = Field(
"unknown",
serialization_alias="type",
validation_alias=AliasChoices("type_", "type"),
)
name: str = "unknown"

View File

@ -3,4 +3,4 @@ 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_))
return task.Config(task=task.Task(name=answers.name))

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 TEAPOT_CONFIG_ROOT, TEAPOT_LOG_PATH
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={TEAPOT_LOG_PATH}"],
),
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={TEAPOT_LOG_PATH}"],
),
],
),

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,6 +1,6 @@
{
"name": "hw7 ex2",
"logPath": "/home/tt/.cache/joj3/homework/h7/e2.log",
"logPath": "/home/tt/.cache/joj3.log",
"expireUnixTimestamp": 1735574399,
"effectiveUnixTimestamp": 1735487999,
"actorCsvPath": "/home/tt/.config/joj/students.csv",

View File

@ -1,6 +1,5 @@
# general task configuration
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.begin_time = 2024-12-29 23:59:59+08:00

View File

@ -1,5 +1,4 @@
{
"name": "hw7 ex2",
"type": "homework/h7/e2",
"stages": ["Compilation"]
}

View File

@ -1,3 +1,2 @@
[task]
name = "hw7 ex2"
type = "homework/h7/e2"