Commit ea0a6023 authored by Petr Pudlak's avatar Petr Pudlak

Set process ID field when starting up a job

The ID of the current process is stored in the job file.
Signed-off-by: default avatarPetr Pudlak <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 76b4ac58
......@@ -36,6 +36,7 @@ import weakref
import threading
import itertools
import operator
import os
# pylint: disable=E0611
......@@ -560,6 +561,24 @@ class _QueuedJob(object):
return (False, "Job %s had no pending opcodes" %
def SetPid(self, pid):
"""Sets the job's process ID
@type pid: int
@param pid: the process ID
status = self.CalcStatus()
if status in (constants.JOB_STATUS_QUEUED,
if self.process_id is not None:
logging.warning("Replacing the process id %s of job %s with %s",
self.process_id,, pid)
self.process_id = pid
logging.warning("Can set pid only for queued/waiting jobs")
class _OpExecCallbacks(mcpu.OpExecCbBase):
def __init__(self, queue, job, op):
......@@ -1744,6 +1763,7 @@ class JobQueue(object):
status = job.CalcStatus()
if status == constants.JOB_STATUS_QUEUED:
self._EnqueueJobsUnlocked([job])"Restarting job %s",
......@@ -1754,6 +1774,7 @@ class JobQueue(object):
if status == constants.JOB_STATUS_WAITING:
job.MarkUnfinishedOps(constants.OP_STATUS_QUEUED, None)
self._EnqueueJobsUnlocked([job])"Restarting job %s",
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment