The farm's GPU wait gives up on a run that ran out of its own time, as .remote() did

Modal's FunctionTimeoutError is a subclass of its TimeoutError, so waited() caught a run's own timeout as "no answer
yet" and asked again forever, logging "waiting" instead of failing the job. It now goes up as before. Test: a run that
timed out fails the job with no wait lines.
This commit is contained in:
shinyobjectz committed 2026-11-30 07:41:25 -08:00
1 parent 349a934eb9
commit cdcb8dacbd
2 files changed
+20 -1

No files matched your search

+5 -1
View File
@@ -64,7 +64,11 @@ def waited(fn, log, *a, **kw):
while True:
try:
return call.get(timeout=WAIT_SAY_S)
except timeouts:
except timeouts as e:
# Modal's FunctionTimeoutError is a TimeoutError too: the run itself ran out of time, so it goes up as
# .remote() raised it, not waited on again (it would answer the same at once, forever)
if type(e).__name__ == "FunctionTimeoutError":
raise
log(f"raea farm: waiting {time.time() - t:.0f} s for a GPU run to answer (queued while the workspace's GPUs are busy, or still drawing)")
+15
View File
@@ -174,4 +174,19 @@ assert fp.waited(SlowGpu(), log, "j4", ["render"]) == {"code": 0, "out": "drawn"
assert sum("waiting" in l and "GPU run" in l for l in lines) == 2, lines
ok("a GPU run that hasn't answered is said in the log every WAIT_SAY_S until it does")
# a GPU run that ran out of its own time fails the job, as .remote() did, instead of being waited on forever
class FunctionTimeoutError(TimeoutError): pass
class TimedOutCall:
def get(self, timeout=None): raise FunctionTimeoutError("Function timeout")
class TimedOutGpu:
def spawn(self, *a, **kw): return TimedOutCall()
lines.clear()
try:
fp.waited(TimedOutGpu(), log, "j5", ["render"])
raise AssertionError("waited() swallowed a function timeout")
except FunctionTimeoutError:
pass
assert not any("waiting" in l for l in lines), lines
ok("a GPU run that timed out fails the job instead of being waited on forever")
shutil.rmtree(root)