Search in sources :

Example 1 with InvalidApplicationException

use of com.yahoo.vespa.config.server.http.InvalidApplicationException in project vespa by vespa-engine.

the class SessionPreparer method prepare.

/**
 * Prepares a session (validates, builds model, writes to zookeeper and distributes files)
 *
 * @param context                     Contains classes needed to read/write session data.
 * @param logger                      For storing logs returned in response to client.
 * @param params                      parameters controlling behaviour of prepare.
 * @param currentActiveApplicationSet Set of currently active applications.
 * @param tenantPath Zookeeper path for the tenant for this session
 * @return the config change actions that must be done to handle the activation of the models prepared.
 */
public ConfigChangeActions prepare(SessionContext context, DeployLogger logger, PrepareParams params, Optional<ApplicationSet> currentActiveApplicationSet, Path tenantPath, Instant now) {
    Preparation preparation = new Preparation(context, logger, params, currentActiveApplicationSet, tenantPath);
    preparation.preprocess();
    try {
        AllocatedHosts allocatedHosts = preparation.buildModels(now);
        preparation.makeResult(allocatedHosts);
        if (!params.isDryRun()) {
            preparation.writeStateZK();
            preparation.writeRotZK();
            preparation.distribute();
        }
        log.log(LogLevel.DEBUG, () -> "time used " + params.getTimeoutBudget().timesUsed() + " : " + params.getApplicationId());
        return preparation.result();
    } catch (OutOfCapacityException e) {
        throw e;
    } catch (IllegalArgumentException e) {
        throw new InvalidApplicationException("Invalid application package", e);
    }
}
Also used : AllocatedHosts(com.yahoo.config.provision.AllocatedHosts) OutOfCapacityException(com.yahoo.config.provision.OutOfCapacityException) InvalidApplicationException(com.yahoo.vespa.config.server.http.InvalidApplicationException)

Aggregations

AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)1 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)1 InvalidApplicationException (com.yahoo.vespa.config.server.http.InvalidApplicationException)1