def _Dynamic_PurgeQueue(self, request, response):
    """Local purge implementation of TaskQueueService.PurgeQueue.

    Args:
      request: A taskqueue_service_pb.TaskQueuePurgeQueueRequest.
      response: A taskqueue_service_pb.TaskQueuePurgeQueueResponse.
    """
    if not request.queue_name():
      raise apiproxy_errors.ApplicationError(
          taskqueue_service_pb.TaskQueueServiceError.INVALID_QUEUE_NAME)

    if request.has_app_id():
      queues = self._app_queues.get(request.app_id(), {})
      if request.queue_name() != DEFAULT_QUEUE_NAME:
        if request.queue_name() not in queues:
          raise apiproxy_errors.ApplicationError(
              taskqueue_service_pb.TaskQueueServiceError.UNKNOWN_QUEUE)
        elif queues[request.queue_name()] is None:
          raise apiproxy_errors.ApplicationError(
              taskqueue_service_pb.TaskQueueServiceError.TOMBSTONED_QUEUE)

      store = self.GetDummyTaskStore(request.app_id(), request.queue_name())
      for task in store.Lookup(store.Count()):
        store.Delete(task.task_name())
    elif (not self._IsValidQueue(request.queue_name(), None)
          and not request.queue_name() in self._taskqueues):


      raise apiproxy_errors.ApplicationError(
          taskqueue_service_pb.TaskQueueServiceError.UNKNOWN_QUEUE)

    self.FlushQueue(request.queue_name())
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/labs/taskqueue/taskqueue_stub.py/TaskQueueServiceStub._Dynamic_PurgeQueue/original