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;
}
Aggregations