Search in sources :

Example 1 with ModelCreateResult

use of com.yahoo.config.model.api.ModelCreateResult in project vespa by vespa-engine.

the class VespaModelFactoryTest method testThatFactoryModelValidationCanBeIgnored.

@Test
public void testThatFactoryModelValidationCanBeIgnored() {
    VespaModelFactory modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
    ModelCreateResult createResult = modelFactory.createAndValidateModel(new MockModelContext(createApplicationPackageThatFailsWhenValidating()), true);
    assertNotNull(createResult.getModel());
    assertNotNull(createResult.getConfigChangeActions());
    assertTrue(createResult.getConfigChangeActions().isEmpty());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) MockModelContext(com.yahoo.config.model.MockModelContext) ModelCreateResult(com.yahoo.config.model.api.ModelCreateResult) Test(org.junit.Test)

Example 2 with ModelCreateResult

use of com.yahoo.config.model.api.ModelCreateResult in project vespa by vespa-engine.

the class VespaModelFactory method createAndValidateModel.

@Override
public ModelCreateResult createAndValidateModel(ModelContext modelContext, boolean ignoreValidationErrors) {
    validateXml(modelContext, ignoreValidationErrors);
    DeployState deployState = createDeployState(modelContext, true);
    VespaModel model = buildModel(deployState);
    List<ConfigChangeAction> changeActions = validateModel(model, deployState, ignoreValidationErrors);
    return new ModelCreateResult(model, changeActions);
}
Also used : ModelCreateResult(com.yahoo.config.model.api.ModelCreateResult) DeployState(com.yahoo.config.model.deploy.DeployState) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction)

Example 3 with ModelCreateResult

use of com.yahoo.config.model.api.ModelCreateResult in project vespa by vespa-engine.

the class PreparedModelsBuilder method buildModelVersion.

@Override
protected PreparedModelResult buildModelVersion(ModelFactory modelFactory, ApplicationPackage applicationPackage, ApplicationId applicationId, com.yahoo.component.Version wantedNodeVespaVersion, Optional<AllocatedHosts> allocatedHosts, Instant now) {
    Version modelVersion = modelFactory.getVersion();
    log.log(LogLevel.DEBUG, "Building model " + modelVersion + " for " + applicationId);
    FileDistributionProvider fileDistributionProvider = fileDistributionFactory.createProvider(context.getServerDBSessionDir());
    // Use empty on non-hosted systems, use already allocated hosts if available, create connection to a host provisioner otherwise
    Optional<HostProvisioner> hostProvisioner = createHostProvisioner(allocatedHosts);
    Optional<Model> previousModel = currentActiveApplicationSet.map(set -> set.getForVersionOrLatest(Optional.of(modelVersion), now).getModel());
    ModelContext modelContext = new ModelContextImpl(applicationPackage, previousModel, permanentApplicationPackage.applicationPackage(), logger, configDefinitionRepo, fileDistributionProvider.getFileRegistry(), hostProvisioner, properties, getAppDir(applicationPackage), new com.yahoo.component.Version(modelVersion.toString()), wantedNodeVespaVersion);
    log.log(LogLevel.DEBUG, "Create and validate model " + modelVersion + " for " + applicationId);
    ModelCreateResult result = modelFactory.createAndValidateModel(modelContext, params.ignoreValidationErrors());
    validateModelHosts(context.getHostValidator(), applicationId, result.getModel());
    log.log(LogLevel.DEBUG, "Done building model " + modelVersion + " for " + applicationId);
    return new PreparedModelsBuilder.PreparedModelResult(modelVersion, result.getModel(), fileDistributionProvider, result.getConfigChangeActions());
}
Also used : ModelCreateResult(com.yahoo.config.model.api.ModelCreateResult) ModelContextImpl(com.yahoo.vespa.config.server.deploy.ModelContextImpl) ModelContext(com.yahoo.config.model.api.ModelContext) Version(com.yahoo.config.provision.Version) Model(com.yahoo.config.model.api.Model) FileDistributionProvider(com.yahoo.vespa.config.server.filedistribution.FileDistributionProvider) HostProvisioner(com.yahoo.config.model.api.HostProvisioner)

Aggregations

ModelCreateResult (com.yahoo.config.model.api.ModelCreateResult)3 MockModelContext (com.yahoo.config.model.MockModelContext)1 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)1 HostProvisioner (com.yahoo.config.model.api.HostProvisioner)1 Model (com.yahoo.config.model.api.Model)1 ModelContext (com.yahoo.config.model.api.ModelContext)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 Version (com.yahoo.config.provision.Version)1 ModelContextImpl (com.yahoo.vespa.config.server.deploy.ModelContextImpl)1 FileDistributionProvider (com.yahoo.vespa.config.server.filedistribution.FileDistributionProvider)1 Test (org.junit.Test)1