Search in sources :

Example 1 with PollingStrategy

use of io.cdap.cdap.runtime.spi.provisioner.PollingStrategy in project cdap by caskdata.

the class DataprocProvisioner method getPollingStrategy.

@Override
public PollingStrategy getPollingStrategy(ProvisionerContext context, Cluster cluster) {
    DataprocConf conf = DataprocConf.create(createContextProperties(context));
    PollingStrategy strategy = PollingStrategies.fixedInterval(conf.getPollInterval(), TimeUnit.SECONDS);
    switch(cluster.getStatus()) {
        case CREATING:
            return PollingStrategies.initialDelay(strategy, conf.getPollCreateDelay(), conf.getPollCreateJitter(), TimeUnit.SECONDS);
        case DELETING:
            return PollingStrategies.initialDelay(strategy, conf.getPollDeleteDelay(), TimeUnit.SECONDS);
    }
    LOG.warn("Received a request to get the polling strategy for unexpected cluster status {}", cluster.getStatus());
    return strategy;
}
Also used : PollingStrategy(io.cdap.cdap.runtime.spi.provisioner.PollingStrategy)

Aggregations

PollingStrategy (io.cdap.cdap.runtime.spi.provisioner.PollingStrategy)1