Ejemplo n.º 1
0
    def get(self, request, **kwargs):
        """
        Returns the result of the job with the supplied ID.

        If the job could not be found or the job has not completed yet, this
        will return a 404.

        Since different jobs are started from different async endpoints, there
        might be some post-job processing to do on the results and the
        intended response object.

        NOTE: Given no knowledge of the method for storing the job result,
        this method might also return a 404 if the job completed in the past
        but the result has been culled because the result expired or was
        replaced such as is the case in some in-memory storage systems. This
        method makes no assumption of that as the job management is handled
        by Avocado and this method should be independent of the async system
        used for creating and running jobs.
        """
        result = request.instance.result

        if result is None:
            raise Http404

        return process_results(request,
                               request.instance.meta['result_processor'],
                               result)
Ejemplo n.º 2
0
    def get(self, request, **kwargs):
        """
        Returns the result of the job with the supplied ID.

        If the job could not be found or the job has not completed yet, this
        will return a 404.

        Since different jobs are started from different async endpoints, there
        might be some post-job processing to do on the results and the
        intended response object.

        NOTE: Given no knowledge of the method for storing the job result,
        this method might also return a 404 if the job completed in the past
        but the result has been culled because the result expired or was
        replaced such as is the case in some in-memory storage systems. This
        method makes no assumption of that as the job management is handled
        by Avocado and this method should be independent of the async system
        used for creating and running jobs.
        """
        result = request.instance.result

        if result is None:
            raise Http404

        return process_results(
            request, request.instance.meta['result_processor'], result)
Ejemplo n.º 3
0
    def get(self, request, **kwargs):
        params = self.get_params(request)

        # Get the request's view and context
        view = self.get_view(request)
        context = self.get_context(request)

        # Configure the query options used for retrieving the results.
        query_options = {
            'export_type': HTMLExporter.short_name,
            'query_name': self._get_query_name(request),
        }
        query_options.update(**kwargs)
        query_options.update(params)

        try:
            row_data = utils.get_result_rows(context,
                                             view,
                                             query_options,
                                             request=request)
        except ValueError:
            raise Http404

        return process_results(request, PREVIEW_RESULT_PROCESSOR_NAME,
                               row_data)
Ejemplo n.º 4
0
    def get(self, request, **kwargs):
        params = self.get_params(request)

        # Configure the query options used for retrieving the results.
        query_options = {
            'export_type': JSONExporter.short_name.lower(),
            'query_name': self._get_query_name(request),
        }
        query_options.update(**kwargs)
        query_options.update(params)

        try:
            row_data = query_utils.get_result_rows(request.instance.context,
                                                   request.instance.view,
                                                   query_options,
                                                   request=request)
        except ValueError:
            raise Http404

        return process_results(request, QUERY_RESULT_PROCESSOR_NAME, row_data)
Ejemplo n.º 5
0
    def get(self, request, **kwargs):
        params = self.get_params(request)

        # Configure the query options used for retrieving the results.
        query_options = {
            'export_type': JSONExporter.short_name.lower(),
            'query_name': self._get_query_name(request),
        }
        query_options.update(**kwargs)
        query_options.update(params)

        try:
            row_data = query_utils.get_result_rows(
                request.instance.context,
                request.instance.view,
                query_options)
        except ValueError:
            raise Http404

        return process_results(
            request, QUERY_RESULT_PROCESSOR_NAME, row_data)
Ejemplo n.º 6
0
    def get(self, request, export_type, **kwargs):
        view = self.get_view(request)
        context = self.get_context(request)

        params = self.get_params(request)

        # Configure the query options used for retrieving the results.
        query_options = {
            'export_type': export_type,
            'query_name': self._get_query_name(request, export_type),
        }
        query_options.update(**kwargs)
        query_options.update(params)

        try:
            row_data = utils.get_result_rows(context, view, query_options)
        except ValueError:
            raise Http404

        return process_results(
            request, EXPORTER_RESULT_PROCESSOR_NAME, row_data)
Ejemplo n.º 7
0
    def get(self, request, **kwargs):
        params = self.get_params(request)

        # Get the request's view and context
        view = self.get_view(request)
        context = self.get_context(request)

        # Configure the query options used for retrieving the results.
        query_options = {
            'export_type': HTMLExporter.short_name,
            'query_name': self._get_query_name(request),
        }
        query_options.update(**kwargs)
        query_options.update(params)

        try:
            row_data = utils.get_result_rows(context, view, query_options,
                                             request=request)
        except ValueError:
            raise Http404

        return process_results(
            request, PREVIEW_RESULT_PROCESSOR_NAME, row_data)