Commit 9602dd62 authored by David Mendez's avatar David Mendez
Browse files

Add a controller to receive statistics for the test job

parent bb7fced1
......@@ -8,6 +8,7 @@ from app.blueprints.admin.controllers.admin_tasks_controller import ADMIN_TASKS_
from app.blueprints.admin.controllers.authorisation_controller import ADMIN_AUTH_BLUEPRINT
from app.blueprints.job_status.controllers.job_status_controller import JOB_STATUS_BLUEPRINT
from app.blueprints.job_submission.controllers.job_submissions_controller import SUBMISSION_BLUEPRINT
from app.blueprints.custom_statistics.controllers.custom_statistics_controller import CUSTOM_STATISTICS_BLUEPRINT
from app.blueprints.job_submission.services import job_submission_service
from app.blueprints.swagger_description.swagger_description_blueprint import SWAGGER_BLUEPRINT
from app.config import RUN_CONFIG
......@@ -60,6 +61,7 @@ def create_app():
flask_app.register_blueprint(JOB_STATUS_BLUEPRINT, url_prefix=f'{base_path}/status')
flask_app.register_blueprint(ADMIN_AUTH_BLUEPRINT, url_prefix=f'{base_path}/admin')
flask_app.register_blueprint(ADMIN_TASKS_BLUEPRINT, url_prefix=f'{base_path}/admin')
flask_app.register_blueprint(CUSTOM_STATISTICS_BLUEPRINT, url_prefix=f'{base_path}/custom_statistics')
return flask_app
......
"""
This Module receives the requests for the custom statistics
"""
from flask import Blueprint, jsonify
from app.blueprints.custom_statistics.controllers import marshmallow_schemas
from app.request_validation.decorators import validate_form_with, validate_url_params_with
CUSTOM_STATISTICS_BLUEPRINT = Blueprint('custom_statistics', __name__)
@CUSTOM_STATISTICS_BLUEPRINT.route('/submit_statistics/test_job/<job_id>', methods = ['POST'])
@validate_url_params_with(marshmallow_schemas.JobID)
@validate_form_with(marshmallow_schemas.TestJobStatistics)
def submit_custom_statistics_test_job(job_id):
print('SUBMIT CUSTOM STATS!')
return jsonify({'operation_result': 'Statistics successfully saved!'})
\ No newline at end of file
"""
Schemas to validate the input of custom statistics endpoint
"""
from marshmallow import Schema, fields, validate
class JobID(Schema):
"""
Class that the schema for identifying the job
"""
job_id = fields.String(required=True)
class TestJobStatistics(Schema):
"""
Class that the schema for saving statistics for the test jobs
"""
duration = fields.Number(required=True, validate=validate.Range(min=0))
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment