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