use of org.apache.ignite.internal.commandline.TaskExecutor.BROADCAST_UUID in project ignite by apache.
the class KillCommand method parseArguments.
/**
* {@inheritDoc}
*/
@Override
public void parseArguments(CommandArgIterator argIter) {
KillSubcommand cmd;
try {
cmd = KillSubcommand.valueOf(argIter.nextArg("Expected type of resource to kill.").toUpperCase());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Expected type of resource to kill.");
}
switch(cmd) {
case COMPUTE:
taskArgs = new VisorComputeCancelSessionTaskArg(IgniteUuid.fromString(argIter.nextArg("Expected compute task id.")));
taskName = VisorComputeCancelSessionTask.class.getName();
nodeId = null;
break;
case SERVICE:
taskArgs = new VisorCancelServiceTaskArg(argIter.nextArg("Expected service name."));
taskName = VisorCancelServiceTask.class.getName();
nodeId = null;
break;
case TRANSACTION:
String xid = argIter.nextArg("Expected transaction id.");
taskArgs = new VisorTxTaskArg(VisorTxOperation.KILL, null, null, null, null, null, null, xid, null, null, null);
taskName = VisorTxTask.class.getName();
nodeId = null;
break;
case SQL:
T2<UUID, Long> ids = parseGlobalQueryId(argIter.nextArg("Expected SQL query id."));
if (ids == null)
throw new IllegalArgumentException("Expected global query id. " + EXPECTED_GLOBAL_QRY_ID_FORMAT);
taskArgs = new VisorQueryCancelOnInitiatorTaskArg(ids.get1(), ids.get2());
taskName = VisorQueryCancelOnInitiatorTask.class.getName();
nodeId = null;
break;
case SCAN:
String originNodeIsStr = argIter.nextArg("Expected query originating node id.");
UUID originNodeId = UUID.fromString(originNodeIsStr);
String cacheName = argIter.nextArg("Expected cache name.");
long qryId = Long.parseLong(argIter.nextArg("Expected query identifier."));
taskArgs = new VisorScanQueryCancelTaskArg(originNodeId, cacheName, qryId);
taskName = VisorScanQueryCancelTask.class.getName();
nodeId = null;
break;
case CONTINUOUS:
taskArgs = new VisorContinuousQueryCancelTaskArg(UUID.fromString(argIter.nextArg("Expected query originating node id.")), UUID.fromString(argIter.nextArg("Expected continuous query id.")));
taskName = VisorContinuousQueryCancelTask.class.getName();
nodeId = null;
break;
case SNAPSHOT:
taskArgs = argIter.nextArg("Expected snapshot name.");
taskName = VisorSnapshotCancelTask.class.getName();
nodeId = null;
break;
case CONSISTENCY:
taskName = VisorConsistencyCancelTask.class.getName();
taskArgs = null;
nodeId = BROADCAST_UUID;
break;
default:
throw new IllegalArgumentException("Unknown kill subcommand: " + cmd);
}
}
use of org.apache.ignite.internal.commandline.TaskExecutor.BROADCAST_UUID in project ignite by apache.
the class CacheDistribution method execute.
/**
* {@inheritDoc}
*/
@Override
public Object execute(GridClientConfiguration clientCfg, Logger logger) throws Exception {
CacheDistributionTaskArg taskArg = new CacheDistributionTaskArg(args.caches(), args.getUserAttributes());
UUID nodeId = args.nodeId() == null ? BROADCAST_UUID : args.nodeId();
CacheDistributionTaskResult res;
try (GridClient client = Command.startClient(clientCfg)) {
res = executeTaskByNameOnNode(client, CacheDistributionTask.class.getName(), taskArg, nodeId, clientCfg);
}
CommandLogger.printErrors(res.exceptions(), "Cache distrubution task failed on nodes:", logger);
res.print(System.out);
return res;
}
use of org.apache.ignite.internal.commandline.TaskExecutor.BROADCAST_UUID in project ignite by apache.
the class CacheContention method execute.
/**
* {@inheritDoc}
*/
@Override
public Object execute(GridClientConfiguration clientCfg, Logger logger) throws Exception {
VisorContentionTaskArg taskArg = new VisorContentionTaskArg(args.minQueueSize(), args.maxPrint());
UUID nodeId = args.nodeId() == null ? BROADCAST_UUID : args.nodeId();
VisorContentionTaskResult res;
try (GridClient client = Command.startClient(clientCfg)) {
res = executeTaskByNameOnNode(client, VisorContentionTask.class.getName(), taskArg, nodeId, clientCfg);
}
CommandLogger.printErrors(res.exceptions(), "Contention check failed on nodes:", logger);
for (ContentionInfo info : res.getInfos()) info.print();
return res;
}
use of org.apache.ignite.internal.commandline.TaskExecutor.BROADCAST_UUID in project ignite by apache.
the class ReencryptionRateCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public Object execute(GridClientConfiguration clientCfg, Logger log) throws Exception {
try (GridClient client = Command.startClient(clientCfg)) {
VisorCacheGroupEncryptionTaskResult<Double> res = executeTaskByNameOnNode(client, VisorReencryptionRateTask.class.getName(), taskArg, BROADCAST_UUID, clientCfg);
Map<UUID, IgniteException> exceptions = res.exceptions();
for (Map.Entry<UUID, IgniteException> entry : exceptions.entrySet()) {
log.info(INDENT + "Node " + entry.getKey() + ":");
log.info(DOUBLE_INDENT + "failed to get/set re-encryption rate limit: " + entry.getValue().getMessage());
}
Map<UUID, Double> results = res.results();
boolean read = taskArg.rate() == null;
for (Map.Entry<UUID, Double> entry : results.entrySet()) {
log.info(INDENT + "Node " + entry.getKey() + ":");
double rateLimit = read ? entry.getValue() : taskArg.rate();
if (rateLimit == 0)
log.info(DOUBLE_INDENT + "re-encryption rate is not limited.");
else {
log.info(String.format("%sre-encryption rate %s limited to %.2f MB/s.", DOUBLE_INDENT, (read ? "is" : "has been"), rateLimit));
}
}
if (read)
return null;
log.info("");
log.info("Note: the changed value of the re-encryption rate limit is not persisted. " + "When the node is restarted, the value will be set from the configuration.");
log.info("");
return null;
} catch (Throwable e) {
log.severe("Failed to perform operation.");
log.severe(CommandLogger.errorMessage(e));
throw e;
}
}
Aggregations