Revision 47099cd1
b/htools/Ganeti/Jobs.hs | ||
---|---|---|
35 | 35 |
|
36 | 36 |
-- | Our ADT for the OpCode status at runtime (while in a job). |
37 | 37 |
data OpStatus = OP_STATUS_QUEUED |
38 |
| OP_STATUS_WAITLOCK
|
|
38 |
| OP_STATUS_WAITING
|
|
39 | 39 |
| OP_STATUS_CANCELING |
40 | 40 |
| OP_STATUS_RUNNING |
41 | 41 |
| OP_STATUS_CANCELED |
... | ... | |
47 | 47 |
showJSON os = showJSON w |
48 | 48 |
where w = case os of |
49 | 49 |
OP_STATUS_QUEUED -> C.jobStatusQueued |
50 |
OP_STATUS_WAITLOCK -> C.jobStatusWaitlock
|
|
50 |
OP_STATUS_WAITING -> C.jobStatusWaiting
|
|
51 | 51 |
OP_STATUS_CANCELING -> C.jobStatusCanceling |
52 | 52 |
OP_STATUS_RUNNING -> C.jobStatusRunning |
53 | 53 |
OP_STATUS_CANCELED -> C.jobStatusCanceled |
... | ... | |
55 | 55 |
OP_STATUS_ERROR -> C.jobStatusError |
56 | 56 |
readJSON s = case readJSON s of |
57 | 57 |
J.Ok v | v == C.jobStatusQueued -> J.Ok OP_STATUS_QUEUED |
58 |
| v == C.jobStatusWaitlock -> J.Ok OP_STATUS_WAITLOCK
|
|
58 |
| v == C.jobStatusWaiting -> J.Ok OP_STATUS_WAITING
|
|
59 | 59 |
| v == C.jobStatusCanceling -> J.Ok OP_STATUS_CANCELING |
60 | 60 |
| v == C.jobStatusRunning -> J.Ok OP_STATUS_RUNNING |
61 | 61 |
| v == C.jobStatusCanceled -> J.Ok OP_STATUS_CANCELED |
... | ... | |
68 | 68 |
-- such that greater\/lesser comparison on values of this type makes |
69 | 69 |
-- sense. |
70 | 70 |
data JobStatus = JOB_STATUS_QUEUED |
71 |
| JOB_STATUS_WAITLOCK
|
|
71 |
| JOB_STATUS_WAITING
|
|
72 | 72 |
| JOB_STATUS_RUNNING |
73 | 73 |
| JOB_STATUS_SUCCESS |
74 | 74 |
| JOB_STATUS_CANCELING |
... | ... | |
80 | 80 |
showJSON js = showJSON w |
81 | 81 |
where w = case js of |
82 | 82 |
JOB_STATUS_QUEUED -> "queued" |
83 |
JOB_STATUS_WAITLOCK -> "waiting"
|
|
83 |
JOB_STATUS_WAITING -> "waiting"
|
|
84 | 84 |
JOB_STATUS_CANCELING -> "canceling" |
85 | 85 |
JOB_STATUS_RUNNING -> "running" |
86 | 86 |
JOB_STATUS_CANCELED -> "canceled" |
... | ... | |
88 | 88 |
JOB_STATUS_ERROR -> "error" |
89 | 89 |
readJSON s = case readJSON s of |
90 | 90 |
J.Ok "queued" -> J.Ok JOB_STATUS_QUEUED |
91 |
J.Ok "waiting" -> J.Ok JOB_STATUS_WAITLOCK
|
|
91 |
J.Ok "waiting" -> J.Ok JOB_STATUS_WAITING
|
|
92 | 92 |
J.Ok "canceling" -> J.Ok JOB_STATUS_CANCELING |
93 | 93 |
J.Ok "running" -> J.Ok JOB_STATUS_RUNNING |
94 | 94 |
J.Ok "success" -> J.Ok JOB_STATUS_SUCCESS |
b/lib/cli.py | ||
---|---|---|
1755 | 1755 |
ToStderr("Job %s is waiting in queue", job_id) |
1756 | 1756 |
self.notified_queued = True |
1757 | 1757 |
|
1758 |
elif status == constants.JOB_STATUS_WAITLOCK and not self.notified_waitlock:
|
|
1758 |
elif status == constants.JOB_STATUS_WAITING and not self.notified_waitlock:
|
|
1759 | 1759 |
ToStderr("Job %s is trying to acquire all necessary locks", job_id) |
1760 | 1760 |
self.notified_waitlock = True |
1761 | 1761 |
|
... | ... | |
3071 | 3071 |
for job_data, status in zip(self.jobs, result): |
3072 | 3072 |
if (isinstance(status, list) and status and |
3073 | 3073 |
status[0] in (constants.JOB_STATUS_QUEUED, |
3074 |
constants.JOB_STATUS_WAITLOCK,
|
|
3074 |
constants.JOB_STATUS_WAITING,
|
|
3075 | 3075 |
constants.JOB_STATUS_CANCELING)): |
3076 | 3076 |
# job is still present and waiting |
3077 | 3077 |
continue |
b/lib/client/gnt_debug.py | ||
---|---|---|
397 | 397 |
logging.debug("Status of job %s is %s", job_id, status) |
398 | 398 |
|
399 | 399 |
if test == constants.JQT_EXPANDNAMES: |
400 |
if status != constants.JOB_STATUS_WAITLOCK:
|
|
400 |
if status != constants.JOB_STATUS_WAITING:
|
|
401 | 401 |
raise errors.OpExecError("Job status while expanding names is '%s'," |
402 | 402 |
" not '%s' as expected" % |
403 |
(status, constants.JOB_STATUS_WAITLOCK))
|
|
403 |
(status, constants.JOB_STATUS_WAITING))
|
|
404 | 404 |
elif test in (constants.JQT_EXEC, constants.JQT_LOGMSG): |
405 | 405 |
if status != constants.JOB_STATUS_RUNNING: |
406 | 406 |
raise errors.OpExecError("Job status while executing opcode is '%s'," |
b/lib/client/gnt_job.py | ||
---|---|---|
40 | 40 |
#: names |
41 | 41 |
_USER_JOB_STATUS = { |
42 | 42 |
constants.JOB_STATUS_QUEUED: "queued", |
43 |
constants.JOB_STATUS_WAITLOCK: "waiting",
|
|
43 |
constants.JOB_STATUS_WAITING: "waiting",
|
|
44 | 44 |
constants.JOB_STATUS_CANCELING: "canceling", |
45 | 45 |
constants.JOB_STATUS_RUNNING: "running", |
46 | 46 |
constants.JOB_STATUS_CANCELED: "canceled", |
b/lib/constants.py | ||
---|---|---|
995 | 995 |
|
996 | 996 |
# Job status |
997 | 997 |
JOB_STATUS_QUEUED = "queued" |
998 |
JOB_STATUS_WAITLOCK = "waiting"
|
|
998 |
JOB_STATUS_WAITING = "waiting"
|
|
999 | 999 |
JOB_STATUS_CANCELING = "canceling" |
1000 | 1000 |
JOB_STATUS_RUNNING = "running" |
1001 | 1001 |
JOB_STATUS_CANCELED = "canceled" |
... | ... | |
1008 | 1008 |
]) |
1009 | 1009 |
JOB_STATUS_ALL = frozenset([ |
1010 | 1010 |
JOB_STATUS_QUEUED, |
1011 |
JOB_STATUS_WAITLOCK,
|
|
1011 |
JOB_STATUS_WAITING,
|
|
1012 | 1012 |
JOB_STATUS_CANCELING, |
1013 | 1013 |
JOB_STATUS_RUNNING, |
1014 | 1014 |
]) | JOBS_FINALIZED |
... | ... | |
1016 | 1016 |
# OpCode status |
1017 | 1017 |
# not yet finalized |
1018 | 1018 |
OP_STATUS_QUEUED = "queued" |
1019 |
OP_STATUS_WAITLOCK = "waiting"
|
|
1019 |
OP_STATUS_WAITING = "waiting"
|
|
1020 | 1020 |
OP_STATUS_CANCELING = "canceling" |
1021 | 1021 |
OP_STATUS_RUNNING = "running" |
1022 | 1022 |
# finalized |
b/lib/jqueue.py | ||
---|---|---|
312 | 312 |
|
313 | 313 |
if op.status == constants.OP_STATUS_QUEUED: |
314 | 314 |
pass |
315 |
elif op.status == constants.OP_STATUS_WAITLOCK:
|
|
316 |
status = constants.JOB_STATUS_WAITLOCK
|
|
315 |
elif op.status == constants.OP_STATUS_WAITING:
|
|
316 |
status = constants.JOB_STATUS_WAITING
|
|
317 | 317 |
elif op.status == constants.OP_STATUS_RUNNING: |
318 | 318 |
status = constants.JOB_STATUS_RUNNING |
319 | 319 |
elif op.status == constants.OP_STATUS_CANCELING: |
... | ... | |
461 | 461 |
self.Finalize() |
462 | 462 |
return (True, "Job %s canceled" % self.id) |
463 | 463 |
|
464 |
elif status == constants.JOB_STATUS_WAITLOCK:
|
|
464 |
elif status == constants.JOB_STATUS_WAITING:
|
|
465 | 465 |
# The worker will notice the new status and cancel the job |
466 | 466 |
self.MarkUnfinishedOps(constants.OP_STATUS_CANCELING, None) |
467 | 467 |
return (True, "Job %s will be canceled" % self.id) |
... | ... | |
507 | 507 |
This is called from the mcpu code as a notifier function, when the LU is |
508 | 508 |
finally about to start the Exec() method. Of course, to have end-user |
509 | 509 |
visible results, the opcode must be initially (before calling into |
510 |
Processor.ExecOpCode) set to OP_STATUS_WAITLOCK.
|
|
510 |
Processor.ExecOpCode) set to OP_STATUS_WAITING.
|
|
511 | 511 |
|
512 | 512 |
""" |
513 | 513 |
assert self._op in self._job.ops |
514 |
assert self._op.status in (constants.OP_STATUS_WAITLOCK,
|
|
514 |
assert self._op.status in (constants.OP_STATUS_WAITING,
|
|
515 | 515 |
constants.OP_STATUS_CANCELING) |
516 | 516 |
|
517 | 517 |
# Cancel here if we were asked to |
... | ... | |
555 | 555 |
"""Check whether job has been cancelled. |
556 | 556 |
|
557 | 557 |
""" |
558 |
assert self._op.status in (constants.OP_STATUS_WAITLOCK,
|
|
558 |
assert self._op.status in (constants.OP_STATUS_WAITING,
|
|
559 | 559 |
constants.OP_STATUS_CANCELING) |
560 | 560 |
|
561 | 561 |
# Cancel here if we were asked to |
... | ... | |
616 | 616 |
# no changes. |
617 | 617 |
if (status not in (constants.JOB_STATUS_QUEUED, |
618 | 618 |
constants.JOB_STATUS_RUNNING, |
619 |
constants.JOB_STATUS_WAITLOCK) or
|
|
619 |
constants.JOB_STATUS_WAITING) or
|
|
620 | 620 |
job_info != self._prev_job_info or |
621 | 621 |
(log_entries and self._prev_log_serial != log_entries[0][0])): |
622 | 622 |
logging.debug("Job %s changed", job.id) |
... | ... | |
931 | 931 |
""" |
932 | 932 |
assert op in job.ops |
933 | 933 |
assert op.status in (constants.OP_STATUS_QUEUED, |
934 |
constants.OP_STATUS_WAITLOCK)
|
|
934 |
constants.OP_STATUS_WAITING)
|
|
935 | 935 |
|
936 | 936 |
update = False |
937 | 937 |
|
938 | 938 |
op.result = None |
939 | 939 |
|
940 | 940 |
if op.status == constants.OP_STATUS_QUEUED: |
941 |
op.status = constants.OP_STATUS_WAITLOCK
|
|
941 |
op.status = constants.OP_STATUS_WAITING
|
|
942 | 942 |
update = True |
943 | 943 |
|
944 | 944 |
if op.start_timestamp is None: |
... | ... | |
949 | 949 |
job.start_timestamp = op.start_timestamp |
950 | 950 |
update = True |
951 | 951 |
|
952 |
assert op.status == constants.OP_STATUS_WAITLOCK
|
|
952 |
assert op.status == constants.OP_STATUS_WAITING
|
|
953 | 953 |
|
954 | 954 |
return update |
955 | 955 |
|
... | ... | |
1015 | 1015 |
""" |
1016 | 1016 |
op = opctx.op |
1017 | 1017 |
|
1018 |
assert op.status == constants.OP_STATUS_WAITLOCK
|
|
1018 |
assert op.status == constants.OP_STATUS_WAITING
|
|
1019 | 1019 |
|
1020 | 1020 |
timeout = opctx.GetNextLockTimeout() |
1021 | 1021 |
|
... | ... | |
1028 | 1028 |
assert timeout is not None, "Received timeout for blocking acquire" |
1029 | 1029 |
logging.debug("Couldn't acquire locks in %0.6fs", timeout) |
1030 | 1030 |
|
1031 |
assert op.status in (constants.OP_STATUS_WAITLOCK,
|
|
1031 |
assert op.status in (constants.OP_STATUS_WAITING,
|
|
1032 | 1032 |
constants.OP_STATUS_CANCELING) |
1033 | 1033 |
|
1034 | 1034 |
# Was job cancelled while we were waiting for the lock? |
... | ... | |
1036 | 1036 |
return (constants.OP_STATUS_CANCELING, None) |
1037 | 1037 |
|
1038 | 1038 |
# Stay in waitlock while trying to re-acquire lock |
1039 |
return (constants.OP_STATUS_WAITLOCK, None)
|
|
1039 |
return (constants.OP_STATUS_WAITING, None)
|
|
1040 | 1040 |
except CancelJob: |
1041 | 1041 |
logging.exception("%s: Canceling job", opctx.log_prefix) |
1042 | 1042 |
assert op.status == constants.OP_STATUS_CANCELING |
... | ... | |
1091 | 1091 |
for i in job.ops[opctx.index + 1:]) |
1092 | 1092 |
|
1093 | 1093 |
assert op.status in (constants.OP_STATUS_QUEUED, |
1094 |
constants.OP_STATUS_WAITLOCK,
|
|
1094 |
constants.OP_STATUS_WAITING,
|
|
1095 | 1095 |
constants.OP_STATUS_CANCELING) |
1096 | 1096 |
|
1097 | 1097 |
assert (op.priority <= constants.OP_PRIO_LOWEST and |
... | ... | |
1101 | 1101 |
|
1102 | 1102 |
if op.status != constants.OP_STATUS_CANCELING: |
1103 | 1103 |
assert op.status in (constants.OP_STATUS_QUEUED, |
1104 |
constants.OP_STATUS_WAITLOCK)
|
|
1104 |
constants.OP_STATUS_WAITING)
|
|
1105 | 1105 |
|
1106 | 1106 |
# Prepare to start opcode |
1107 | 1107 |
if self._MarkWaitlock(job, op): |
1108 | 1108 |
# Write to disk |
1109 | 1109 |
queue.UpdateJobUnlocked(job) |
1110 | 1110 |
|
1111 |
assert op.status == constants.OP_STATUS_WAITLOCK
|
|
1112 |
assert job.CalcStatus() == constants.JOB_STATUS_WAITLOCK
|
|
1111 |
assert op.status == constants.OP_STATUS_WAITING
|
|
1112 |
assert job.CalcStatus() == constants.JOB_STATUS_WAITING
|
|
1113 | 1113 |
assert job.start_timestamp and op.start_timestamp |
1114 | 1114 |
assert waitjob is None |
1115 | 1115 |
|
1116 | 1116 |
# Check if waiting for a job is necessary |
1117 | 1117 |
waitjob = self._CheckDependencies(queue, job, opctx) |
1118 | 1118 |
|
1119 |
assert op.status in (constants.OP_STATUS_WAITLOCK,
|
|
1119 |
assert op.status in (constants.OP_STATUS_WAITING,
|
|
1120 | 1120 |
constants.OP_STATUS_CANCELING, |
1121 | 1121 |
constants.OP_STATUS_ERROR) |
1122 | 1122 |
|
... | ... | |
1138 | 1138 |
|
1139 | 1139 |
assert not waitjob |
1140 | 1140 |
|
1141 |
if op.status == constants.OP_STATUS_WAITLOCK:
|
|
1141 |
if op.status == constants.OP_STATUS_WAITING:
|
|
1142 | 1142 |
# Couldn't get locks in time |
1143 | 1143 |
assert not op.end_timestamp |
1144 | 1144 |
else: |
... | ... | |
1151 | 1151 |
else: |
1152 | 1152 |
assert op.status in constants.OPS_FINALIZED |
1153 | 1153 |
|
1154 |
if op.status == constants.OP_STATUS_WAITLOCK or waitjob:
|
|
1154 |
if op.status == constants.OP_STATUS_WAITING or waitjob:
|
|
1155 | 1155 |
finalize = False |
1156 | 1156 |
|
1157 | 1157 |
if not waitjob and opctx.CheckPriorityIncrease(): |
... | ... | |
1165 | 1165 |
op.priority >= constants.OP_PRIO_HIGHEST) |
1166 | 1166 |
|
1167 | 1167 |
# In no case must the status be finalized here |
1168 |
assert job.CalcStatus() == constants.JOB_STATUS_WAITLOCK
|
|
1168 |
assert job.CalcStatus() == constants.JOB_STATUS_WAITING
|
|
1169 | 1169 |
|
1170 | 1170 |
else: |
1171 | 1171 |
# Ensure all opcodes so far have been successful |
... | ... | |
1572 | 1572 |
restartjobs.append(job) |
1573 | 1573 |
|
1574 | 1574 |
elif status in (constants.JOB_STATUS_RUNNING, |
1575 |
constants.JOB_STATUS_WAITLOCK,
|
|
1575 |
constants.JOB_STATUS_WAITING,
|
|
1576 | 1576 |
constants.JOB_STATUS_CANCELING): |
1577 | 1577 |
logging.warning("Unfinished job %s found: %s", job.id, job) |
1578 | 1578 |
|
1579 |
if status == constants.JOB_STATUS_WAITLOCK:
|
|
1579 |
if status == constants.JOB_STATUS_WAITING:
|
|
1580 | 1580 |
# Restart job |
1581 | 1581 |
job.MarkUnfinishedOps(constants.OP_STATUS_QUEUED, None) |
1582 | 1582 |
restartjobs.append(job) |
b/lib/rapi/client.py | ||
---|---|---|
70 | 70 |
NODE_ROLE_REGULAR = "regular" |
71 | 71 |
|
72 | 72 |
JOB_STATUS_QUEUED = "queued" |
73 |
JOB_STATUS_WAITLOCK = "waiting"
|
|
73 |
JOB_STATUS_WAITING = "waiting"
|
|
74 | 74 |
JOB_STATUS_CANCELING = "canceling" |
75 | 75 |
JOB_STATUS_RUNNING = "running" |
76 | 76 |
JOB_STATUS_CANCELED = "canceled" |
... | ... | |
83 | 83 |
]) |
84 | 84 |
JOB_STATUS_ALL = frozenset([ |
85 | 85 |
JOB_STATUS_QUEUED, |
86 |
JOB_STATUS_WAITLOCK,
|
|
86 |
JOB_STATUS_WAITING,
|
|
87 | 87 |
JOB_STATUS_CANCELING, |
88 | 88 |
JOB_STATUS_RUNNING, |
89 | 89 |
]) | JOB_STATUS_FINALIZED |
90 | 90 |
|
91 |
# Legacy name |
|
92 |
JOB_STATUS_WAITLOCK = JOB_STATUS_WAITING |
|
93 |
|
|
91 | 94 |
# Internal constants |
92 | 95 |
_REQ_DATA_VERSION_FIELD = "__version__" |
93 | 96 |
_INST_CREATE_REQV1 = "instance-create-reqv1" |
b/test/ganeti.jqueue_unittest.py | ||
---|---|---|
201 | 201 |
shutil.rmtree(self.tmpdir) |
202 | 202 |
|
203 | 203 |
def _LoadWaitingJob(self): |
204 |
return _FakeJob(2614226563, constants.JOB_STATUS_WAITLOCK)
|
|
204 |
return _FakeJob(2614226563, constants.JOB_STATUS_WAITING)
|
|
205 | 205 |
|
206 | 206 |
def _LoadLostJob(self): |
207 | 207 |
return None |
... | ... | |
211 | 211 |
|
212 | 212 |
# No change |
213 | 213 |
self.assertEqual(wfjc(self.filename, self._LoadWaitingJob, ["status"], |
214 |
[constants.JOB_STATUS_WAITLOCK], None, 0.1),
|
|
214 |
[constants.JOB_STATUS_WAITING], None, 0.1),
|
|
215 | 215 |
constants.JOB_NOTCHANGED) |
216 | 216 |
|
217 | 217 |
# No previous information |
218 | 218 |
self.assertEqual(wfjc(self.filename, self._LoadWaitingJob, |
219 | 219 |
["status"], None, None, 1.0), |
220 |
([constants.JOB_STATUS_WAITLOCK], []))
|
|
220 |
([constants.JOB_STATUS_WAITING], []))
|
|
221 | 221 |
|
222 | 222 |
def testLostJob(self): |
223 | 223 |
wfjc = jqueue._WaitForJobChangesHelper() |
... | ... | |
364 | 364 |
for op in ops)) |
365 | 365 |
|
366 | 366 |
def _Waitlock1(ops): |
367 |
ops[0].status = constants.OP_STATUS_WAITLOCK
|
|
367 |
ops[0].status = constants.OP_STATUS_WAITING
|
|
368 | 368 |
|
369 | 369 |
def _Waitlock2(ops): |
370 | 370 |
ops[0].status = constants.OP_STATUS_SUCCESS |
371 | 371 |
ops[1].status = constants.OP_STATUS_SUCCESS |
372 |
ops[2].status = constants.OP_STATUS_WAITLOCK
|
|
372 |
ops[2].status = constants.OP_STATUS_WAITING
|
|
373 | 373 |
|
374 | 374 |
def _Running(ops): |
375 | 375 |
ops[0].status = constants.OP_STATUS_SUCCESS |
... | ... | |
408 | 408 |
|
409 | 409 |
tests = { |
410 | 410 |
constants.JOB_STATUS_QUEUED: [_Queued], |
411 |
constants.JOB_STATUS_WAITLOCK: [_Waitlock1, _Waitlock2],
|
|
411 |
constants.JOB_STATUS_WAITING: [_Waitlock1, _Waitlock2],
|
|
412 | 412 |
constants.JOB_STATUS_RUNNING: [_Running], |
413 | 413 |
constants.JOB_STATUS_CANCELING: [_Canceling1, _Canceling2], |
414 | 414 |
constants.JOB_STATUS_CANCELED: [_Canceled], |
... | ... | |
602 | 602 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
603 | 603 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
604 | 604 |
self.assertFalse(queue.IsAcquired()) |
605 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
605 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
606 | 606 |
self.assertFalse(job.cur_opctx) |
607 | 607 |
|
608 | 608 |
def _AfterStart(op, cbs): |
... | ... | |
789 | 789 |
|
790 | 790 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_QUEUED) |
791 | 791 |
|
792 |
job.ops[0].status = constants.OP_STATUS_WAITLOCK
|
|
792 |
job.ops[0].status = constants.OP_STATUS_WAITING
|
|
793 | 793 |
|
794 | 794 |
assert len(job.ops) == 5 |
795 | 795 |
|
796 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
796 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
797 | 797 |
|
798 | 798 |
# Mark as cancelling |
799 | 799 |
(success, _) = job.Cancel() |
... | ... | |
835 | 835 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
836 | 836 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
837 | 837 |
self.assertFalse(queue.IsAcquired()) |
838 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
838 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
839 | 839 |
|
840 | 840 |
# Mark as cancelled |
841 | 841 |
(success, _) = job.Cancel() |
... | ... | |
884 | 884 |
|
885 | 885 |
def _BeforeStart(timeout, priority): |
886 | 886 |
self.assertFalse(queue.IsAcquired()) |
887 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
887 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
888 | 888 |
|
889 | 889 |
# Mark as cancelled |
890 | 890 |
(success, _) = job.Cancel() |
... | ... | |
1089 | 1089 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
1090 | 1090 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
1091 | 1091 |
self.assertFalse(queue.IsAcquired()) |
1092 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1092 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1093 | 1093 |
|
1094 | 1094 |
def _AfterStart(op, cbs): |
1095 | 1095 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
... | ... | |
1204 | 1204 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
1205 | 1205 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
1206 | 1206 |
self.assertFalse(queue.IsAcquired()) |
1207 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1207 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1208 | 1208 |
self.assertFalse(job.cur_opctx) |
1209 | 1209 |
|
1210 | 1210 |
def _AfterStart(op, cbs): |
... | ... | |
1286 | 1286 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
1287 | 1287 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
1288 | 1288 |
self.assertFalse(queue.IsAcquired()) |
1289 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1289 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1290 | 1290 |
self.assertFalse(job.cur_opctx) |
1291 | 1291 |
|
1292 | 1292 |
def _AfterStart(op, cbs): |
... | ... | |
1345 | 1345 |
# Simulate waiting for other job |
1346 | 1346 |
self.assertEqual(result, jqueue._JobProcessor.WAITDEP) |
1347 | 1347 |
self.assertTrue(job.cur_opctx) |
1348 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1348 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1349 | 1349 |
self.assertRaises(IndexError, depmgr.GetNextNotification) |
1350 | 1350 |
self.assert_(job.start_timestamp) |
1351 | 1351 |
self.assertFalse(job.end_timestamp) |
... | ... | |
1410 | 1410 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
1411 | 1411 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
1412 | 1412 |
self.assertFalse(queue.IsAcquired()) |
1413 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1413 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1414 | 1414 |
self.assertFalse(job.cur_opctx) |
1415 | 1415 |
|
1416 | 1416 |
def _AfterStart(op, cbs): |
... | ... | |
1463 | 1463 |
# Simulate waiting for other job |
1464 | 1464 |
self.assertEqual(result, jqueue._JobProcessor.WAITDEP) |
1465 | 1465 |
self.assertTrue(job.cur_opctx) |
1466 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1466 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1467 | 1467 |
self.assertRaises(IndexError, depmgr.GetNextNotification) |
1468 | 1468 |
self.assert_(job.start_timestamp) |
1469 | 1469 |
self.assertFalse(job.end_timestamp) |
... | ... | |
1527 | 1527 |
self.assertEqual(queue.GetNextUpdate(), (job, True)) |
1528 | 1528 |
self.assertRaises(IndexError, queue.GetNextUpdate) |
1529 | 1529 |
self.assertFalse(queue.IsAcquired()) |
1530 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1530 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1531 | 1531 |
self.assertFalse(job.cur_opctx) |
1532 | 1532 |
|
1533 | 1533 |
def _AfterStart(op, cbs): |
... | ... | |
1580 | 1580 |
# Simulate waiting for other job |
1581 | 1581 |
self.assertEqual(result, jqueue._JobProcessor.WAITDEP) |
1582 | 1582 |
self.assertTrue(job.cur_opctx) |
1583 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1583 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1584 | 1584 |
self.assertRaises(IndexError, depmgr.GetNextNotification) |
1585 | 1585 |
self.assert_(job.start_timestamp) |
1586 | 1586 |
self.assertFalse(job.end_timestamp) |
... | ... | |
1663 | 1663 |
self.assertRaises(IndexError, self.queue.GetNextUpdate) |
1664 | 1664 |
|
1665 | 1665 |
self.assertFalse(self.queue.IsAcquired()) |
1666 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1666 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1667 | 1667 |
|
1668 | 1668 |
ts = self.timeout_strategy |
1669 | 1669 |
|
... | ... | |
1823 | 1823 |
self.assertEqual(job.cur_opctx._timeout_strategy._fn, |
1824 | 1824 |
self.timeout_strategy.NextAttempt) |
1825 | 1825 |
self.assertFalse(job.ops[self.curop].exec_timestamp) |
1826 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
|
|
1826 |
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITING)
|
|
1827 | 1827 |
|
1828 | 1828 |
# If priority has changed since acquiring locks, the job must've been |
1829 | 1829 |
# updated |
... | ... | |
1900 | 1900 |
job_id = str(9610) |
1901 | 1901 |
dep_status = [constants.JOB_STATUS_CANCELED] |
1902 | 1902 |
|
1903 |
self._status.append((job_id, constants.JOB_STATUS_WAITLOCK))
|
|
1903 |
self._status.append((job_id, constants.JOB_STATUS_WAITING))
|
|
1904 | 1904 |
(result, _) = self.jdm.CheckAndRegister(job, job_id, dep_status) |
1905 | 1905 |
self.assertEqual(result, self.jdm.WAIT) |
1906 | 1906 |
self.assertFalse(self._status) |
... | ... | |
1922 | 1922 |
job_id = str(25519) |
1923 | 1923 |
dep_status = [constants.JOB_STATUS_ERROR] |
1924 | 1924 |
|
1925 |
self._status.append((job_id, constants.JOB_STATUS_WAITLOCK))
|
|
1925 |
self._status.append((job_id, constants.JOB_STATUS_WAITING))
|
|
1926 | 1926 |
(result, _) = self.jdm.CheckAndRegister(job, job_id, dep_status) |
1927 | 1927 |
self.assertEqual(result, self.jdm.WAIT) |
1928 | 1928 |
self.assertFalse(self._status) |
... | ... | |
1946 | 1946 |
job = self._FakeJob(21343) |
1947 | 1947 |
job_id = str(14609) |
1948 | 1948 |
|
1949 |
self._status.append((job_id, constants.JOB_STATUS_WAITLOCK))
|
|
1949 |
self._status.append((job_id, constants.JOB_STATUS_WAITING))
|
|
1950 | 1950 |
(result, _) = self.jdm.CheckAndRegister(job, job_id, dep_status) |
1951 | 1951 |
self.assertEqual(result, self.jdm.WAIT) |
1952 | 1952 |
self.assertFalse(self._status) |
b/test/ganeti.rapi.client_unittest.py | ||
---|---|---|
155 | 155 |
self.assertEqual(client._NODE_EVAC_RES1, rlib2._NODE_EVAC_RES1) |
156 | 156 |
self.assertEqual(client._INST_NIC_PARAMS, constants.INIC_PARAMS) |
157 | 157 |
self.assertEqual(client.JOB_STATUS_QUEUED, constants.JOB_STATUS_QUEUED) |
158 |
self.assertEqual(client.JOB_STATUS_WAITLOCK, constants.JOB_STATUS_WAITLOCK)
|
|
158 |
self.assertEqual(client.JOB_STATUS_WAITING, constants.JOB_STATUS_WAITING)
|
|
159 | 159 |
self.assertEqual(client.JOB_STATUS_CANCELING, |
160 | 160 |
constants.JOB_STATUS_CANCELING) |
161 | 161 |
self.assertEqual(client.JOB_STATUS_RUNNING, constants.JOB_STATUS_RUNNING) |
... | ... | |
165 | 165 |
self.assertEqual(client.JOB_STATUS_FINALIZED, constants.JOBS_FINALIZED) |
166 | 166 |
self.assertEqual(client.JOB_STATUS_ALL, constants.JOB_STATUS_ALL) |
167 | 167 |
|
168 |
# Legacy name |
|
169 |
self.assertEqual(client.JOB_STATUS_WAITLOCK, constants.JOB_STATUS_WAITING) |
|
170 |
|
|
168 | 171 |
|
169 | 172 |
class RapiMockTest(unittest.TestCase): |
170 | 173 |
def test(self): |
... | ... | |
1237 | 1240 |
|
1238 | 1241 |
def testWaitForJobCompletionNoChange(self): |
1239 | 1242 |
resp = serializer.DumpJson({ |
1240 |
"status": constants.JOB_STATUS_WAITLOCK,
|
|
1243 |
"status": constants.JOB_STATUS_WAITING,
|
|
1241 | 1244 |
}) |
1242 | 1245 |
|
1243 | 1246 |
for retries in [1, 5, 25]: |
Also available in: Unified diff