Search in sources :

Example 1 with ZooKeeperDeployer

use of com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer in project vespa by vespa-engine.

the class SessionPreparer method writeStateToZooKeeper.

private void writeStateToZooKeeper(SessionZooKeeperClient zooKeeperClient, ApplicationPackage applicationPackage, ApplicationId applicationId, com.yahoo.component.Version vespaVersion, DeployLogger deployLogger, Map<Version, FileRegistry> fileRegistryMap, AllocatedHosts allocatedHosts) {
    ZooKeeperDeployer zkDeployer = zooKeeperClient.createDeployer(deployLogger);
    try {
        zkDeployer.deploy(applicationPackage, fileRegistryMap, allocatedHosts);
        zooKeeperClient.writeApplicationId(applicationId);
        zooKeeperClient.writeVespaVersion(vespaVersion);
    } catch (RuntimeException | IOException e) {
        zkDeployer.cleanup();
        throw new RuntimeException("Error preparing session", e);
    }
}
Also used : ZooKeeperDeployer(com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer) IOException(java.io.IOException)

Example 2 with ZooKeeperDeployer

use of com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer in project vespa by vespa-engine.

the class TenantRequestHandlerTest method feedApp.

private void feedApp(File appDir, long sessionId, ApplicationId appId) throws IOException {
    SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, Tenants.getSessionsPath(tenant).append(String.valueOf(sessionId)), new TestConfigDefinitionRepo(), "", Optional.empty());
    zkc.writeApplicationId(appId);
    File app = tempFolder.newFolder();
    IOUtils.copyDirectory(appDir, app);
    ZooKeeperDeployer deployer = zkc.createDeployer(new BaseDeployLogger());
    deployer.deploy(FilesApplicationPackage.fromFile(appDir), Collections.singletonMap(vespaVersion, new MockFileRegistry()), AllocatedHosts.withHosts(Collections.emptySet()));
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) ZooKeeperDeployer(com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer) TestConfigDefinitionRepo(com.yahoo.vespa.config.server.TestConfigDefinitionRepo) File(java.io.File) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry) SessionZooKeeperClient(com.yahoo.vespa.config.server.session.SessionZooKeeperClient)

Aggregations

ZooKeeperDeployer (com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer)2 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)1 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)1 TestConfigDefinitionRepo (com.yahoo.vespa.config.server.TestConfigDefinitionRepo)1 SessionZooKeeperClient (com.yahoo.vespa.config.server.session.SessionZooKeeperClient)1 File (java.io.File)1 IOException (java.io.IOException)1