Esempio n. 1
0
 def allocs(ctx, match, partition):
     """View allocations report."""
     report = fetch_report(
         ctx.obj.get('api'), 'allocations', match, partition
     )
     report = report.loc[
         ~report.name.str.startswith('_default/')
     ].reset_index(drop=True)
     print_report(report)
Esempio n. 2
0
    def apps(ctx, match, partition, full):
        """View apps report."""
        report = fetch_report(ctx.obj.get('api'), 'apps', match, partition)
        # 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)
Esempio n. 3
0
 def servers(ctx, match, partition):
     """View servers report."""
     report = fetch_report(ctx.obj.get('api'), 'servers', match, partition)
     report['valid_until'] = pd.to_datetime(report['valid_until'], unit='s')
     print_report(report)