MCPcopy
hub / github.com/FujiwaraChoki/MoneyPrinter / process_next_job

Function process_next_job

Backend/worker.py:35–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34
35def process_next_job() -> bool:
36 with SessionLocal() as session:
37 job = claim_next_queued_job(session)
38
39 if not job:
40 return False
41
42 job_id = job.id
43
44 clean_dir(str(TEMP_DIR))
45 clean_dir(str(SUBTITLES_DIR))
46
47 try:
48 result_path = run_generation_pipeline(
49 data=job.payload,
50 is_cancelled=lambda: _job_cancelled(job_id),
51 on_log=lambda message, level: _log_event(job_id, message, level),
52 )
53 with SessionLocal() as session:
54 mark_completed(session, job_id, result_path)
55 except PipelineCancelled as err:
56 with SessionLocal() as session:
57 mark_cancelled(session, job_id, str(err))
58 except Exception as err:
59 with SessionLocal() as session:
60 mark_failed(session, job_id, str(err))
61
62 return True
63
64
65def main() -> None:

Callers 1

mainFunction · 0.85

Calls 8

claim_next_queued_jobFunction · 0.90
clean_dirFunction · 0.90
run_generation_pipelineFunction · 0.90
mark_completedFunction · 0.90
mark_cancelledFunction · 0.90
mark_failedFunction · 0.90
_job_cancelledFunction · 0.85
_log_eventFunction · 0.85

Tested by

no test coverage detected