Commit 47099cd1 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Rename *_STATUS_WAITLOCK to …_WAITING



This patch renames the {JOB,OP}_STATUS_WAITLOCK constants to
{JOB,OP}_STATUS_WAITING, as per design document for chained jobs.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent f6eb380d
......@@ -35,7 +35,7 @@ import qualified Ganeti.Constants as C
-- | Our ADT for the OpCode status at runtime (while in a job).
data OpStatus = OP_STATUS_QUEUED
| OP_STATUS_WAITLOCK
| OP_STATUS_WAITING
| OP_STATUS_CANCELING
| OP_STATUS_RUNNING
| OP_STATUS_CANCELED
......@@ -47,7 +47,7 @@ instance JSON OpStatus where
showJSON os = showJSON w
where w = case os of
OP_STATUS_QUEUED -> C.jobStatusQueued
OP_STATUS_WAITLOCK -> C.jobStatusWaitlock
OP_STATUS_WAITING -> C.jobStatusWaiting
OP_STATUS_CANCELING -> C.jobStatusCanceling
OP_STATUS_RUNNING -> C.jobStatusRunning
OP_STATUS_CANCELED -> C.jobStatusCanceled
......@@ -55,7 +55,7 @@ instance JSON OpStatus where
OP_STATUS_ERROR -> C.jobStatusError
readJSON s = case readJSON s of
J.Ok v | v == C.jobStatusQueued -> J.Ok OP_STATUS_QUEUED
| v == C.jobStatusWaitlock -> J.Ok OP_STATUS_WAITLOCK
| v == C.jobStatusWaiting -> J.Ok OP_STATUS_WAITING
| v == C.jobStatusCanceling -> J.Ok OP_STATUS_CANCELING
| v == C.jobStatusRunning -> J.Ok OP_STATUS_RUNNING
| v == C.jobStatusCanceled -> J.Ok OP_STATUS_CANCELED
......@@ -68,7 +68,7 @@ instance JSON OpStatus where
-- such that greater\/lesser comparison on values of this type makes
-- sense.
data JobStatus = JOB_STATUS_QUEUED
| JOB_STATUS_WAITLOCK
| JOB_STATUS_WAITING
| JOB_STATUS_RUNNING
| JOB_STATUS_SUCCESS
| JOB_STATUS_CANCELING
......@@ -80,7 +80,7 @@ instance JSON JobStatus where
showJSON js = showJSON w
where w = case js of
JOB_STATUS_QUEUED -> "queued"
JOB_STATUS_WAITLOCK -> "waiting"
JOB_STATUS_WAITING -> "waiting"
JOB_STATUS_CANCELING -> "canceling"
JOB_STATUS_RUNNING -> "running"
JOB_STATUS_CANCELED -> "canceled"
......@@ -88,7 +88,7 @@ instance JSON JobStatus where
JOB_STATUS_ERROR -> "error"
readJSON s = case readJSON s of
J.Ok "queued" -> J.Ok JOB_STATUS_QUEUED
J.Ok "waiting" -> J.Ok JOB_STATUS_WAITLOCK
J.Ok "waiting" -> J.Ok JOB_STATUS_WAITING
J.Ok "canceling" -> J.Ok JOB_STATUS_CANCELING
J.Ok "running" -> J.Ok JOB_STATUS_RUNNING
J.Ok "success" -> J.Ok JOB_STATUS_SUCCESS
......
......@@ -1755,7 +1755,7 @@ class StdioJobPollReportCb(JobPollReportCbBase):
ToStderr("Job %s is waiting in queue", job_id)
self.notified_queued = True
elif status == constants.JOB_STATUS_WAITLOCK and not self.notified_waitlock:
elif status == constants.JOB_STATUS_WAITING and not self.notified_waitlock:
ToStderr("Job %s is trying to acquire all necessary locks", job_id)
self.notified_waitlock = True
......@@ -3071,7 +3071,7 @@ class JobExecutor(object):
for job_data, status in zip(self.jobs, result):
if (isinstance(status, list) and status and
status[0] in (constants.JOB_STATUS_QUEUED,
constants.JOB_STATUS_WAITLOCK,
constants.JOB_STATUS_WAITING,
constants.JOB_STATUS_CANCELING)):
# job is still present and waiting
continue
......
......@@ -397,10 +397,10 @@ class _JobQueueTestReporter(cli.StdioJobPollReportCb):
logging.debug("Status of job %s is %s", job_id, status)
if test == constants.JQT_EXPANDNAMES:
if status != constants.JOB_STATUS_WAITLOCK:
if status != constants.JOB_STATUS_WAITING:
raise errors.OpExecError("Job status while expanding names is '%s',"
" not '%s' as expected" %
(status, constants.JOB_STATUS_WAITLOCK))
(status, constants.JOB_STATUS_WAITING))
elif test in (constants.JQT_EXEC, constants.JQT_LOGMSG):
if status != constants.JOB_STATUS_RUNNING:
raise errors.OpExecError("Job status while executing opcode is '%s',"
......
......@@ -40,7 +40,7 @@ _LIST_DEF_FIELDS = ["id", "status", "summary"]
#: names
_USER_JOB_STATUS = {
constants.JOB_STATUS_QUEUED: "queued",
constants.JOB_STATUS_WAITLOCK: "waiting",
constants.JOB_STATUS_WAITING: "waiting",
constants.JOB_STATUS_CANCELING: "canceling",
constants.JOB_STATUS_RUNNING: "running",
constants.JOB_STATUS_CANCELED: "canceled",
......
......@@ -995,7 +995,7 @@ JOB_NOTCHANGED = "nochange"
# Job status
JOB_STATUS_QUEUED = "queued"
JOB_STATUS_WAITLOCK = "waiting"
JOB_STATUS_WAITING = "waiting"
JOB_STATUS_CANCELING = "canceling"
JOB_STATUS_RUNNING = "running"
JOB_STATUS_CANCELED = "canceled"
......@@ -1008,7 +1008,7 @@ JOBS_FINALIZED = frozenset([
])
JOB_STATUS_ALL = frozenset([
JOB_STATUS_QUEUED,
JOB_STATUS_WAITLOCK,
JOB_STATUS_WAITING,
JOB_STATUS_CANCELING,
JOB_STATUS_RUNNING,
]) | JOBS_FINALIZED
......@@ -1016,7 +1016,7 @@ JOB_STATUS_ALL = frozenset([
# OpCode status
# not yet finalized
OP_STATUS_QUEUED = "queued"
OP_STATUS_WAITLOCK = "waiting"
OP_STATUS_WAITING = "waiting"
OP_STATUS_CANCELING = "canceling"
OP_STATUS_RUNNING = "running"
# finalized
......
......@@ -312,8 +312,8 @@ class _QueuedJob(object):
if op.status == constants.OP_STATUS_QUEUED:
pass
elif op.status == constants.OP_STATUS_WAITLOCK:
status = constants.JOB_STATUS_WAITLOCK
elif op.status == constants.OP_STATUS_WAITING:
status = constants.JOB_STATUS_WAITING
elif op.status == constants.OP_STATUS_RUNNING:
status = constants.JOB_STATUS_RUNNING
elif op.status == constants.OP_STATUS_CANCELING:
......@@ -461,7 +461,7 @@ class _QueuedJob(object):
self.Finalize()
return (True, "Job %s canceled" % self.id)
elif status == constants.JOB_STATUS_WAITLOCK:
elif status == constants.JOB_STATUS_WAITING:
# The worker will notice the new status and cancel the job
self.MarkUnfinishedOps(constants.OP_STATUS_CANCELING, None)
return (True, "Job %s will be canceled" % self.id)
......@@ -507,11 +507,11 @@ class _OpExecCallbacks(mcpu.OpExecCbBase):
This is called from the mcpu code as a notifier function, when the LU is
finally about to start the Exec() method. Of course, to have end-user
visible results, the opcode must be initially (before calling into
Processor.ExecOpCode) set to OP_STATUS_WAITLOCK.
Processor.ExecOpCode) set to OP_STATUS_WAITING.
"""
assert self._op in self._job.ops
assert self._op.status in (constants.OP_STATUS_WAITLOCK,
assert self._op.status in (constants.OP_STATUS_WAITING,
constants.OP_STATUS_CANCELING)
# Cancel here if we were asked to
......@@ -555,7 +555,7 @@ class _OpExecCallbacks(mcpu.OpExecCbBase):
"""Check whether job has been cancelled.
"""
assert self._op.status in (constants.OP_STATUS_WAITLOCK,
assert self._op.status in (constants.OP_STATUS_WAITING,
constants.OP_STATUS_CANCELING)
# Cancel here if we were asked to
......@@ -616,7 +616,7 @@ class _JobChangesChecker(object):
# no changes.
if (status not in (constants.JOB_STATUS_QUEUED,
constants.JOB_STATUS_RUNNING,
constants.JOB_STATUS_WAITLOCK) or
constants.JOB_STATUS_WAITING) or
job_info != self._prev_job_info or
(log_entries and self._prev_log_serial != log_entries[0][0])):
logging.debug("Job %s changed", job.id)
......@@ -931,14 +931,14 @@ class _JobProcessor(object):
"""
assert op in job.ops
assert op.status in (constants.OP_STATUS_QUEUED,
constants.OP_STATUS_WAITLOCK)
constants.OP_STATUS_WAITING)
update = False
op.result = None
if op.status == constants.OP_STATUS_QUEUED:
op.status = constants.OP_STATUS_WAITLOCK
op.status = constants.OP_STATUS_WAITING
update = True
if op.start_timestamp is None:
......@@ -949,7 +949,7 @@ class _JobProcessor(object):
job.start_timestamp = op.start_timestamp
update = True
assert op.status == constants.OP_STATUS_WAITLOCK
assert op.status == constants.OP_STATUS_WAITING
return update
......@@ -1015,7 +1015,7 @@ class _JobProcessor(object):
"""
op = opctx.op
assert op.status == constants.OP_STATUS_WAITLOCK
assert op.status == constants.OP_STATUS_WAITING
timeout = opctx.GetNextLockTimeout()
......@@ -1028,7 +1028,7 @@ class _JobProcessor(object):
assert timeout is not None, "Received timeout for blocking acquire"
logging.debug("Couldn't acquire locks in %0.6fs", timeout)
assert op.status in (constants.OP_STATUS_WAITLOCK,
assert op.status in (constants.OP_STATUS_WAITING,
constants.OP_STATUS_CANCELING)
# Was job cancelled while we were waiting for the lock?
......@@ -1036,7 +1036,7 @@ class _JobProcessor(object):
return (constants.OP_STATUS_CANCELING, None)
# Stay in waitlock while trying to re-acquire lock
return (constants.OP_STATUS_WAITLOCK, None)
return (constants.OP_STATUS_WAITING, None)
except CancelJob:
logging.exception("%s: Canceling job", opctx.log_prefix)
assert op.status == constants.OP_STATUS_CANCELING
......@@ -1091,7 +1091,7 @@ class _JobProcessor(object):
for i in job.ops[opctx.index + 1:])
assert op.status in (constants.OP_STATUS_QUEUED,
constants.OP_STATUS_WAITLOCK,
constants.OP_STATUS_WAITING,
constants.OP_STATUS_CANCELING)
assert (op.priority <= constants.OP_PRIO_LOWEST and
......@@ -1101,22 +1101,22 @@ class _JobProcessor(object):
if op.status != constants.OP_STATUS_CANCELING:
assert op.status in (constants.OP_STATUS_QUEUED,
constants.OP_STATUS_WAITLOCK)
constants.OP_STATUS_WAITING)
# Prepare to start opcode
if self._MarkWaitlock(job, op):
# Write to disk
queue.UpdateJobUnlocked(job)
assert op.status == constants.OP_STATUS_WAITLOCK
assert job.CalcStatus() == constants.JOB_STATUS_WAITLOCK
assert op.status == constants.OP_STATUS_WAITING
assert job.CalcStatus() == constants.JOB_STATUS_WAITING
assert job.start_timestamp and op.start_timestamp
assert waitjob is None
# Check if waiting for a job is necessary
waitjob = self._CheckDependencies(queue, job, opctx)
assert op.status in (constants.OP_STATUS_WAITLOCK,
assert op.status in (constants.OP_STATUS_WAITING,
constants.OP_STATUS_CANCELING,
constants.OP_STATUS_ERROR)
......@@ -1138,7 +1138,7 @@ class _JobProcessor(object):
assert not waitjob
if op.status == constants.OP_STATUS_WAITLOCK:
if op.status == constants.OP_STATUS_WAITING:
# Couldn't get locks in time
assert not op.end_timestamp
else:
......@@ -1151,7 +1151,7 @@ class _JobProcessor(object):
else:
assert op.status in constants.OPS_FINALIZED
if op.status == constants.OP_STATUS_WAITLOCK or waitjob:
if op.status == constants.OP_STATUS_WAITING or waitjob:
finalize = False
if not waitjob and opctx.CheckPriorityIncrease():
......@@ -1165,7 +1165,7 @@ class _JobProcessor(object):
op.priority >= constants.OP_PRIO_HIGHEST)
# In no case must the status be finalized here
assert job.CalcStatus() == constants.JOB_STATUS_WAITLOCK
assert job.CalcStatus() == constants.JOB_STATUS_WAITING
else:
# Ensure all opcodes so far have been successful
......@@ -1572,11 +1572,11 @@ class JobQueue(object):
restartjobs.append(job)
elif status in (constants.JOB_STATUS_RUNNING,
constants.JOB_STATUS_WAITLOCK,
constants.JOB_STATUS_WAITING,
constants.JOB_STATUS_CANCELING):
logging.warning("Unfinished job %s found: %s", job.id, job)
if status == constants.JOB_STATUS_WAITLOCK:
if status == constants.JOB_STATUS_WAITING:
# Restart job
job.MarkUnfinishedOps(constants.OP_STATUS_QUEUED, None)
restartjobs.append(job)
......
......@@ -70,7 +70,7 @@ NODE_ROLE_OFFLINE = "offline"
NODE_ROLE_REGULAR = "regular"
JOB_STATUS_QUEUED = "queued"
JOB_STATUS_WAITLOCK = "waiting"
JOB_STATUS_WAITING = "waiting"
JOB_STATUS_CANCELING = "canceling"
JOB_STATUS_RUNNING = "running"
JOB_STATUS_CANCELED = "canceled"
......@@ -83,11 +83,14 @@ JOB_STATUS_FINALIZED = frozenset([
])
JOB_STATUS_ALL = frozenset([
JOB_STATUS_QUEUED,
JOB_STATUS_WAITLOCK,
JOB_STATUS_WAITING,
JOB_STATUS_CANCELING,
JOB_STATUS_RUNNING,
]) | JOB_STATUS_FINALIZED
# Legacy name
JOB_STATUS_WAITLOCK = JOB_STATUS_WAITING
# Internal constants
_REQ_DATA_VERSION_FIELD = "__version__"
_INST_CREATE_REQV1 = "instance-create-reqv1"
......
......@@ -201,7 +201,7 @@ class TestWaitForJobChangesHelper(unittest.TestCase):
shutil.rmtree(self.tmpdir)
def _LoadWaitingJob(self):
return _FakeJob(2614226563, constants.JOB_STATUS_WAITLOCK)
return _FakeJob(2614226563, constants.JOB_STATUS_WAITING)
def _LoadLostJob(self):
return None
......@@ -211,13 +211,13 @@ class TestWaitForJobChangesHelper(unittest.TestCase):
# No change
self.assertEqual(wfjc(self.filename, self._LoadWaitingJob, ["status"],
[constants.JOB_STATUS_WAITLOCK], None, 0.1),
[constants.JOB_STATUS_WAITING], None, 0.1),
constants.JOB_NOTCHANGED)
# No previous information
self.assertEqual(wfjc(self.filename, self._LoadWaitingJob,
["status"], None, None, 1.0),
([constants.JOB_STATUS_WAITLOCK], []))
([constants.JOB_STATUS_WAITING], []))
def testLostJob(self):
wfjc = jqueue._WaitForJobChangesHelper()
......@@ -364,12 +364,12 @@ class TestQueuedJob(unittest.TestCase):
for op in ops))
def _Waitlock1(ops):
ops[0].status = constants.OP_STATUS_WAITLOCK
ops[0].status = constants.OP_STATUS_WAITING
def _Waitlock2(ops):
ops[0].status = constants.OP_STATUS_SUCCESS
ops[1].status = constants.OP_STATUS_SUCCESS
ops[2].status = constants.OP_STATUS_WAITLOCK
ops[2].status = constants.OP_STATUS_WAITING
def _Running(ops):
ops[0].status = constants.OP_STATUS_SUCCESS
......@@ -408,7 +408,7 @@ class TestQueuedJob(unittest.TestCase):
tests = {
constants.JOB_STATUS_QUEUED: [_Queued],
constants.JOB_STATUS_WAITLOCK: [_Waitlock1, _Waitlock2],
constants.JOB_STATUS_WAITING: [_Waitlock1, _Waitlock2],
constants.JOB_STATUS_RUNNING: [_Running],
constants.JOB_STATUS_CANCELING: [_Canceling1, _Canceling2],
constants.JOB_STATUS_CANCELED: [_Canceled],
......@@ -602,7 +602,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertFalse(job.cur_opctx)
def _AfterStart(op, cbs):
......@@ -789,11 +789,11 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_QUEUED)
job.ops[0].status = constants.OP_STATUS_WAITLOCK
job.ops[0].status = constants.OP_STATUS_WAITING
assert len(job.ops) == 5
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
# Mark as cancelling
(success, _) = job.Cancel()
......@@ -835,7 +835,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
# Mark as cancelled
(success, _) = job.Cancel()
......@@ -884,7 +884,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
def _BeforeStart(timeout, priority):
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
# Mark as cancelled
(success, _) = job.Cancel()
......@@ -1089,7 +1089,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
def _AfterStart(op, cbs):
self.assertEqual(queue.GetNextUpdate(), (job, True))
......@@ -1204,7 +1204,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertFalse(job.cur_opctx)
def _AfterStart(op, cbs):
......@@ -1286,7 +1286,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertFalse(job.cur_opctx)
def _AfterStart(op, cbs):
......@@ -1345,7 +1345,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
# Simulate waiting for other job
self.assertEqual(result, jqueue._JobProcessor.WAITDEP)
self.assertTrue(job.cur_opctx)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertRaises(IndexError, depmgr.GetNextNotification)
self.assert_(job.start_timestamp)
self.assertFalse(job.end_timestamp)
......@@ -1410,7 +1410,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertFalse(job.cur_opctx)
def _AfterStart(op, cbs):
......@@ -1463,7 +1463,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
# Simulate waiting for other job
self.assertEqual(result, jqueue._JobProcessor.WAITDEP)
self.assertTrue(job.cur_opctx)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertRaises(IndexError, depmgr.GetNextNotification)
self.assert_(job.start_timestamp)
self.assertFalse(job.end_timestamp)
......@@ -1527,7 +1527,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(queue.GetNextUpdate(), (job, True))
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assertFalse(queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertFalse(job.cur_opctx)
def _AfterStart(op, cbs):
......@@ -1580,7 +1580,7 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
# Simulate waiting for other job
self.assertEqual(result, jqueue._JobProcessor.WAITDEP)
self.assertTrue(job.cur_opctx)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
self.assertRaises(IndexError, depmgr.GetNextNotification)
self.assert_(job.start_timestamp)
self.assertFalse(job.end_timestamp)
......@@ -1663,7 +1663,7 @@ class TestJobProcessorTimeouts(unittest.TestCase, _JobProcessorTestUtils):
self.assertRaises(IndexError, self.queue.GetNextUpdate)
self.assertFalse(self.queue.IsAcquired())
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
ts = self.timeout_strategy
......@@ -1823,7 +1823,7 @@ class TestJobProcessorTimeouts(unittest.TestCase, _JobProcessorTestUtils):
self.assertEqual(job.cur_opctx._timeout_strategy._fn,
self.timeout_strategy.NextAttempt)
self.assertFalse(job.ops[self.curop].exec_timestamp)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
# If priority has changed since acquiring locks, the job must've been
# updated
......@@ -1900,7 +1900,7 @@ class TestJobDependencyManager(unittest.TestCase):
job_id = str(9610)
dep_status = [constants.JOB_STATUS_CANCELED]
self._status.append((job_id, constants.JOB_STATUS_WAITLOCK))
self._status.append((job_id, constants.JOB_STATUS_WAITING))
(result, _) = self.jdm.CheckAndRegister(job, job_id, dep_status)
self.assertEqual(result, self.jdm.WAIT)
self.assertFalse(self._status)
......@@ -1922,7 +1922,7 @@ class TestJobDependencyManager(unittest.TestCase):
job_id = str(25519)
dep_status = [constants.JOB_STATUS_ERROR]
self._status.append((job_id, constants.JOB_STATUS_WAITLOCK))
self._status.append((job_id, constants.JOB_STATUS_WAITING))
(result, _) = self.jdm.CheckAndRegister(job, job_id, dep_status)
self.assertEqual(result, self.jdm.WAIT)
self.assertFalse(self._status)
......@@ -1946,7 +1946,7 @@ class TestJobDependencyManager(unittest.TestCase):
job = self._FakeJob(21343)
job_id = str(14609)
self._status.append((job_id, constants.JOB_STATUS_WAITLOCK))
self._status.append((job_id, constants.JOB_STATUS_WAITING))
(result, _) = self.jdm.CheckAndRegister(job, job_id, dep_status)
self.assertEqual(result, self.jdm.WAIT)
self.assertFalse(self._status)
......
......@@ -155,7 +155,7 @@ class TestConstants(unittest.TestCase):
self.assertEqual(client._NODE_EVAC_RES1, rlib2._NODE_EVAC_RES1)
self.assertEqual(client._INST_NIC_PARAMS, constants.INIC_PARAMS)
self.assertEqual(client.JOB_STATUS_QUEUED, constants.JOB_STATUS_QUEUED)
self.assertEqual(client.JOB_STATUS_WAITLOCK, constants.JOB_STATUS_WAITLOCK)
self.assertEqual(client.JOB_STATUS_WAITING, constants.JOB_STATUS_WAITING)
self.assertEqual(client.JOB_STATUS_CANCELING,
constants.JOB_STATUS_CANCELING)
self.assertEqual(client.JOB_STATUS_RUNNING, constants.JOB_STATUS_RUNNING)
......@@ -165,6 +165,9 @@ class TestConstants(unittest.TestCase):
self.assertEqual(client.JOB_STATUS_FINALIZED, constants.JOBS_FINALIZED)
self.assertEqual(client.JOB_STATUS_ALL, constants.JOB_STATUS_ALL)
# Legacy name
self.assertEqual(client.JOB_STATUS_WAITLOCK, constants.JOB_STATUS_WAITING)
class RapiMockTest(unittest.TestCase):
def test(self):
......@@ -1237,7 +1240,7 @@ class GanetiRapiClientTests(testutils.GanetiTestCase):
def testWaitForJobCompletionNoChange(self):
resp = serializer.DumpJson({
"status": constants.JOB_STATUS_WAITLOCK,
"status": constants.JOB_STATUS_WAITING,
})
for retries in [1, 5, 25]:
......
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