Exemplo n.º 1
0
    def get(self, request_id):
        is_auth, auth_reject_message = self._validate_user()
        if not is_auth:
            return {'message': f'Authentication Failed: {str(auth_reject_message)}'}, 401

        submitted_request = TransformRequest.return_request(request_id)
        if not submitted_request:
            return "Transform Not Found", "404"

        status_request = status_request_parser.parse_args()

        count = TransformationResult.count(request_id)
        stats = TransformationResult.statistics(request_id)
        failures = TransformationResult.failed_files(request_id)
        print(count, stats)
        print(TransformRequest.files_remaining(request_id))
        result_dict = {
            "status": submitted_request.status,
            "request-id": request_id,
            "files-processed": count - failures,
            "files-skipped": failures,
            "files-remaining": TransformRequest.files_remaining(request_id),
            "stats": stats
        }

        if status_request.details:
            result_dict['details'] = TransformationResult.to_json_list(
                TransformationResult.get_all_status(request_id))

        return jsonify(result_dict)
Exemplo n.º 2
0
    def get(self, request_id):
        status_request = status_request_parser.parse_args()

        count = TransformationResult.count(request_id)
        stats = TransformationResult.statistics(request_id)
        failures = TransformationResult.failed_files(request_id)
        print(count, stats)
        print(TransformRequest.files_remaining(request_id))
        result_dict = {
            "request-id": request_id,
            "files-processed": count - failures,
            "files-skipped": failures,
            "files-remaining": TransformRequest.files_remaining(request_id),
            "stats": stats
        }

        if status_request.details:
            result_dict['details'] = TransformationResult.to_json_list(
                TransformationResult.get_all_status(request_id))

        return jsonify(result_dict)