Esempio n. 1
0
  def GetStatusInformation(self):
    """Retrieves status information about the tasks.

    Returns:
      TasksStatus: tasks status information.
    """
    status = processing_status.TasksStatus()

    with self._lock:
      status.number_of_abandoned_tasks = len(self._tasks_abandoned)
      status.number_of_queued_tasks = len(self._tasks_queued)
      status.number_of_tasks_pending_merge = len(self._tasks_pending_merge)
      status.number_of_tasks_processing = len(self._tasks_processing)
      status.total_number_of_tasks = self._total_number_of_tasks

    return status
Esempio n. 2
0
  def testSample(self):
    """Tests the Sample function."""
    task_status = processing_status.TasksStatus()

    profiling_configuration = configurations.ProfilingConfiguration()

    with shared_test_lib.TempDirectory() as temp_directory:
      profiling_configuration.directory = temp_directory

      test_profiler = profilers.TaskQueueProfiler(
          'test', profiling_configuration)

      test_profiler.Start()

      for _ in range(5):
        test_profiler.Sample(task_status)
        time.sleep(0.01)

      test_profiler.Stop()
Esempio n. 3
0
    def testUpdateTasksStatus(self):
        """Tests the UpdateTasksStatus function."""
        task_status = processing_status.TasksStatus()

        status = processing_status.ProcessingStatus()
        status.UpdateTasksStatus(task_status)
Esempio n. 4
0
 def testInitialization(self):
     """Tests the __init__ function."""
     task_status = processing_status.TasksStatus()
     self.assertIsNotNone(task_status)