From e90d191d9179f18b5615490befad752d8778e858 Mon Sep 17 00:00:00 2001 From: Andrew Hand Date: Mon, 21 Oct 2024 09:59:52 -0400 Subject: [PATCH] chore(restapi): Minor fixes --- .../restapi/v1/workflows/controller.py | 36 -------------- src/dioptra/restapi/v1/workflows/schema.py | 48 ------------------- 2 files changed, 84 deletions(-) diff --git a/src/dioptra/restapi/v1/workflows/controller.py b/src/dioptra/restapi/v1/workflows/controller.py index de3e22e6b..b6d21a3d5 100644 --- a/src/dioptra/restapi/v1/workflows/controller.py +++ b/src/dioptra/restapi/v1/workflows/controller.py @@ -25,8 +25,6 @@ from injector import inject from structlog.stdlib import BoundLogger -from .schema import FileTypes, JobFilesDownloadQueryParametersSchema, EntrypointWorkflowSchema -from .service import JobFilesDownloadService, EntrypointValidateService from .schema import FileTypes, JobFilesDownloadQueryParametersSchema, EntrypointWorkflowSchema from .service import JobFilesDownloadService, EntrypointValidateService @@ -82,40 +80,6 @@ def get(self): ) -@api.route("/entrypointValidate") -class EntrypointValidateEndpoint(Resource): - @inject - def __init__( - self, entrypoint_validate_service: EntrypointValidateService, *args, **kwargs - ) -> None: - """Initialize the workflow resource. - - All arguments are provided via dependency injection. - - Args: - entrypoint_validate_service: A EntrypointValidateService object. - """ - self._entrypoint_validate_service = entrypoint_validate_service - super().__init__(*args, **kwargs) - - @login_required - @accepts(schema=EntrypointWorkflowSchema, api=api) - def post(self): - """Validates the workflow for a entrypoint.""" # noqa: B950 - log = LOGGER.new( - request_id=str(uuid.uuid4()), resource="Workflows", request_type="POST" - ) - parsed_obj = request.parsed_obj # type: ignore - task_graph = parsed_obj["task_graph"] - plugin_ids = parsed_obj["plugin_ids"] - parameters = parsed_obj["parameters"] - return self._entrypoint_validate_service.validate( - task_graph=task_graph, - plugin_ids=plugin_ids, - entrypoint_parameters=parameters, - log=log, - ) - @api.route("/entrypointValidate") class EntrypointValidateEndpoint(Resource): @inject diff --git a/src/dioptra/restapi/v1/workflows/schema.py b/src/dioptra/restapi/v1/workflows/schema.py index f4dc01ab2..7c22aecb3 100644 --- a/src/dioptra/restapi/v1/workflows/schema.py +++ b/src/dioptra/restapi/v1/workflows/schema.py @@ -21,8 +21,6 @@ from dioptra.restapi.v1.entrypoints.schema import EntrypointParameterSchema -from dioptra.restapi.v1.entrypoints.schema import EntrypointParameterSchema - class FileTypes(Enum): TAR_GZ = "tar_gz" @@ -68,49 +66,3 @@ class EntrypointWorkflowSchema(Schema): many=True, metadata=dict(description="List of parameters for the entrypoint."), ) - - -class EntrypointWorkflowSchema(Schema): - """The YAML that represents the Entrypoint Workflow.""" - - taskGraph = fields.String( - attribute="task_graph", - metadata=dict(description="Task graph of the Entrypoint resource."), - required=True, - ) - pluginIds = fields.List( - fields.Integer(), - attribute="plugin_ids", - data_key="plugins", - metadata=dict(description="List of plugin files for the entrypoint."), - load_only=True, - ) - parameters = fields.Nested( - EntrypointParameterSchema, - attribute="parameters", - many=True, - metadata=dict(description="List of parameters for the entrypoint."), - ) - - -class EntrypointWorkflowSchema(Schema): - """The YAML that represents the Entrypoint Workflow.""" - - taskGraph = fields.String( - attribute="task_graph", - metadata=dict(description="Task graph of the Entrypoint resource."), - required=True, - ) - pluginIds = fields.List( - fields.Integer(), - attribute="plugin_ids", - data_key="plugins", - metadata=dict(description="List of plugin files for the entrypoint."), - load_only=True, - ) - parameters = fields.Nested( - EntrypointParameterSchema, - attribute="parameters", - many=True, - metadata=dict(description="List of parameters for the entrypoint."), - )