Esempio n. 1
0
    def _generate_transformation_record(self, submitted_request, status):
        request_id = submitted_request.request_id
        count = TransformationResult.count(request_id)
        time = int(datetime.now(tz=timezone.utc).timestamp() * 1000)
        current_stats = TransformationResult.statistics(request_id)

        events_transformed = 0 if not current_stats else current_stats[
            'total-events']
        return {
            "name": 'Transformation Request',
            "description": 'Transformation Request',
            "dataset": submitted_request.did,
            "dataset_size": int(submitted_request.total_bytes or 0),
            "dataset_files": count,
            "dataset_events": int(submitted_request.total_events or 0),
            "columns": submitted_request.columns,
            "events": 0,
            "events_transformed": events_transformed,
            "events_served": 0,
            "events_processed": 0,
            "created_at": submitted_request.submit_time,
            "modified_at": time,
            "status": status,
            "info": ' '
        }
Esempio n. 2
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)
Esempio n. 3
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)