Search in sources :

Example 1 with VisorBaselineTaskResult

use of org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult in project ignite by apache.

the class CommandHandler method baselineVersion.

/**
 * Set baseline by topology version.
 *
 * @param client Client.
 * @param arg Argument from command line.
 */
private void baselineVersion(GridClient client, String arg) throws GridClientException {
    try {
        VisorBaselineTaskResult res = executeTask(client, VisorBaselineTask.class, arg(VERSION, arg));
        baselinePrint0(res);
    } catch (Throwable e) {
        log("Failed to set baseline with specified topology version.");
        throw e;
    }
}
Also used : VisorBaselineTaskResult(org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult)

Example 2 with VisorBaselineTaskResult

use of org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult in project ignite by apache.

the class CommandHandler method baselineRemove.

/**
 * Remove nodes from baseline.
 *
 * @param client Client.
 * @param consistentIds Consistent IDs.
 * @throws Throwable If failed to remove nodes from baseline.
 */
private void baselineRemove(GridClient client, String consistentIds) throws Throwable {
    try {
        VisorBaselineTaskResult res = executeTask(client, VisorBaselineTask.class, arg(REMOVE, consistentIds));
        baselinePrint0(res);
    } catch (Throwable e) {
        log("Failed to remove nodes from baseline.");
        throw e;
    }
}
Also used : VisorBaselineTaskResult(org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult)

Example 3 with VisorBaselineTaskResult

use of org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult in project ignite by apache.

the class BaselineCommand method execute.

/**
 * Change baseline.
 *
 * @param clientCfg Client configuration.
 * @throws Exception If failed to execute baseline action.
 */
@Override
public Object execute(GridClientConfiguration clientCfg, Logger logger) throws Exception {
    try (GridClient client = Command.startClient(clientCfg)) {
        UUID coordinatorId = client.compute().nodes(node -> !node.isClient()).stream().min(Comparator.comparingLong(GridClientNode::order)).map(GridClientNode::nodeId).orElse(null);
        VisorBaselineTaskResult res = executeTaskByNameOnNode(client, VisorBaselineTask.class.getName(), toVisorArguments(baselineArgs), coordinatorId, clientCfg);
        baselinePrint0(res, logger);
    } catch (Throwable e) {
        logger.severe("Failed to execute baseline command='" + baselineArgs.getCmd().text() + "'");
        logger.severe(CommandLogger.errorMessage(e));
        throw e;
    }
    return null;
}
Also used : VisorBaselineTaskResult(org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult) GridClient(org.apache.ignite.internal.client.GridClient) UUID(java.util.UUID) VisorBaselineTask(org.apache.ignite.internal.visor.baseline.VisorBaselineTask)

Example 4 with VisorBaselineTaskResult

use of org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult in project ignite by apache.

the class CommandHandler method baselinePrint.

/**
 * Print current baseline.
 *
 * @param client Client.
 */
private void baselinePrint(GridClient client) throws GridClientException {
    VisorBaselineTaskResult res = executeTask(client, VisorBaselineTask.class, arg(COLLECT, ""));
    baselinePrint0(res);
}
Also used : VisorBaselineTaskResult(org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult)

Example 5 with VisorBaselineTaskResult

use of org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult in project ignite by apache.

the class CommandHandler method baselineSet.

/**
 * Set baseline.
 *
 * @param client Client.
 * @param consistentIds Consistent IDs.
 * @throws Throwable If failed to set baseline.
 */
private void baselineSet(GridClient client, String consistentIds) throws Throwable {
    try {
        VisorBaselineTaskResult res = executeTask(client, VisorBaselineTask.class, arg(SET, consistentIds));
        baselinePrint0(res);
    } catch (Throwable e) {
        log("Failed to set baseline.");
        throw e;
    }
}
Also used : VisorBaselineTaskResult(org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult)

Aggregations

VisorBaselineTaskResult (org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult)7 UUID (java.util.UUID)2 GridClient (org.apache.ignite.internal.client.GridClient)2 VisorBaselineTask (org.apache.ignite.internal.visor.baseline.VisorBaselineTask)2 TRUE (java.lang.Boolean.TRUE)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Collections.singletonMap (java.util.Collections.singletonMap)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Logger (java.util.logging.Logger)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 GridClientConfiguration (org.apache.ignite.internal.client.GridClientConfiguration)1 GridClientNode (org.apache.ignite.internal.client.GridClientNode)1 DELIM (org.apache.ignite.internal.commandline.CommandHandler.DELIM)1