Revision 685ee993
b/daemons/ganeti-masterd | ||
---|---|---|
1 |
#!/usr/bin/python |
|
1 |
#!/usr/bin/python -u
|
|
2 | 2 |
# |
3 | 3 |
|
4 | 4 |
# Copyright (C) 2006, 2007 Google Inc. |
... | ... | |
264 | 264 |
if item is None: |
265 | 265 |
break |
266 | 266 |
print "worker %s processing job %s" % (worker_id, item.data.job_id) |
267 |
utils.Lock('cmd') |
|
267 |
#utils.Lock('cmd')
|
|
268 | 268 |
try: |
269 | 269 |
proc = mcpu.Processor(feedback=lambda x: None) |
270 | 270 |
try: |
... | ... | |
272 | 272 |
except errors.GenericError, err: |
273 | 273 |
print "ganeti exception %s" % err |
274 | 274 |
finally: |
275 |
utils.Unlock('cmd') |
|
276 |
utils.LockCleanup() |
|
275 |
#utils.Unlock('cmd') |
|
276 |
#utils.LockCleanup() |
|
277 |
pass |
|
277 | 278 |
print "worker %s finish job %s" % (worker_id, item.data.job_id) |
278 | 279 |
print "worker %s exiting" % worker_id |
279 | 280 |
|
b/lib/cli.py | ||
---|---|---|
26 | 26 |
import textwrap |
27 | 27 |
import os.path |
28 | 28 |
import copy |
29 |
import time |
|
29 | 30 |
from cStringIO import StringIO |
30 | 31 |
|
31 | 32 |
from ganeti import utils |
... | ... | |
381 | 382 |
interaction functions. |
382 | 383 |
|
383 | 384 |
""" |
385 |
cl = luxi.Client() |
|
386 |
job = opcodes.Job(op_list=[op]) |
|
387 |
jid = SubmitJob(job) |
|
388 |
|
|
389 |
query = { |
|
390 |
"object": "jobs", |
|
391 |
"fields": ["status"], |
|
392 |
"names": [jid], |
|
393 |
} |
|
394 |
|
|
395 |
while True: |
|
396 |
jdata = SubmitQuery(query) |
|
397 |
if not jdata: |
|
398 |
# job not found, go away! |
|
399 |
raise errors.JobLost("Job with id %s lost" % jid) |
|
400 |
|
|
401 |
status = jdata[0][0] |
|
402 |
if status in (opcodes.Job.STATUS_SUCCESS, opcodes.Job.STATUS_FAIL): |
|
403 |
break |
|
404 |
time.sleep(1) |
|
405 |
|
|
406 |
query["fields"].extend(["op_list", "op_status", "op_result"]) |
|
407 |
jdata = SubmitQuery(query) |
|
408 |
if not jdata: |
|
409 |
raise errors.JobLost("Job with id %s lost" % jid) |
|
410 |
status, op_list, op_status, op_result = jdata[0] |
|
411 |
if status != opcodes.Job.STATUS_SUCCESS: |
|
412 |
raise errors.OpExecError(op_result[0]) |
|
413 |
return op_result[0] |
|
414 |
|
|
384 | 415 |
if feedback_fn is None: |
385 | 416 |
feedback_fn = logger.ToStdout |
386 | 417 |
if proc is None: |
b/lib/cmdlib.py | ||
---|---|---|
1221 | 1221 |
break |
1222 | 1222 |
|
1223 | 1223 |
if unlock: |
1224 |
utils.Unlock('cmd') |
|
1224 |
#utils.Unlock('cmd') |
|
1225 |
pass |
|
1225 | 1226 |
try: |
1226 | 1227 |
time.sleep(min(60, max_time)) |
1227 | 1228 |
finally: |
1228 | 1229 |
if unlock: |
1229 |
utils.Lock('cmd') |
|
1230 |
#utils.Lock('cmd') |
|
1231 |
pass |
|
1230 | 1232 |
|
1231 | 1233 |
if done: |
1232 | 1234 |
proc.LogInfo("Instance %s's disks are in sync." % instance.name) |
b/lib/errors.py | ||
---|---|---|
152 | 152 |
""" |
153 | 153 |
|
154 | 154 |
|
155 |
class JobLost(GenericError): |
|
156 |
"""Submitted job lost. |
|
157 |
|
|
158 |
The job was submitted but it cannot be found in the current job |
|
159 |
list. |
|
160 |
|
|
161 |
""" |
|
162 |
|
|
163 |
|
|
155 | 164 |
class ResolverError(GenericError): |
156 | 165 |
"""Host name cannot be resolved. |
157 | 166 |
|
b/tools/burnin | ||
---|---|---|
90 | 90 |
def ExecOp(self, op): |
91 | 91 |
"""Execute an opcode and manage the exec buffer.""" |
92 | 92 |
self.ClearFeedbackBuf() |
93 |
return self.proc.ExecOpCode(op)
|
|
93 |
return cli.SubmitOpCode(op)
|
|
94 | 94 |
|
95 | 95 |
def ParseOptions(self): |
96 | 96 |
"""Parses the command line options. |
Also available in: Unified diff