Search in sources :

Example 1 with UfsCommand

use of alluxio.cli.fsadmin.report.UfsCommand in project alluxio by Alluxio.

the class ReportCommand method run.

@Override
public int run(CommandLine cl) throws IOException {
    String[] args = cl.getArgs();
    if (cl.hasOption(HELP_OPTION_NAME) && !(args.length > 0 && args[0].equals("capacity"))) {
        // if category is capacity, we print report capacity usage inside CapacityCommand.
        System.out.println(getUsage());
        System.out.println(getDescription());
        return 0;
    }
    FileSystemAdminShellUtils.checkMasterClientService(mConf);
    // Get the report category
    Command command = Command.SUMMARY;
    if (args.length == 1) {
        switch(args[0]) {
            case "capacity":
                command = Command.CAPACITY;
                break;
            case "metrics":
                command = Command.METRICS;
                break;
            case "summary":
                command = Command.SUMMARY;
                break;
            case "ufs":
                command = Command.UFS;
                break;
            case "jobservice":
                command = Command.JOBSERVICE;
                break;
            default:
                System.out.println(getUsage());
                System.out.println(getDescription());
                throw new InvalidArgumentException("report category is invalid.");
        }
    }
    // Only capacity category has [category args]
    if (!command.equals(Command.CAPACITY)) {
        if (cl.getOptions().length > 0) {
            throw new InvalidArgumentException(String.format("report %s does not support arguments: %s", command.toString().toLowerCase(), cl.getOptions()[0].getOpt()));
        }
    }
    switch(command) {
        case CAPACITY:
            CapacityCommand capacityCommand = new CapacityCommand(mBlockClient, mPrintStream);
            capacityCommand.run(cl);
            break;
        case METRICS:
            MetricsCommand metricsCommand = new MetricsCommand(mMetricsClient, mPrintStream);
            metricsCommand.run();
            break;
        case SUMMARY:
            SummaryCommand summaryCommand = new SummaryCommand(mMetaClient, mBlockClient, mConf.getString(PropertyKey.USER_DATE_FORMAT_PATTERN), mPrintStream);
            summaryCommand.run();
            break;
        case UFS:
            UfsCommand ufsCommand = new UfsCommand(mFsClient);
            ufsCommand.run();
            break;
        case JOBSERVICE:
            JobServiceMetricsCommand jobmetricsCommand = new JobServiceMetricsCommand(mJobMasterClient, mPrintStream, mConf.getString(PropertyKey.USER_DATE_FORMAT_PATTERN));
            jobmetricsCommand.run();
            break;
        default:
            break;
    }
    return 0;
}
Also used : JobServiceMetricsCommand(alluxio.cli.fsadmin.report.JobServiceMetricsCommand) MetricsCommand(alluxio.cli.fsadmin.report.MetricsCommand) SummaryCommand(alluxio.cli.fsadmin.report.SummaryCommand) InvalidArgumentException(alluxio.exception.status.InvalidArgumentException) JobServiceMetricsCommand(alluxio.cli.fsadmin.report.JobServiceMetricsCommand) SummaryCommand(alluxio.cli.fsadmin.report.SummaryCommand) CapacityCommand(alluxio.cli.fsadmin.report.CapacityCommand) JobServiceMetricsCommand(alluxio.cli.fsadmin.report.JobServiceMetricsCommand) MetricsCommand(alluxio.cli.fsadmin.report.MetricsCommand) UfsCommand(alluxio.cli.fsadmin.report.UfsCommand) UfsCommand(alluxio.cli.fsadmin.report.UfsCommand) CapacityCommand(alluxio.cli.fsadmin.report.CapacityCommand)

Aggregations

CapacityCommand (alluxio.cli.fsadmin.report.CapacityCommand)1 JobServiceMetricsCommand (alluxio.cli.fsadmin.report.JobServiceMetricsCommand)1 MetricsCommand (alluxio.cli.fsadmin.report.MetricsCommand)1 SummaryCommand (alluxio.cli.fsadmin.report.SummaryCommand)1 UfsCommand (alluxio.cli.fsadmin.report.UfsCommand)1 InvalidArgumentException (alluxio.exception.status.InvalidArgumentException)1