From 665e5b30b4fec185b925803ed34ab214b4f3580d Mon Sep 17 00:00:00 2001 From: Diego Rodriguez Date: Thu, 14 Sep 2017 08:39:26 +0200 Subject: [PATCH] api: amend yadage endpoints Signed-off-by: Diego Rodriguez --- docs/openapi.json | 18 +++++------------- reana_workflow_controller/rest.py | 25 +++++++++++-------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 3aed7c25..e8671a5d 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -97,13 +97,13 @@ "summary": "Returns all workflows." } }, - "/api/yadage_from_remote": { + "/api/yadage/remote": { "post": { "consumes": [ "application/json" ], "description": "This resource is expecting JSON data with all the necessary information to instantiate a yadage workflow from a remote repository.", - "operationId": "create_yadage_workflow_from_remote", + "operationId": "run_yadage_workflow_from_remote", "parameters": [ { "description": "Required. Organization which the worklow belongs to.", @@ -177,13 +177,13 @@ "summary": "Creates a new yadage workflow from a remote repository." } }, - "/api/yadage_from_spec": { + "/api/yadage/spec": { "post": { "consumes": [ "application/json" ], "description": "This resource is expecting a JSON yadage specification.", - "operationId": "create_yadage_workflow_from_spec", + "operationId": "run_yadage_workflow_from_spec", "parameters": [ { "description": "Required. Organization which the worklow belongs to.", @@ -207,15 +207,7 @@ "schema": { "properties": { "parameters": { - "properties": { - "nparallel": { - "type": "integer" - }, - "preset_pars": { - "description": "Workflow parameters.", - "type": "object" - } - }, + "description": "Workflow parameters.", "type": "object" }, "workflow_spec": { diff --git a/reana_workflow_controller/rest.py b/reana_workflow_controller/rest.py index 7d6414ab..5f5ecc54 100644 --- a/reana_workflow_controller/rest.py +++ b/reana_workflow_controller/rest.py @@ -147,8 +147,8 @@ def get_workflows(): # noqa return jsonify({"message": str(e)}), 500 -@restapi_blueprint.route('/yadage_from_remote', methods=['POST']) -def yadage_endpoint(): # noqa +@restapi_blueprint.route('/yadage/remote', methods=['POST']) +def run_yadage_workflow_from_remote_endpoint(): # noqa r"""Create a new yadage workflow from a remote repository. --- @@ -157,7 +157,7 @@ def yadage_endpoint(): # noqa description: >- This resource is expecting JSON data with all the necessary information to instantiate a yadage workflow from a remote repository. - operationId: create_yadage_workflow_from_remote + operationId: run_yadage_workflow_from_remote consumes: - application/json produces: @@ -234,15 +234,15 @@ def yadage_endpoint(): # noqa abort(400) -@restapi_blueprint.route('/yadage_from_spec', methods=['POST']) -def yadage_from_spec_endpoint(): # noqa +@restapi_blueprint.route('/yadage/spec', methods=['POST']) +def run_yadage_workflow_from_spec_endpoint(): # noqa r"""Create a new yadage workflow. --- post: summary: Creates a new yadage workflow from a specification file. description: This resource is expecting a JSON yadage specification. - operationId: create_yadage_workflow_from_spec + operationId: run_yadage_workflow_from_spec consumes: - application/json produces: @@ -270,12 +270,7 @@ def yadage_from_spec_endpoint(): # noqa properties: parameters: type: object - properties: - nparallel: - type: integer - preset_pars: - type: object - description: Workflow parameters. + description: Workflow parameters. workflow_spec: type: object description: >- @@ -302,12 +297,14 @@ def yadage_from_spec_endpoint(): # noqa Request failed. The incoming data specification seems malformed """ try: + # hardcoded until confirmation from `yadage` + nparallel = 10 if request.json: arguments = { - "nparallel": request.json['parameters']['nparallel'], + "nparallel": nparallel, "workflow": request.json['workflow_spec'], "toplevel": "", # ignored when spec submited - "preset_pars": request.json['parameters']['preset_pars'] + "preset_pars": request.json['parameters'] } queue = organization_to_queue[request.args.get('organization')] resultobject = run_yadage_workflow.apply_async(