public boolean execute( CommandInterpreter interpreter, CommandLine commandLine, boolean batchMode) { final String machineName = commandLine.getOptionValue('n'); final int localJobId = Integer.parseInt(commandLine.getOptionValue('j')); final boolean singleOnly = commandLine.hasOption('1'); String message = "sending " + jobCommand + " to " + machineName + ":" + localJobId; if (singleOnly) message = message + " (single)"; interpreter.showMessage(message, batchMode); Response[] responses = null; try { responses = sendJobCommand(jobCommand, machineName, localJobId, singleOnly); } catch (ClusterException e) { throw new IllegalStateException(e); } interpreter.showMessage("Received " + responses.length + " responses:", batchMode); for (Response response : responses) { String responseMessage = null; if (response instanceof BooleanResponse) { final BooleanResponse bresponse = (BooleanResponse) response; responseMessage = bresponse.getNodeName() + ": " + bresponse.getValue(); } else { responseMessage = response.toString(); } interpreter.showMessage(responseMessage, batchMode); } return true; }
public boolean execute( CommandInterpreter interpreter, CommandLine commandLine, boolean batchMode) { final String groupName = commandLine.getOptionValue('g', ClusterDefinition.ALL_NODES_GROUP); final String message = "Requesting jobs from group '" + groupName + "'..."; interpreter.showMessage(message, batchMode); Response[] responses = null; try { responses = console.sendMessageToNodes(new GetJobsMessage(), groupName, 5000, false); } catch (ClusterException e) { throw new IllegalStateException(e); } interpreter.showMessage("Received " + responses.length + " responses:", batchMode); for (Response response : responses) { interpreter.showMessage(response.toString(), batchMode); } return true; }
public boolean execute( CommandInterpreter interpreter, CommandLine commandLine, boolean batchMode) { final String localPathToDataDir = commandLine.getOptionValue('l'); final String groupName = commandLine.getOptionValue('g'); final String destDataDirId = commandLine.getOptionValue('d'); final String jobIdString = commandLine.getOptionValue('j'); final String partitionPatternString = commandLine.getOptionValue('p'); final int partitionGroupNum = Integer.parseInt(commandLine.getOptionValue('n')); final String message = "Sending data to nodes (backgrounded):\n" + "\tlocalPathToDataDir=" + localPathToDataDir + "\n" + "\tgroupName=" + groupName + "\n" + "\tdestDataDirId=" + destDataDirId + "\n" + "\tjobIdString=" + jobIdString + "\n" + "\tpartitionPatternString=" + partitionPatternString + "\n" + "\tpartitionGroupNum=" + partitionGroupNum + "\n"; interpreter.showMessage(message, batchMode); final String jobDirPostfix = DataPusher.getJobDirPostfix(jobIdString, destDataDirId); DataPusher.sendDataToNodes( console.getClusterDefinition(), groupName, jobDirPostfix, localPathToDataDir, Pattern.compile(partitionPatternString), partitionGroupNum, 3, 1); return true; }