JacobLinCool commited on
Commit
8dc8832
·
verified ·
1 Parent(s): 46a21ce

fix: cap zerogpu allocation duration

Browse files
Files changed (1) hide show
  1. hackathon_advisor/zerogpu.py +4 -1
hackathon_advisor/zerogpu.py CHANGED
@@ -10,7 +10,8 @@ R = TypeVar("R")
10
 
11
 
12
  TRUE_VALUES = {"1", "true", "yes", "on"}
13
- DEFAULT_GPU_DURATION_SECONDS = 180
 
14
 
15
 
16
  def zero_gpu_enabled() -> bool:
@@ -24,6 +25,8 @@ def zero_gpu_duration_seconds() -> int:
24
  duration = int(raw)
25
  if duration <= 0:
26
  raise RuntimeError("ADVISOR_ZERO_GPU_DURATION must be a positive integer.")
 
 
27
  return duration
28
 
29
 
 
10
 
11
 
12
  TRUE_VALUES = {"1", "true", "yes", "on"}
13
+ DEFAULT_GPU_DURATION_SECONDS = 60
14
+ MAX_GPU_DURATION_SECONDS = 120
15
 
16
 
17
  def zero_gpu_enabled() -> bool:
 
25
  duration = int(raw)
26
  if duration <= 0:
27
  raise RuntimeError("ADVISOR_ZERO_GPU_DURATION must be a positive integer.")
28
+ if duration > MAX_GPU_DURATION_SECONDS:
29
+ raise RuntimeError(f"ADVISOR_ZERO_GPU_DURATION must be at most {MAX_GPU_DURATION_SECONDS} seconds.")
30
  return duration
31
 
32