Skip to content

Commit

Permalink
api: amend yadage endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
  • Loading branch information
Diego Rodriguez committed Sep 28, 2017
1 parent 920b56e commit 665e5b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
18 changes: 5 additions & 13 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand All @@ -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": {
Expand Down
25 changes: 11 additions & 14 deletions reana_workflow_controller/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
---
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: >-
Expand All @@ -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(
Expand Down

0 comments on commit 665e5b3

Please sign in to comment.