Revision 03e86e97 qa/qa_performance.py

b/qa/qa_performance.py
429 429
  job_driver.WaitForCompletion()
430 430

  
431 431

  
432
# TODO(thomasth): move to qa_job_utils.py once stable-2.10 is merged to master
433
class _QAThreadGroup(object):
434
  """This class manages a list of QAThreads.
435

  
436
  """
437
  def __init__(self):
438
    self._threads = []
439

  
440
  def Start(self, thread):
441
    """Starts the given thread and adds it to this group.
442

  
443
    @type thread: qa_job_utils.QAThread
444
    @param thread: the thread to start and to add to this group.
445

  
446
    """
447
    thread.start()
448
    self._threads.append(thread)
449

  
450
  def JoinAndReraise(self):
451
    """Joins all threads in this group and calls their C{reraise} method.
452

  
453
    """
454
    for thread in self._threads:
455
      thread.join()
456
      thread.reraise()
457

  
458

  
459 432
def TestParallelInstanceQueries(instances):
460 433
  """PERFORMANCE: Parallel instance queries.
461 434

  
......
463 436
  @param instances: list of instances to issue queries against
464 437

  
465 438
  """
466
  threads = _QAThreadGroup()
439
  threads = qa_job_utils.QAThreadGroup()
467 440
  for instance in instances:
468 441
    cmd = ["gnt-instance", "info", instance.name]
469 442
    info_thread = qa_job_utils.QAThread(qa_utils.AssertCommand, [cmd], {})
......
512 485

  
513 486
      job_driver.AddJob(job_id)
514 487

  
515
  threads = _QAThreadGroup()
488
  threads = qa_job_utils.QAThreadGroup()
516 489
  for i in range(10):
517 490
    thread = qa_job_utils.QAThread(_SubmitDelayJob, [20], {})
518 491
    threads.Start(thread)

Also available in: Unified diff