feat: remove backward compatibility codes
Some checks failed
build / build (push) Failing after 2m12s
build / trigger-build-image (push) Has been skipped

This commit is contained in:
张泊明518370910136 2025-09-10 21:50:58 -07:00
parent 7849cf9b3a
commit 0a625a76dd
GPG Key ID: D47306D7062CDA9D
3 changed files with 0 additions and 49 deletions

View File

@ -30,9 +30,6 @@ def convert_joj3_conf(repo_conf: repo.Config, task_conf: task.Config) -> result.
name=task_conf.name, name=task_conf.name,
# exact folder difference specified by type # exact folder difference specified by type
log_path=str(JOJ3_LOG_BASE_PATH / task_conf.suffix / JOJ3_LOG_FILENAME), log_path=str(JOJ3_LOG_BASE_PATH / task_conf.suffix / JOJ3_LOG_FILENAME),
# TODO: remove these 2 fields, will be handled in the health check stage
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(ACTOR_CSV_PATH), # students.csv position
max_total_score=( max_total_score=(
repo_conf.max_total_score repo_conf.max_total_score

View File

@ -90,24 +90,6 @@ class Config(BaseModel):
health_check: HealthCheck = Field( health_check: HealthCheck = Field(
HealthCheck(), validation_alias=AliasChoices("health-check", "health_check") HealthCheck(), validation_alias=AliasChoices("health-check", "health_check")
) )
# TODO: remove files, max_size, health_check_score, and immutable_path in the future
files: Files = Files()
max_size: float = Field(
10, ge=0, validation_alias=AliasChoices("max-size", "max_size")
)
health_check_score: int = Field(
0, validation_alias=AliasChoices("health-check-score", "health_check_score")
)
immutable_path: Path = Field(
Path("immutable"),
validation_alias=AliasChoices("immutable-path", "immutable_path"),
)
# TODO: remove gitea_token and gitea_org in the future
gitea_token: str = Field(
"", validation_alias=AliasChoices("gitea-token", "gitea_token")
)
gitea_org: str = Field("", validation_alias=AliasChoices("gitea-org", "gitea_org"))
@model_validator(mode="after") @model_validator(mode="after")
def set_grading_repo_name_from_cwd(self) -> "Config": def set_grading_repo_name_from_cwd(self) -> "Config":
@ -118,19 +100,3 @@ class Config(BaseModel):
else: else:
self.grading_repo_name = Path.cwd().name self.grading_repo_name = Path.cwd().name
return self return self
# TODO: remove this validator in the future
@model_validator(mode="after")
def set_health_check(self) -> "Config":
if "health_check_score" in self.model_fields_set:
self.health_check.score = self.health_check_score
if "max_size" in self.model_fields_set:
self.health_check.max_size = Memory(f"{self.max_size}m")
if "immutable_path" in self.model_fields_set:
self.health_check.immutable_path = self.immutable_path
if (
"files" in self.model_fields_set
and "required" in self.files.model_fields_set
):
self.health_check.required_files = self.files.required
return self

View File

@ -252,10 +252,6 @@ class SubmissionTime(BaseModel):
end: Optional[datetime] = None end: Optional[datetime] = None
class Task(BaseModel):
name: str = "unknown"
class Penalties(BaseModel): class Penalties(BaseModel):
hours: List[float] = [] hours: List[float] = []
factors: List[float] = [] factors: List[float] = []
@ -266,7 +262,6 @@ class Config(BaseModel):
path: Path = Field(Path("task.toml"), exclude=True) path: Path = Field(Path("task.toml"), exclude=True)
suffix: str = Field("", exclude=True) suffix: str = Field("", exclude=True)
task: Task = Task() # TODO: remove it in the future
name: str = "unknown" # Task name (e.g., hw3 ex5) name: str = "unknown" # Task name (e.g., hw3 ex5)
max_total_score: Optional[int] = Field( max_total_score: Optional[int] = Field(
None, validation_alias=AliasChoices("max-total-score", "max_total_score") None, validation_alias=AliasChoices("max-total-score", "max_total_score")
@ -284,13 +279,6 @@ class Config(BaseModel):
penalties: Penalties = Penalties() penalties: Penalties = Penalties()
stages: List[Stage] = [] # list of stage configurations stages: List[Stage] = [] # list of stage configurations
# TODO: remove this validator in the future
@model_validator(mode="after")
def set_name(self) -> "Config":
if "task" in self.model_fields_set and "name" in self.task.model_fields_set:
self.name = self.task.name
return self
@model_validator(mode="after") @model_validator(mode="after")
def set_suffix(self) -> "Config": def set_suffix(self) -> "Config":
if not self.suffix: if not self.suffix: