All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.hosted.provision.maintenance.InfrastructureProvisioner Maven / Gradle / Ivy

There is a newer version: 8.458.13
Show newest version
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.maintenance;

import com.yahoo.config.provision.InfraDeployer;
import com.yahoo.log.LogLevel;
import com.yahoo.vespa.hosted.provision.NodeRepository;

import java.time.Duration;
import java.util.logging.Logger;

/**
 * Periodically deploys infrastructure applications.
 * TODO: Merge this with {@link PeriodicApplicationMaintainer}
 *
 * @author freva
 */
public class InfrastructureProvisioner extends Maintainer {

    private static final Logger logger = Logger.getLogger(InfrastructureProvisioner.class.getName());

    private final InfraDeployer infraDeployer;

    InfrastructureProvisioner(NodeRepository nodeRepository, InfraDeployer infraDeployer, Duration interval) {
        super(nodeRepository, interval);
        this.infraDeployer = infraDeployer;
    }

    @Override
    protected void maintain() {
        infraDeployer.getSupportedInfraDeployments().forEach((application, deployment) -> {
            try {
                deployment.activate();
            } catch (RuntimeException e) {
                logger.log(LogLevel.INFO, "Failed to activate " + application, e);
                // loop around to activate the next application
            }
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy