peal.web.jobs.Worker¶
- class peal.web.jobs.Worker[source]¶
Bases:
ThreadRuns queued jobs one at a time as python run_didae.py –config ….
A daemon thread that polls the store, launches the next queued job as a subprocess with stdout/stderr appended to
<job_dir>/log.txt, mirrors the[DiDAE] Step Nmarkers of that log into the job’sstage, honourscancel_requestedand finally runspeal.web.summarize.- Parameters:
store (
JobStore) – The store to poll and update.python (
str, optional) – Interpreter for the subprocess; defaults to$PEAL_WEB_PYTHONorsys.executable.poll_interval (
float) – Seconds between store polls and between log checks of a running job.env (
dict, optional) – Extra environment variables for the subprocess, applied afterPEAL_RUNS(default<root>/_peal_runs) andPYTHONUNBUFFERED.
- Variables:
current (
subprocess.PopenorNone) – The running job’s process, for cancellation from outside.
Methods
Run
python -m peal.web.analysis --accuracy-onlyand wait for it.The argv used to launch a job.
Thread body: run queued jobs until
stop()is called.Run
python -m peal.web.dfr --solver=<solver> <job_dir>and wait.Run one job to completion and record its outcome.
Launch
python -m peal.web.analysis <job_dir>in the background.Ask the polling loop to exit after the current job.
Attributes
- run()[source]¶
Thread body: run queued jobs until
stop()is called.Any exception escaping
run_job()marks that jobfailedwith the exception text and the loop continues.
- check_accuracy(job_dir, log_path, env=None, timeout_s=1800)[source]¶
Run
python -m peal.web.analysis --accuracy-onlyand wait for it.Writes
accuracy.json; failures are appended tolog_pathand do not stop the job.
- run_dfr(job_dir, solver, log_path, env=None, timeout_s=3600)[source]¶
Run
python -m peal.web.dfr --solver=<solver> <job_dir>and wait.Writes
dfr.jsonand the correctedrun/model.onnx; a failure is logged and leaves the uncorrected model in place.
- start_analysis(job_dir, env=None)[source]¶
Launch
python -m peal.web.analysis <job_dir>in the background.Writes
analysis.log; the page polls foranalysis.json. Does nothing when the analysis already ran or is running, or when the sweep has not written its results yet.- Parameters:
- Returns:
The started process.
- Return type:
- run_job(job_id)[source]¶
Run one job to completion and record its outcome.
Marks the job
running, launchescommand()from the project directory with the log appended tolog.txt, monitors it until it exits or is cancelled, then callspeal.web.summarize.summarizeon the job directory (failures are logged, not raised) and sets the final status:finishedon exit code 0,failedotherwise, or just thefinishedtimestamp when the job was cancelled.- Parameters:
job_id (
str) – Job id.