feat: time.begin and time.end for teapot time check
All checks were successful
build / build (push) Successful in 1m52s
build / trigger-build-image (push) Successful in 8s

This commit is contained in:
张泊明518370910136 2025-06-18 09:13:34 -04:00
parent d8073e4eb6
commit 52f82a4afc
GPG Key ID: D47306D7062CDA9D
3 changed files with 14 additions and 3 deletions

View File

@ -26,8 +26,8 @@ def convert_joj3_conf(repo_conf: repo.Config, task_conf: task.Config) -> result.
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_PATH), log_path=str(JOJ3_LOG_PATH),
expire_unix_timestamp=int(task_conf.release.end_time.timestamp()), expire_unix_timestamp=0, # will be handled in the health check stage
effective_unix_timestamp=int(task_conf.release.begin_time.timestamp()), effective_unix_timestamp=0, # will be handled in the health check stage
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

@ -211,6 +211,11 @@ class Release(BaseModel):
) # timestamp = 0, no begin time ) # timestamp = 0, no begin time
class SubmissionTime(BaseModel):
begin: Optional[datetime] = None
end: Optional[datetime] = None
class Task(BaseModel): class Task(BaseModel):
name: str = "unknown" name: str = "unknown"
@ -219,6 +224,7 @@ class Config(BaseModel):
root: Path = Path(".") root: Path = Path(".")
path: Path = Path("task.toml") path: Path = Path("task.toml")
task: Task = Task() # Task name (e.g., hw3 ex5) task: Task = Task() # Task name (e.g., hw3 ex5)
time: SubmissionTime = SubmissionTime() # Valid time configuration
release: Release = Release() # Release configuration release: Release = Release() # Release configuration
stages: List[Stage] = [] # list of stage configurations stages: List[Stage] = [] # list of stage configurations
groups: Groups = Groups() groups: Groups = Groups()

View File

@ -95,6 +95,10 @@ def get_teapot_check_args(repo_conf: repo.Config, task_conf: task.Config) -> Lis
task_conf.groups if task_conf.groups.name else repo_conf.groups task_conf.groups if task_conf.groups.name else repo_conf.groups
) )
res.extend(["--group-config", group_config]) res.extend(["--group-config", group_config])
if task_conf.time.begin:
res.extend(["--begin-time", task_conf.time.begin.isoformat()])
if task_conf.time.end:
res.extend(["--end-time", task_conf.time.end.isoformat()])
return res return res
@ -108,7 +112,8 @@ def get_health_check_stage(
name="local", name="local",
with_=result.ExecutorWith( with_=result.ExecutorWith(
default=result.Cmd( default=result.Cmd(
cpu_limit=common.Time("10s"), clock_limit=common.Time("20s") cpu_limit=common.Time("10s"),
clock_limit=common.Time("20s"),
), ),
cases=[ cases=[
result.OptionalCmd( result.OptionalCmd(