Skip to content

Commit

Permalink
docs: openapi specs with disk usage
Browse files Browse the repository at this point in the history
Signed-off-by: Dinos Kousidis <dinos.kousidis@cern.ch>
  • Loading branch information
dinosk committed Feb 12, 2019
1 parent 8fc8d37 commit 21e63ef
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
26 changes: 20 additions & 6 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
"name": "user",
"required": true,
"type": "string"
},
{
"description": "Optional flag to show more information.",
"in": "query",
"name": "verbose",
"required": false,
"type": "boolean"
}
],
"produces": [
Expand All @@ -31,29 +38,33 @@
{
"created": "2018-06-13T09:47:35.66097",
"id": "256b25f4-4cfb-4684-b7a8-73872ef455a1",
"name": "mytest-1",
"name": "mytest.1",
"size": "10M",
"status": "running",
"user": "00000000-0000-0000-0000-000000000000"
},
{
"created": "2018-06-13T09:47:35.66097",
"id": "3c9b117c-d40a-49e3-a6de-5f89fcada5a3",
"name": "mytest-2",
"name": "mytest.2",
"size": "12M",
"status": "finished",
"user": "00000000-0000-0000-0000-000000000000"
},
{
"created": "2018-06-13T09:47:35.66097",
"id": "72e3ee4f-9cd3-4dc7-906c-24511d9f5ee3",
"name": "mytest-3",
"status": "waiting",
"name": "mytest.3",
"size": "180K",
"status": "created",
"user": "00000000-0000-0000-0000-000000000000"
},
{
"created": "2018-06-13T09:47:35.66097",
"id": "c4c0a1a6-beef-46c7-be04-bf4b3beca5a1",
"name": "mytest-4",
"status": "waiting",
"name": "mytest.4",
"size": "1G",
"status": "created",
"user": "00000000-0000-0000-0000-000000000000"
}
]
Expand All @@ -70,6 +81,9 @@
"name": {
"type": "string"
},
"size": {
"type": "string"
},
"status": {
"type": "string"
},
Expand Down
16 changes: 11 additions & 5 deletions reana_workflow_controller/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
DEFAULT_INTERACTIVE_SESSION_IMAGE,
DEFAULT_INTERACTIVE_SESSION_PORT,
DEFAULT_NAME_FOR_WORKFLOWS,
SHARED_VOLUME_PATH,
WORKFLOW_QUEUES,
WORKFLOW_TIME_FORMAT)
from reana_workflow_controller.errors import (REANAUploadPathError,
Expand Down Expand Up @@ -174,11 +175,16 @@ def get_workflows(): # noqa
'created': workflow.created.
strftime(WORKFLOW_TIME_FORMAT)}
if verbose:
disk_usage_info = get_workspace_disk_usage(
workflow.get_workspace(),
summarize=True)
# TODO: format disk_usage_info
workflow_response['size'] = disk_usage_info
reana_fs = fs.open_fs(SHARED_VOLUME_PATH)
if reana_fs.exists(workflow.get_workspace()):
absolute_workspace_path = reana_fs.getospath(
workflow.get_workspace())
disk_usage_info = get_workspace_disk_usage(
absolute_workspace_path)
if disk_usage_info:
workflow_response['size'] = disk_usage_info[-1]['size']
else:
workflow_response['size'] = '0K'
workflows.append(workflow_response)

return jsonify(workflows), 200
Expand Down

0 comments on commit 21e63ef

Please sign in to comment.