Search in sources :

Example 1 with BatchInternalErrorException

use of com.yahoo.vespa.orchestrator.BatchInternalErrorException in project vespa by vespa-engine.

the class HostSuspensionResource method suspendAll.

@Override
public BatchOperationResult suspendAll(String parentHostnameString, List<String> hostnamesAsStrings) {
    HostName parentHostname = new HostName(parentHostnameString);
    List<HostName> hostnames = hostnamesAsStrings.stream().map(HostName::new).collect(Collectors.toList());
    try {
        orchestrator.suspendAll(parentHostname, hostnames);
    } catch (BatchHostStateChangeDeniedException e) {
        log.log(LogLevel.DEBUG, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
        throw createWebApplicationException(e.getMessage(), Response.Status.CONFLICT);
    } catch (BatchHostNameNotFoundException e) {
        log.log(LogLevel.DEBUG, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
        // by the URL path was found. It's one of the hostnames in the request it failed to find.
        throw createWebApplicationException(e.getMessage(), Response.Status.BAD_REQUEST);
    } catch (BatchInternalErrorException e) {
        log.log(LogLevel.DEBUG, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
        throw createWebApplicationException(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
    }
    log.log(LogLevel.DEBUG, "Suspended " + hostnames + " with parent " + parentHostname);
    return BatchOperationResult.successResult();
}
Also used : BatchHostStateChangeDeniedException(com.yahoo.vespa.orchestrator.policy.BatchHostStateChangeDeniedException) BatchHostNameNotFoundException(com.yahoo.vespa.orchestrator.BatchHostNameNotFoundException) HostName(com.yahoo.vespa.applicationmodel.HostName) BatchInternalErrorException(com.yahoo.vespa.orchestrator.BatchInternalErrorException)

Aggregations

HostName (com.yahoo.vespa.applicationmodel.HostName)1 BatchHostNameNotFoundException (com.yahoo.vespa.orchestrator.BatchHostNameNotFoundException)1 BatchInternalErrorException (com.yahoo.vespa.orchestrator.BatchInternalErrorException)1 BatchHostStateChangeDeniedException (com.yahoo.vespa.orchestrator.policy.BatchHostStateChangeDeniedException)1