spiderpig: Handle orphaned jobs

spiderpig-jobrunner is the parent process of all jobs that it runs.
If spiderpig-jobrunner is stopped/restarted while a job is running
(not recommended, but prone to happen in scap development
environments), the job becomes orphaned. An orphaned job continues to
run after losing its parent, but will likely fail with a broken pipe
error when it tries to write to stdout/stderr.

At startup spiderpig-jobrunner now scans its database for jobs that
were running but not finished (and not already marked as orphaned) and
sets their status to "orphaned". This information is used by the UI
to display orphaned jobs in a clear way.

spiderpig/api.py, etc:

Attach running and orphaned bool properties to returned job
records. Use this information in the UI code.

Edited by Ahmon Dancy

Merge request reports

Loading