protected ActorRef createConnectionMonitor() { return actorSystem.actorOf( ConnectionMonitor.createActorProps(ConnectionMonitor.class, flinkConfig), "connectionMonitor"); }
protected ActorRef createTaskMonitor(SchedulerDriver schedulerDriver) { return actorSystem.actorOf( Tasks.createActorProps(Tasks.class, selfActor, flinkConfig, schedulerDriver, TaskMonitor.class), "tasks"); }
protected ActorRef createReconciliationCoordinator(SchedulerDriver schedulerDriver) { return actorSystem.actorOf( ReconciliationCoordinator.createActorProps(ReconciliationCoordinator.class, flinkConfig, schedulerDriver), "reconciliationCoordinator"); }
protected ActorRef createSelfActor() { return actorSystem.actorOf( Props.create(AkkaAdapter.class, this), "ResourceManager"); }
ActorSystem system = ActorSystem.create("PiSystem"); final ActorRef listener = system.actorOf(Props.create(Listener.class), "listener"); ActorRef master = system.actorOf(Props.create(Master.class, nrOfWorkers, nrOfMessages, nrOfElements, listener), "master"); master.tell(new Calculate(), ActorRef.noSender());
ActorSystem system = ActorSystem.create("PiSystem"); final ActorRef listener = system.actorOf(Props.create(Listener.class), "listener"); ActorRef master = system.actorOf(Props.create(new MasterCreator(nrOfWorkers, nrOfMessages, nrOfElements, listener)), "master"); master.tell(new Calculate(), ActorRef.noSender());
private void subscribeToReservations( ActorSystem localSystem ) { logger.info("Starting ReservationCacheUpdater"); localSystem.actorOf( Props.create( ReservationCacheActor.class ), "subscriber"); }
protected ActorRef createLaunchCoordinator( SchedulerDriver schedulerDriver, ActorRef selfActor) { return actorSystem.actorOf( LaunchCoordinator.createActorProps(LaunchCoordinator.class, selfActor, flinkConfig, schedulerDriver, createOptimizer()), "launchCoordinator"); }
/** * Create ClientActor for each region. */ private void createClientActors( ActorSystem system ) { for ( String region : getSeedsByRegion().keySet() ) { if ( currentRegion.equals( region )) { logger.info( "Creating clientActor for region [{}]", region ); // Each clientActor needs to know path to ClusterSingletonProxy and region clientActor = system.actorOf( Props.create( ClientActor.class, routersByMessageType ), "clientActor" ); ClusterClientReceptionist.get(system).registerService( clientActor ); } else { logger.info( "Creating clusterClient for region [{}]", region ); Set<ActorPath> seedPaths = new HashSet<>(20); for ( String seed : getSeedsByRegion().get( region ) ) { seedPaths.add( ActorPaths.fromString( seed + "/system/receptionist") ); } ActorRef clusterClient = system.actorOf( ClusterClient.props( ClusterClientSettings.create(system).withInitialContacts( seedPaths )), "client-"+region); clusterClientsByRegion.put( region, clusterClient ); } } }
private void initAkka() { logger.info("Initializing Akka"); // Create one actor system with request actor for each region if ( StringUtils.isEmpty( currentRegion )) { throw new RuntimeException( "No value specified for: " + ActorSystemFig.CLUSTER_REGIONS_LOCAL ); } if ( StringUtils.isEmpty( actorSystemFig.getRegionsList() )) { throw new RuntimeException( "No value specified for: " + ActorSystemFig.CLUSTER_REGIONS_LIST ); } if ( StringUtils.isEmpty( actorSystemFig.getSeeds() )) { throw new RuntimeException( "No value specified for: " + ActorSystemFig.CLUSTER_SEEDS ); } List regionList = Arrays.asList( actorSystemFig.getRegionsList().toLowerCase().split(",") ); logger.info("Initializing Akka for hostname {} region {} regionList {} seeds {}", hostname, currentRegion, regionList, actorSystemFig.getSeeds() ); Config config = createConfiguration(); clusterSystem = createClusterSystem( config ); // register our cluster listener clusterSystem.actorOf(Props.create(ClusterListener.class, getSeedsByRegion(), getCurrentRegion()), "clusterListener" ); createClientActors( clusterSystem ); mediator = DistributedPubSub.get( clusterSystem ).mediator(); }
/** * Creates a new ApplicationClient actor or returns an existing one. May start an ActorSystem. * @return ActorSystem */ public ActorRef get() throws FlinkException { if (applicationClient == null) { // start application client LOG.info("Start application client."); final ActorSystem actorSystem; try { actorSystem = actorSystemLoader.get(); } catch (FlinkException fle) { throw new FlinkException("Could not start the ClusterClient's ActorSystem.", fle); } try { applicationClient = actorSystem.actorOf( Props.create( ApplicationClient.class, flinkConfig, highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID)), "applicationClient"); } catch (Exception e) { throw new FlinkException("Could not start the ApplicationClient.", e); } } return applicationClient; } }
@Override public void produceRouter(ActorSystem system, String role) { ClusterSingletonManagerSettings settings = ClusterSingletonManagerSettings.create( system ).withRole( "io" ); system.actorOf( ClusterSingletonManager.props( Props.create( GuiceActorProducer.class, QueueWriterRouter.class ), PoisonPill.getInstance(), settings ), "queueWriterRouter" ); ClusterSingletonProxySettings proxySettings = ClusterSingletonProxySettings.create( system ).withRole( role ); system.actorOf( ClusterSingletonProxy.props( "/user/queueWriterRouter", proxySettings ), "queueWriterRouterProxy" ); }
@Override public void produceRouter(ActorSystem system, String role) { ClusterSingletonManagerSettings settings = ClusterSingletonManagerSettings.create( system ).withRole( "io" ); system.actorOf( ClusterSingletonManager.props( Props.create( GuiceActorProducer.class, QueueActorRouter.class ), PoisonPill.getInstance(), settings ), "queueActorRouter" ); ClusterSingletonProxySettings proxySettings = ClusterSingletonProxySettings.create( system ).withRole( role ); system.actorOf( ClusterSingletonProxy.props( "/user/queueActorRouter", proxySettings ), "queueActorRouterProxy" ); }
@Override public void produceRouter(ActorSystem system, String role) { ClusterSingletonManagerSettings settings = ClusterSingletonManagerSettings.create( system ).withRole( "io" ); system.actorOf( ClusterSingletonManager.props( Props.create( GuiceActorProducer.class, QueueSenderRouter.class ), PoisonPill.getInstance(), settings ), "queueSenderRouter" ); ClusterSingletonProxySettings proxySettings = ClusterSingletonProxySettings.create( system ).withRole( role ); system.actorOf( ClusterSingletonProxy.props( "/user/queueSenderRouter", proxySettings ), "queueSenderRouterProxy" ); }
@Override public void produceRouter( ActorSystem system, String role ) { ClusterSingletonManagerSettings settings = ClusterSingletonManagerSettings.create( system ).withRole("io"); system.actorOf( ClusterSingletonManager.props( Props.create( GuiceActorProducer.class, UniqueValuesRouter.class ), PoisonPill.getInstance(), settings ), "uvRouter" ); ClusterSingletonProxySettings proxySettings = ClusterSingletonProxySettings.create( system ).withRole( role ); system.actorOf( ClusterSingletonProxy.props( "/user/uvRouter", proxySettings ), "uvProxy" ); subscribeToReservations( system ); }
public void tryLocalExecution() { try { jobManagerSystem.actorOf( Props.create(SuccessReturningActor.class), JobMaster.JOB_MANAGER_NAME);
/** * This test verifies correct job submission messaging logic and plan translation calls. */ @Test public void shouldSubmitToJobClient() throws Exception { jobManagerSystem.actorOf( Props.create(SuccessReturningActor.class), JobMaster.JOB_MANAGER_NAME); StandaloneClusterClient out = new StandaloneClusterClient(config); out.setDetached(true); JobSubmissionResult result = out.run(program.getPlanWithJars(), 1); assertNotNull(result); program.deleteExtractedLibraries(); }
/** * This test verifies correct that the correct exception is thrown when the job submission fails. */ @Test public void shouldSubmitToJobClientFails() throws Exception { jobManagerSystem.actorOf( Props.create(FailureReturningActor.class), JobMaster.JOB_MANAGER_NAME); StandaloneClusterClient out = new StandaloneClusterClient(config); out.setDetached(true); try { out.run(program.getPlanWithJars(), 1); fail("This should fail with an exception"); } catch (ProgramInvocationException e) { // bam! } catch (Exception e) { fail("wrong exception " + e); } }
@Test public void testGetExecutionPlan() { try { jobManagerSystem.actorOf( Props.create(FailureReturningActor.class), JobMaster.JOB_MANAGER_NAME); PackagedProgram prg = new PackagedProgram(TestOptimizerPlan.class, "/dev/random", "/tmp"); assertNotNull(prg.getPreviewPlan()); Optimizer optimizer = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), config); OptimizedPlan op = (OptimizedPlan) ClusterClient.getOptimizedPlan(optimizer, prg, 1); assertNotNull(op); PlanJSONDumpGenerator dumper = new PlanJSONDumpGenerator(); assertNotNull(dumper.getOptimizerPlanAsJSON(op)); // test HTML escaping PlanJSONDumpGenerator dumper2 = new PlanJSONDumpGenerator(); dumper2.setEncodeForHTML(true); String htmlEscaped = dumper2.getOptimizerPlanAsJSON(op); assertEquals(-1, htmlEscaped.indexOf('\\')); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
actorRef = actorSystem.actorOf( Props.create( JobClientActorTest.PlainActor.class,