Skip to content

Commit

Permalink
Merge pull request #252 from TU-Wien-dataLAB/release-0.6.0
Browse files Browse the repository at this point in the history
refactor: added configurationable values for grading poll intervals/max grading time
  • Loading branch information
florian-jaeger authored Nov 25, 2024
2 parents 2784678 + d0d8ee7 commit 371bccc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions grader_service/autograding/kube/kube_grader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ class GraderPod(LoggingConfigurable):
"""
Wrapper for a kubernetes pod that supports polling of the pod's status.
"""
poll_interval = Integer(default_value=1000,
poll_interval = Integer(default_value=5,
allow_none=False,
help="Time in ms to wait before "
help="Time in sec to wait before "
"status is polled again.").tag(config=True)
max_grading_time = Integer(default_value=3600,
allow_none=False,
help="Maximal grading time in sec before the grading fails").tag(config=True)

def __init__(self, pod: V1Pod, api: CoreV1Api, **kwargs):
super().__init__(**kwargs)
Expand Down Expand Up @@ -68,8 +71,8 @@ def namespace(self) -> str:
async def _poll_status(self) -> str:
meta: V1ObjectMeta = self.pod.metadata
start_time = time.time()
interval = 5
timeout = 1200
interval = self.poll_interval
timeout = self.max_grading_time

while True:
# Read the pod status using read_namespaced_pod_status
Expand Down

0 comments on commit 371bccc

Please sign in to comment.