/**
   * Starts an interactive command loop for sending job commands to the cluster using current active
   * cluster definition.
   */
  public static void main(String[] args) throws IOException {
    // ./run org.sd.cluster.config.JobAdmin

    final PropertiesParser pp = new PropertiesParser(args, true);
    final Properties properties = pp.getProperties();
    final ClusterRunner cr = new ClusterRunner(true /*useActiveCluster*/, properties);
    // final String user = cr.getUser();
    final ClusterDefinition clusterDef = cr.getClusterDefinition();
    final JobAdmin jobAdmin = new JobAdmin(clusterDef, 10000);
    final String cmdFile = properties != null ? properties.getProperty("cmdFile") : null;
    final CommandInterpreter interp = new CommandInterpreter(jobAdmin, cmdFile);

    interp.setVar("prompt", "jobcmd> ");
    interp.setVar("user", clusterDef.getUser());
    interp.setVar("defName", clusterDef.getDefinitionName());
    interp.setVar("machines", concat(clusterDef.getMachines(), ", "));

    jobAdmin.init();
    if (cmdFile != null) {
      interp.init(); // just run commands in command file
    } else {
      interp.init();
      interp.start(); // start interactive interpreter
    }
    jobAdmin.shutdown();
  }