dispatcher : fix spin loop quand pas de worker dispo (sleep 30s)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -293,12 +293,13 @@ def run_one_stitch(stitch: sqlite3.Row):
|
||||
finished_at=_now_iso())
|
||||
|
||||
|
||||
def run_one(job: sqlite3.Row):
|
||||
def run_one(job: sqlite3.Row) -> bool:
|
||||
"""Returns True if a worker was picked and work started."""
|
||||
job_id = job["id"]
|
||||
estimated = estimate_vram_mib(job["frame_count"] or 400)
|
||||
worker = pick_worker(estimated)
|
||||
if not worker:
|
||||
return
|
||||
return False
|
||||
set_status(job_id, status="extracting", worker_host=worker["host"], started_at=_now_iso())
|
||||
try:
|
||||
frames_dir = do_extract(job, worker)
|
||||
@@ -311,6 +312,7 @@ def run_one(job: sqlite3.Row):
|
||||
_maybe_create_per_auv_stitch(job_id)
|
||||
except Exception as e:
|
||||
set_status(job_id, status="error", error=str(e)[:2000], finished_at=_now_iso())
|
||||
return True
|
||||
|
||||
|
||||
def pop_queued() -> sqlite3.Row | None:
|
||||
@@ -333,7 +335,9 @@ def main():
|
||||
job = pop_queued()
|
||||
if job:
|
||||
print(f"→ job #{job['id']} ({job['auv']}/{job['gopro_serial']}/{job['segment_label']})")
|
||||
run_one(job)
|
||||
if not run_one(job):
|
||||
print(" ↳ pas de worker dispo, retry dans 30s")
|
||||
time.sleep(30)
|
||||
continue
|
||||
stitch = pop_queued_stitch()
|
||||
if stitch:
|
||||
|
||||
Reference in New Issue
Block a user