Search in sources :

Example 6 with AutoScaleRule

use of com.netflix.fenzo.AutoScaleRule in project mantis by Netflix.

the class MantisMasterAPI method setupDummyAgentClusterAutoScaler.

private static void setupDummyAgentClusterAutoScaler() {
    final AutoScaleRule dummyAutoScaleRule = new AutoScaleRule() {

        @Override
        public String getRuleName() {
            return "test";
        }

        @Override
        public int getMinIdleHostsToKeep() {
            return 1;
        }

        @Override
        public int getMaxIdleHostsToKeep() {
            return 10;
        }

        @Override
        public long getCoolDownSecs() {
            return 300;
        }

        @Override
        public boolean idleMachineTooSmall(VirtualMachineLease lease) {
            return false;
        }
    };
    AgentClustersAutoScaler.initialize(() -> new HashSet<>(Collections.singletonList(dummyAutoScaleRule)), new Observer<AutoScaleAction>() {

        @Override
        public void onCompleted() {
        }

        @Override
        public void onError(Throwable e) {
        }

        @Override
        public void onNext(AutoScaleAction autoScaleAction) {
        }
    });
}
Also used : AutoScaleRule(com.netflix.fenzo.AutoScaleRule) VirtualMachineLease(com.netflix.fenzo.VirtualMachineLease) AutoScaleAction(com.netflix.fenzo.AutoScaleAction)

Example 7 with AutoScaleRule

use of com.netflix.fenzo.AutoScaleRule in project mantis by Netflix.

the class MasterMain method setupDummyAgentClusterAutoScaler.

private static void setupDummyAgentClusterAutoScaler() {
    final AutoScaleRule dummyAutoScaleRule = new AutoScaleRule() {

        @Override
        public String getRuleName() {
            return "test";
        }

        @Override
        public int getMinIdleHostsToKeep() {
            return 1;
        }

        @Override
        public int getMaxIdleHostsToKeep() {
            return 10;
        }

        @Override
        public long getCoolDownSecs() {
            return 300;
        }

        @Override
        public boolean idleMachineTooSmall(VirtualMachineLease lease) {
            return false;
        }
    };
    AgentClustersAutoScaler.initialize(() -> new HashSet<>(Collections.singletonList(dummyAutoScaleRule)), new Observer<AutoScaleAction>() {

        @Override
        public void onCompleted() {
        }

        @Override
        public void onError(Throwable e) {
        }

        @Override
        public void onNext(AutoScaleAction autoScaleAction) {
        }
    });
}
Also used : AutoScaleRule(com.netflix.fenzo.AutoScaleRule) VirtualMachineLease(com.netflix.fenzo.VirtualMachineLease) AutoScaleAction(com.netflix.fenzo.AutoScaleAction)

Aggregations

AutoScaleRule (com.netflix.fenzo.AutoScaleRule)7 AutoScaleAction (com.netflix.fenzo.AutoScaleAction)6 VirtualMachineLease (com.netflix.fenzo.VirtualMachineLease)5 MantisScheduler (io.mantisrx.server.master.scheduler.MantisScheduler)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 TimeUnit (java.util.concurrent.TimeUnit)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 Observer (rx.Observer)3 NotUsed (akka.NotUsed)2 ActorRef (akka.actor.ActorRef)2 ConnectHttp (akka.http.javadsl.ConnectHttp)2 Http (akka.http.javadsl.Http)2 ServerBinding (akka.http.javadsl.ServerBinding)2 HttpRequest (akka.http.javadsl.model.HttpRequest)2 HttpResponse (akka.http.javadsl.model.HttpResponse)2 ActorMaterializer (akka.stream.ActorMaterializer)2 Flow (akka.stream.javadsl.Flow)2 TaskScheduler (com.netflix.fenzo.TaskScheduler)2