def init():
"""Return top level command handler."""
@click.command()
@cli.handle_exceptions(restclient.CLI_REST_EXCEPTIONS)
@click.option('--match', help='Server name pattern match')
@click.option('--full', is_flag=True, default=False)
@click.pass_context
def apps(ctx, match, full):
"""View apps report."""
report = fetch_report(ctx.obj.get('api'), 'apps', match)
# Replace integer N/As
for col in ['identity', 'expires', 'lease', 'data_retention']:
report.loc[report[col] == -1, col] = ''
# Convert to datetimes
for col in ['expires']:
report[col] = pd.to_datetime(report[col], unit='s')
# Convert to timedeltas
for col in ['lease', 'data_retention']:
report[col] = pd.to_timedelta(report[col], unit='s')
report = report.fillna('')
if not full:
report = report[[
'instance', 'allocation', 'partition', 'server',
'mem', 'cpu', 'disk'
]]
print_report(report)
return apps
评论列表
文章目录