コード例 #1
0
    def query_tasks(self, app_id, http_data):
        """

    Args:
      app_id: The application ID.
      http_data: The payload containing the protocol buffer request.
    Returns:
      A tuple of a encoded response, error code, and error detail.
    """
        # TODO implement.
        request = taskqueue_service_pb.TaskQueueQueryTasksRequest(http_data)
        response = taskqueue_service_pb.TaskQueueQueryTasksResponse()
        return (response.Encode(), 0, "")
コード例 #2
0
    def _get_tasks(queue_name,
                   count,
                   start_task_name=None,
                   start_eta_usec=None):
        request = taskqueue_service_pb.TaskQueueQueryTasksRequest()
        request.set_queue_name(queue_name)
        request.set_max_rows(count)
        if start_task_name is not None:
            request.set_start_task_name(start_task_name)
        if start_eta_usec is not None:
            request.set_start_eta_usec(start_eta_usec)

        response = taskqueue_service_pb.TaskQueueQueryTasksResponse()
        apiproxy_stub_map.MakeSyncCall('taskqueue', 'QueryTasks', request,
                                       response)

        now = datetime.datetime.utcnow()
        for task in response.task_list():
            # Nothing is done with the body so save some memory and CPU by removing
            # it.
            task.set_body('')
            yield taskqueue_stub.QueryTasksResponseToDict(
                queue_name, task, now)