Skip to content

Commit

Permalink
rest: add include_last_command parameter to get_workflow_status
Browse files Browse the repository at this point in the history
Closes reanahub/reana-workflow/controller#486.
  • Loading branch information
giuseppe-steduto committed Nov 17, 2023
1 parent 8a7d746 commit d43cdb3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

Version 0.9.2 (UNRELEASED)
--------------------------

- Changes ``get_workflow_status`` endpoint to add an optional ``include_command`` parameter to show info about currently executing command.

Version 0.9.1 (2023-09-27)
--------------------------

Expand Down
13 changes: 13 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,12 @@
"name": "include_workspace_size",
"type": "boolean"
},
{
"description": "Include information about the current command.",
"in": "query",
"name": "include_last_command",
"type": "boolean"
},
{
"description": "Optional analysis UUID or name to filter.",
"in": "query",
Expand Down Expand Up @@ -3368,6 +3374,13 @@
"name": "access_token",
"required": false,
"type": "string"
},
{
"description": "Include additional information about the current command.",
"in": "query",
"name": "include_last_command",
"required": false,
"type": "boolean"
}
],
"produces": [
Expand Down
20 changes: 19 additions & 1 deletion reana_server/rest/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ def get_workflows(user, **kwargs): # noqa
in: query
description: Include size information of the workspace.
type: boolean
- name: include_last_command
in: query
description: Include information about the current command.
type: boolean
- name: workflow_id_or_name
in: query
description: Optional analysis UUID or name to filter.
Expand Down Expand Up @@ -341,6 +345,9 @@ def get_workflows(user, **kwargs): # noqa
search = request.args.get("search")
sort = request.args.get("sort", "desc")
status = request.args.getlist("status")
include_last_command = json.loads(
request.args.get("include_last_command", "false").lower()
)
verbose = json.loads(request.args.get("verbose", "false").lower())
response, http_response = current_rwc_api_client.api.get_workflows(
user=str(user.id_),
Expand All @@ -349,6 +356,7 @@ def get_workflows(user, **kwargs): # noqa
sort=sort,
status=status or None,
verbose=bool(verbose),
include_last_command=include_last_command,
**kwargs,
).result()

Expand Down Expand Up @@ -961,6 +969,11 @@ def get_workflow_status(workflow_id_or_name, user): # noqa
description: The API access_token of workflow owner.
required: false
type: string
- name: include_last_command
in: query
description: Include additional information about the current command.
required: false
type: boolean
responses:
200:
description: >-
Expand Down Expand Up @@ -1113,9 +1126,14 @@ def get_workflow_status(workflow_id_or_name, user): # noqa
try:
if not workflow_id_or_name:
raise ValueError("workflow_id_or_name is not supplied")
include_last_command = json.loads(
request.args.get("include_last_command", "false").lower()
)

response, http_response = current_rwc_api_client.api.get_workflow_status(
user=str(user.id_), workflow_id_or_name=workflow_id_or_name
user=str(user.id_),
workflow_id_or_name=workflow_id_or_name,
include_last_command=include_last_command,
).result()

return jsonify(response), http_response.status_code
Expand Down
Empty file modified scripts/generate_openapi_spec.py
100644 → 100755
Empty file.

0 comments on commit d43cdb3

Please sign in to comment.