Search in sources :

Example 1 with SimpleCachedFileStorageProvider

use of io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider in project mantis by Netflix.

the class AgentClustersRouteTest method setup.

@BeforeClass
public void setup() throws InterruptedException {
    TestHelpers.setupMasterConfig();
    final CountDownLatch latch = new CountDownLatch(1);
    t = new Thread(() -> {
        try {
            // boot up server using the route as defined below
            final Http http = Http.get(system);
            final ActorMaterializer materializer = ActorMaterializer.create(system);
            IMantisStorageProvider storageProvider = new SimpleCachedFileStorageProvider(true);
            final LifecycleEventPublisher lifecycleEventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl());
            ActorRef jobClustersManagerActor = system.actorOf(JobClustersManagerActor.props(new MantisJobStore(storageProvider), lifecycleEventPublisher), "jobClustersManager");
            MantisScheduler fakeScheduler = new FakeMantisScheduler(jobClustersManagerActor);
            jobClustersManagerActor.tell(new JobClusterManagerProto.JobClustersManagerInitialize(fakeScheduler, false), ActorRef.noSender());
            setupDummyAgentClusterAutoScaler();
            final AgentClustersRoute agentClusterV2Route = new AgentClustersRoute(new AgentClusterOperationsImpl(storageProvider, new JobMessageRouterImpl(jobClustersManagerActor), fakeScheduler, lifecycleEventPublisher, "cluster"));
            final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = agentClusterV2Route.createRoute(Function.identity()).flow(system, materializer);
            logger.info("test server starting on port {}", serverPort);
            latch.countDown();
            binding = http.bindAndHandle(routeFlow, ConnectHttp.toHost("localhost", serverPort), materializer);
        } catch (Exception e) {
            logger.info("caught exception", e);
            latch.countDown();
            e.printStackTrace();
        }
    });
    t.setDaemon(true);
    t.start();
    latch.await();
}
Also used : FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) IMantisStorageProvider(io.mantisrx.server.master.persistence.IMantisStorageProvider) StatusEventSubscriberLoggingImpl(io.mantisrx.master.events.StatusEventSubscriberLoggingImpl) ActorRef(akka.actor.ActorRef) Http(akka.http.javadsl.Http) ConnectHttp(akka.http.javadsl.ConnectHttp) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) CountDownLatch(java.util.concurrent.CountDownLatch) IOException(java.io.IOException) ActorMaterializer(akka.stream.ActorMaterializer) Flow(akka.stream.javadsl.Flow) AuditEventSubscriberLoggingImpl(io.mantisrx.master.events.AuditEventSubscriberLoggingImpl) JobMessageRouterImpl(io.mantisrx.master.scheduler.JobMessageRouterImpl) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) LifecycleEventPublisherImpl(io.mantisrx.master.events.LifecycleEventPublisherImpl) AgentClusterOperationsImpl(io.mantisrx.master.vm.AgentClusterOperationsImpl) SimpleCachedFileStorageProvider(io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider) WorkerEventSubscriberLoggingImpl(io.mantisrx.master.events.WorkerEventSubscriberLoggingImpl) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with SimpleCachedFileStorageProvider

use of io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider in project mantis by Netflix.

the class JobClusterRouteTest method setup.

@BeforeClass
public static void setup() throws Exception {
    TestHelpers.setupMasterConfig();
    final CountDownLatch latch = new CountDownLatch(1);
    t = new Thread(() -> {
        try {
            // boot up server using the route as defined below
            final Http http = Http.get(system);
            final ActorMaterializer materializer = ActorMaterializer.create(system);
            final LifecycleEventPublisher lifecycleEventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl());
            ActorRef jobClustersManagerActor = system.actorOf(JobClustersManagerActor.props(new MantisJobStore(new SimpleCachedFileStorageProvider(true)), lifecycleEventPublisher), "jobClustersManager");
            MantisScheduler fakeScheduler = new FakeMantisScheduler(jobClustersManagerActor);
            jobClustersManagerActor.tell(new JobClusterManagerProto.JobClustersManagerInitialize(fakeScheduler, false), ActorRef.noSender());
            final JobClusterRouteHandler jobClusterRouteHandler = new JobClusterRouteHandlerAkkaImpl(jobClustersManagerActor);
            final JobRouteHandler jobRouteHandler = new JobRouteHandlerAkkaImpl(jobClustersManagerActor);
            final JobClusterRoute app = new JobClusterRoute(jobClusterRouteHandler, jobRouteHandler, system);
            final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = app.createRoute(Function.identity()).flow(system, materializer);
            logger.info("starting test server on port {}", serverPort);
            binding = http.bindAndHandle(routeFlow, ConnectHttp.toHost("localhost", serverPort), materializer);
            latch.countDown();
        } catch (Exception e) {
            logger.info("caught exception", e);
            latch.countDown();
            e.printStackTrace();
        }
    });
    t.setDaemon(true);
    t.start();
    latch.await();
}
Also used : JobClusterRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandler) JobRouteHandlerAkkaImpl(io.mantisrx.master.api.akka.route.handlers.JobRouteHandlerAkkaImpl) JobRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobRouteHandler) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) StatusEventSubscriberLoggingImpl(io.mantisrx.master.events.StatusEventSubscriberLoggingImpl) ActorRef(akka.actor.ActorRef) JobClusterRouteHandlerAkkaImpl(io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandlerAkkaImpl) Http(akka.http.javadsl.Http) ConnectHttp(akka.http.javadsl.ConnectHttp) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) CountDownLatch(java.util.concurrent.CountDownLatch) IOException(java.io.IOException) ActorMaterializer(akka.stream.ActorMaterializer) Flow(akka.stream.javadsl.Flow) AuditEventSubscriberLoggingImpl(io.mantisrx.master.events.AuditEventSubscriberLoggingImpl) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) LifecycleEventPublisherImpl(io.mantisrx.master.events.LifecycleEventPublisherImpl) SimpleCachedFileStorageProvider(io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider) WorkerEventSubscriberLoggingImpl(io.mantisrx.master.events.WorkerEventSubscriberLoggingImpl) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with SimpleCachedFileStorageProvider

use of io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider in project mantis by Netflix.

the class AgentClusterRouteTest method setup.

@BeforeClass
public static void setup() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    t = new Thread(() -> {
        try {
            // boot up server using the route as defined below
            final Http http = Http.get(system);
            final ActorMaterializer materializer = ActorMaterializer.create(system);
            IMantisStorageProvider storageProvider = new SimpleCachedFileStorageProvider(true);
            final LifecycleEventPublisher lifecycleEventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl());
            ActorRef jobClustersManagerActor = system.actorOf(JobClustersManagerActor.props(new MantisJobStore(storageProvider), lifecycleEventPublisher), "jobClustersManager");
            MantisScheduler fakeScheduler = new FakeMantisScheduler(jobClustersManagerActor);
            jobClustersManagerActor.tell(new JobClusterManagerProto.JobClustersManagerInitialize(fakeScheduler, false), ActorRef.noSender());
            setupDummyAgentClusterAutoScaler();
            final AgentClusterRoute v0AgentClusterRoute = new AgentClusterRoute(new AgentClusterOperationsImpl(storageProvider, new JobMessageRouterImpl(jobClustersManagerActor), fakeScheduler, lifecycleEventPublisher, "cluster"), system);
            final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = v0AgentClusterRoute.createRoute(Function.identity()).flow(system, materializer);
            logger.info("test server starting on port {}", serverPort);
            binding = http.bindAndHandle(routeFlow, ConnectHttp.toHost("localhost", serverPort), materializer);
            latch.countDown();
        } catch (Exception e) {
            logger.info("caught exception", e);
            latch.countDown();
            e.printStackTrace();
        }
    });
    t.setDaemon(true);
    t.start();
    latch.await();
}
Also used : FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) IMantisStorageProvider(io.mantisrx.server.master.persistence.IMantisStorageProvider) StatusEventSubscriberLoggingImpl(io.mantisrx.master.events.StatusEventSubscriberLoggingImpl) ActorRef(akka.actor.ActorRef) Http(akka.http.javadsl.Http) ConnectHttp(akka.http.javadsl.ConnectHttp) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) CountDownLatch(java.util.concurrent.CountDownLatch) IOException(java.io.IOException) ActorMaterializer(akka.stream.ActorMaterializer) Flow(akka.stream.javadsl.Flow) AuditEventSubscriberLoggingImpl(io.mantisrx.master.events.AuditEventSubscriberLoggingImpl) JobMessageRouterImpl(io.mantisrx.master.scheduler.JobMessageRouterImpl) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) LifecycleEventPublisherImpl(io.mantisrx.master.events.LifecycleEventPublisherImpl) AgentClusterOperationsImpl(io.mantisrx.master.vm.AgentClusterOperationsImpl) SimpleCachedFileStorageProvider(io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider) WorkerEventSubscriberLoggingImpl(io.mantisrx.master.events.WorkerEventSubscriberLoggingImpl) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with SimpleCachedFileStorageProvider

use of io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider in project mantis by Netflix.

the class JobClustersRouteTest method setup.

@BeforeClass
public void setup() throws Exception {
    TestHelpers.setupMasterConfig();
    final CountDownLatch latch = new CountDownLatch(1);
    t = new Thread(() -> {
        try {
            // boot up server using the route as defined below
            final Http http = Http.get(system);
            final ActorMaterializer materializer = ActorMaterializer.create(system);
            final LifecycleEventPublisher lifecycleEventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl());
            ActorRef jobClustersManagerActor = system.actorOf(JobClustersManagerActor.props(new MantisJobStore(new SimpleCachedFileStorageProvider(true)), lifecycleEventPublisher), "jobClustersManager");
            MantisScheduler fakeScheduler = new FakeMantisScheduler(jobClustersManagerActor);
            jobClustersManagerActor.tell(new JobClusterManagerProto.JobClustersManagerInitialize(fakeScheduler, false), ActorRef.noSender());
            final JobClusterRouteHandler jobClusterRouteHandler = new JobClusterRouteHandlerAkkaImpl(jobClustersManagerActor);
            final JobClustersRoute app = new JobClustersRoute(jobClusterRouteHandler, system);
            final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = app.createRoute(Function.identity()).flow(system, materializer);
            logger.info("starting test server on port {}", SERVER_PORT);
            latch.countDown();
            binding = http.bindAndHandle(routeFlow, ConnectHttp.toHost("localhost", SERVER_PORT), materializer);
        } catch (Exception e) {
            logger.info("caught exception", e);
            latch.countDown();
            e.printStackTrace();
        }
    });
    t.setDaemon(true);
    t.start();
    latch.await();
}
Also used : JobClusterRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandler) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) ActorRef(akka.actor.ActorRef) JobClusterRouteHandlerAkkaImpl(io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandlerAkkaImpl) Http(akka.http.javadsl.Http) ConnectHttp(akka.http.javadsl.ConnectHttp) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) CountDownLatch(java.util.concurrent.CountDownLatch) IOException(java.io.IOException) ActorMaterializer(akka.stream.ActorMaterializer) Flow(akka.stream.javadsl.Flow) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) SimpleCachedFileStorageProvider(io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

ActorRef (akka.actor.ActorRef)4 ConnectHttp (akka.http.javadsl.ConnectHttp)4 Http (akka.http.javadsl.Http)4 ActorMaterializer (akka.stream.ActorMaterializer)4 Flow (akka.stream.javadsl.Flow)4 FakeMantisScheduler (io.mantisrx.master.scheduler.FakeMantisScheduler)4 MantisJobStore (io.mantisrx.server.master.persistence.MantisJobStore)4 SimpleCachedFileStorageProvider (io.mantisrx.server.master.persistence.SimpleCachedFileStorageProvider)4 MantisScheduler (io.mantisrx.server.master.scheduler.MantisScheduler)4 IOException (java.io.IOException)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 BeforeClass (org.testng.annotations.BeforeClass)4 AuditEventSubscriberLoggingImpl (io.mantisrx.master.events.AuditEventSubscriberLoggingImpl)3 LifecycleEventPublisher (io.mantisrx.master.events.LifecycleEventPublisher)3 LifecycleEventPublisherImpl (io.mantisrx.master.events.LifecycleEventPublisherImpl)3 StatusEventSubscriberLoggingImpl (io.mantisrx.master.events.StatusEventSubscriberLoggingImpl)3 WorkerEventSubscriberLoggingImpl (io.mantisrx.master.events.WorkerEventSubscriberLoggingImpl)3 JobClusterRouteHandler (io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandler)2 JobClusterRouteHandlerAkkaImpl (io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandlerAkkaImpl)2 JobMessageRouterImpl (io.mantisrx.master.scheduler.JobMessageRouterImpl)2