apps.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:treadmill 作者: Morgan-Stanley 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号