Skip to content

Commit

Permalink
Merge e7beac4 into 76853ed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinos Kousidis committed Feb 4, 2019
2 parents 76853ed + e7beac4 commit 559f311
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions reana_client/cli/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,48 @@ def add_verbose_data_from_response(response, verbose_headers,
err=True)


@click.command(
'disk_usage',
help='Get disk usage of a workspace.')
@click.option(
'-w',
'--workflow',
default=os.environ.get('REANA_WORKON', None),
callback=workflow_uuid_or_name,
help='Name or UUID of the workflow whose status should be resolved. '
'Overrides value of REANA_WORKON environment variable.')
@add_access_token_options
@click.option(
'-s',
'--summarize',
count=True,
help='Display total.')
@click.pass_context
def workflow_disk_usage(ctx, workflow, access_token, summarize):
"""Get disk usage of a workspace."""
logging.debug('command: {}'.format(ctx.command_path.replace(" ", ".")))
for p in ctx.params:
logging.debug('{param}: {value}'.format(param=p, value=ctx.params[p]))

if not access_token:
click.echo(
click.style(ERROR_MESSAGES['missing_access_token'],
fg='red'), err=True)
sys.exit(1)

if workflow:
try:
response = get_workflow_disk_usage(workflow, access_token)

except Exception as e:
logging.debug(traceback.format_exc())
logging.debug(str(e))
click.echo(
click.style('Disk usage could not be retrieved: \n{}'
.format(str(e)), fg='red'),
err=True)


@click.command(
'logs',
help='Get workflow logs.')
Expand Down Expand Up @@ -830,3 +872,4 @@ def print_color_diff(lines):
workflow.add_command(workflow_delete)
workflow.add_command(workflow_diff)
workflow.add_command(workflow_logs)
workflow.add_command(workflow_disk_usage)

0 comments on commit 559f311

Please sign in to comment.