Java Code Examples for org.apache.mesos.Protos#MasterInfo

The following examples show how to use org.apache.mesos.Protos#MasterInfo . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Test Mesos registration handling.
 */
@Test
public void testRegistered() throws Exception {
	new Context() {{
		startResourceManager();

		Protos.MasterInfo masterInfo = Protos.MasterInfo.newBuilder()
			.setId("master1").setIp(0).setPort(5050).build();
		resourceManager.registered(new Registered(framework1, masterInfo));

		verify(rmServices.workerStore).setFrameworkID(Option.apply(framework1));
		resourceManager.connectionMonitor.expectMsgClass(Registered.class);
		resourceManager.reconciliationCoordinator.expectMsgClass(Registered.class);
		resourceManager.launchCoordinator.expectMsgClass(Registered.class);
		resourceManager.taskRouter.expectMsgClass(Registered.class);
	}};
}
 
Example 2
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Test Mesos registration handling.
 */
@Test
public void testRegistered() throws Exception {
	new Context() {{
		startResourceManager();

		Protos.MasterInfo masterInfo = Protos.MasterInfo.newBuilder()
			.setId("master1").setIp(0).setPort(5050).build();
		resourceManager.registered(new Registered(framework1, masterInfo));

		verify(rmServices.workerStore).setFrameworkID(Option.apply(framework1));
		resourceManager.connectionMonitor.expectMsgClass(Registered.class);
		resourceManager.reconciliationCoordinator.expectMsgClass(Registered.class);
		resourceManager.launchCoordinator.expectMsgClass(Registered.class);
		resourceManager.taskRouter.expectMsgClass(Registered.class);
	}};
}
 
Example 3
Source File: MesosResourceManagerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Test Mesos re-registration handling.
 */
@Test
public void testReRegistered() throws Exception {
	new Context() {{
		when(rmServices.workerStore.getFrameworkID()).thenReturn(Option.apply(framework1));
		startResourceManager();

		Protos.MasterInfo masterInfo = Protos.MasterInfo.newBuilder()
			.setId("master1").setIp(0).setPort(5050).build();
		resourceManager.reregistered(new ReRegistered(masterInfo));

		resourceManager.connectionMonitor.expectMsgClass(ReRegistered.class);
		resourceManager.reconciliationCoordinator.expectMsgClass(ReRegistered.class);
		resourceManager.launchCoordinator.expectMsgClass(ReRegistered.class);
		resourceManager.taskRouter.expectMsgClass(ReRegistered.class);
	}};
}
 
Example 4
Source File: MesosResourceManagerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Test Mesos registration handling.
 */
@Test
public void testRegistered() throws Exception {
	new Context() {{
		startResourceManager();

		Protos.MasterInfo masterInfo = Protos.MasterInfo.newBuilder()
			.setId("master1").setIp(0).setPort(5050).build();
		resourceManager.registered(new Registered(framework1, masterInfo));

		verify(rmServices.workerStore).setFrameworkID(Option.apply(framework1));
		resourceManager.connectionMonitor.expectMsgClass(Registered.class);
		resourceManager.reconciliationCoordinator.expectMsgClass(Registered.class);
		resourceManager.launchCoordinator.expectMsgClass(Registered.class);
		resourceManager.taskRouter.expectMsgClass(Registered.class);
	}};
}
 
Example 5
Source File: MesosResourceManager.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void reregistered(SchedulerDriver driver, final Protos.MasterInfo masterInfo) {
	runAsync(new Runnable() {
		@Override
		public void run() {
			MesosResourceManager.this.reregistered(new ReRegistered(masterInfo));
		}
	});
}
 
Example 6
Source File: MesosResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void reregistered(SchedulerDriver driver, final Protos.MasterInfo masterInfo) {
	runAsync(new Runnable() {
		@Override
		public void run() {
			MesosResourceManager.this.reregistered(new ReRegistered(masterInfo));
		}
	});
}
 
Example 7
Source File: TestUtils.java    From dcos-cassandra-service with Apache License 2.0 5 votes vote down vote up
public static final Protos.MasterInfo generateMasterInfo() {
    return Protos.MasterInfo.newBuilder()
            .setId(UUID.randomUUID().toString())
            .setIp(ipToInt("127.0.0.1"))
            .setPort(5050)
            .build();
}
 
Example 8
Source File: SchedulerEngine.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public void registered(final SchedulerDriver schedulerDriver, final Protos.FrameworkID frameworkID, final Protos.MasterInfo masterInfo) {
    log.info("call registered");
    frameworkIDService.save(frameworkID.getValue());
    taskScheduler.expireAllLeases();
    MesosStateService.register(masterInfo.getHostname(), masterInfo.getPort());
}
 
Example 9
Source File: CassandraScheduler.java    From dcos-cassandra-service with Apache License 2.0 5 votes vote down vote up
@Override
public void reregistered(SchedulerDriver driver,
                         Protos.MasterInfo masterInfo) {
    LOGGER.info("Re-registered with master: {}", masterInfo);
    reconciler.start();
    suppressOrRevive();
}
 
Example 10
Source File: Registered.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public Registered(Protos.FrameworkID frameworkId, Protos.MasterInfo masterInfo) {
	requireNonNull(frameworkId);
	requireNonNull(masterInfo);

	this.frameworkId = frameworkId;
	this.masterInfo = masterInfo;
}
 
Example 11
Source File: ReRegisteredEvent.java    From incubator-myriad with Apache License 2.0 4 votes vote down vote up
public Protos.MasterInfo getMasterInfo() {
  return masterInfo;
}
 
Example 12
Source File: CassandraScheduler.java    From dcos-cassandra-service with Apache License 2.0 4 votes vote down vote up
@Override
public void registered(SchedulerDriver driver,
                       Protos.FrameworkID frameworkId,
                       Protos.MasterInfo masterInfo) {
    // Call re-register and return early if registered() has already been called once
    // in the lifetime of this object.
    if (!isSchedulerRegistered.compareAndSet(false, true)) {
        LOGGER.info("Scheduler is already registered, calling reregistered()");
        reregistered(driver, masterInfo);
        return;
    }

    // The following is executed only once in the lifetime of this object.
    final String frameworkIdValue = frameworkId.getValue();
    LOGGER.info("Framework registered : id = {}", frameworkIdValue);
    try {
        CassandraScheduler.taskKiller = new DefaultTaskKiller(
                stateStore,
                new DefaultTaskFailureListener(stateStore),
                driver);
        this.planScheduler = new DefaultPlanScheduler(offerAccepter, new OfferEvaluator(stateStore), taskKiller);
        stateStore.storeFrameworkId(frameworkId);
        Plan plan = new CassandraPlan(
                defaultConfigurationManager,
                ReconciliationPhase.create(reconciler),
                SyncDataCenterPhase.create(seeds, executor),
                CassandraDaemonPhase.create(
                        cassandraState, offerRequirementProvider, client, defaultConfigurationManager),
                Arrays.asList(
                        backup, restore, cleanup, repair, upgrade));
        plan.subscribe(this);
        planManager = new DefaultPlanManager(plan);
        reconciler.start();
        suppressOrRevive();
        // use add() to just throw if full:
        resourcesQueue.add(Arrays.asList(
                new ServiceConfigResource(configurationManager),
                new SeedsResource(seeds),
                new ConfigurationResource(defaultConfigurationManager),
                new TasksResource(capabilities, cassandraState, client, configurationManager),
                new PlansResource(ImmutableMap.of("deploy", planManager)), // TODO(nick) include recovery
                new BackupResource(backup),
                new RestoreResource(restore),
                new CleanupResource(cleanup),
                new RepairResource(repair),
                new UpgradeSSTableResource(upgrade, enableUpgradeSSTableEndpoint),
                new DataCenterResource(seeds),
                new ConnectionResource(capabilities, cassandraState, configurationManager),
                // TODO(nick) rename upstream to StringPropertyDeserializer:
                new StateResource(stateStore, new JsonPropertyDeserializer())));
    } catch (Throwable t) {
        String error = "An error occurred when registering " +
                "the framework and initializing the execution plan.";
        LOGGER.error(error, t);
        throw new RuntimeException(error, t);
    }
}
 
Example 13
Source File: ReRegistered.java    From flink with Apache License 2.0 4 votes vote down vote up
public Protos.MasterInfo masterInfo() {
	return masterInfo;
}
 
Example 14
Source File: MyriadScheduler.java    From myriad with Apache License 2.0 4 votes vote down vote up
@Override
public void reregistered(SchedulerDriver driver, Protos.MasterInfo mi) {
	LOGGER.info("Framework reregistered!");
}
 
Example 15
Source File: Registered.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Protos.MasterInfo masterInfo() {
	return masterInfo;
}
 
Example 16
Source File: ReRegistered.java    From flink with Apache License 2.0 4 votes vote down vote up
public ReRegistered(Protos.MasterInfo masterInfo) {
	requireNonNull(masterInfo);

	this.masterInfo = masterInfo;
}
 
Example 17
Source File: ReRegistered.java    From flink with Apache License 2.0 4 votes vote down vote up
public Protos.MasterInfo masterInfo() {
	return masterInfo;
}
 
Example 18
Source File: SchedulerProxy.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void reregistered(SchedulerDriver driver, Protos.MasterInfo masterInfo) {
	mesosActor.tell(new ReRegistered(masterInfo), ActorRef.noSender());
}
 
Example 19
Source File: SchedulerProxy.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void reregistered(SchedulerDriver driver, Protos.MasterInfo masterInfo) {
	mesosActor.tell(new ReRegistered(masterInfo), ActorRef.noSender());
}
 
Example 20
Source File: MesosScheduler.java    From twister2 with Apache License 2.0 4 votes vote down vote up
@Override
public void registered(SchedulerDriver schedulerDriver,
                       Protos.FrameworkID frameworkID, Protos.MasterInfo masterInfo) {
  LOG.info("Registered" + frameworkID);
}