Revision 4c91d2ad lib/server/masterd.py

b/lib/server/masterd.py
66 66
EXIT_NODESETUP_ERROR = constants.EXIT_NODESETUP_ERROR
67 67

  
68 68

  
69
def _LogNewJob(status, info, ops):
70
  """Log information about a recently submitted job.
71

  
72
  """
73
  if status:
74
    logging.info("New job with id %s, summary: %s",
75
                 info, utils.CommaJoin(op.Summary() for op in ops))
76
  else:
77
    logging.info("Failed to submit job, reason: '%s', summary: %s",
78
                 info, utils.CommaJoin(op.Summary() for op in ops))
79

  
80

  
69 81
class ClientRequestWorker(workerpool.BaseWorker):
70 82
  # pylint: disable=W0221
71 83
  def RunTask(self, server, message, client):
......
267 279
    # TODO: Rewrite to not exit in each 'if/elif' branch
268 280

  
269 281
    if method == luxi.REQ_SUBMIT_JOB:
270
      logging.info("Received new job")
282
      logging.info("Receiving new job")
271 283
      (job_def, ) = args
272 284
      ops = [opcodes.OpCode.LoadOpCode(state) for state in job_def]
273
      return queue.SubmitJob(ops)
285
      job_id = queue.SubmitJob(ops)
286
      _LogNewJob(True, job_id, ops)
287
      return job_id
274 288

  
275 289
    elif method == luxi.REQ_SUBMIT_MANY_JOBS:
276
      logging.info("Received multiple jobs")
290
      logging.info("Receiving multiple jobs")
277 291
      (job_defs, ) = args
278 292
      jobs = []
279 293
      for ops in job_defs:
280 294
        jobs.append([opcodes.OpCode.LoadOpCode(state) for state in ops])
281
      return queue.SubmitManyJobs(jobs)
295
      job_ids = queue.SubmitManyJobs(jobs)
296
      for ((status, job_id), ops) in zip(job_ids, jobs):
297
        _LogNewJob(status, job_id, ops)
298
      return job_ids
282 299

  
283 300
    elif method == luxi.REQ_CANCEL_JOB:
284 301
      (job_id, ) = args

Also available in: Unified diff