本文整理汇总了Java中org.apache.mesos.Protos.FrameworkInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Protos.FrameworkInfo方法的具体用法?Java Protos.FrameworkInfo怎么用?Java Protos.FrameworkInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mesos.Protos
的用法示例。
在下文中一共展示了Protos.FrameworkInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSchedulerDriver
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private SchedulerDriver getSchedulerDriver(final TaskScheduler taskScheduler, final JobEventBus jobEventBus, final FrameworkIDService frameworkIDService) {
Optional<String> frameworkIDOptional = frameworkIDService.fetch();
Protos.FrameworkInfo.Builder builder = Protos.FrameworkInfo.newBuilder();
if (frameworkIDOptional.isPresent()) {
builder.setId(Protos.FrameworkID.newBuilder().setValue(frameworkIDOptional.get()).build());
}
Optional<String> role = env.getMesosRole();
String frameworkName = MesosConfiguration.FRAMEWORK_NAME;
if (role.isPresent()) {
builder.setRole(role.get());
frameworkName += "-" + role.get();
}
builder.addCapabilitiesBuilder().setType(Protos.FrameworkInfo.Capability.Type.PARTITION_AWARE);
MesosConfiguration mesosConfig = env.getMesosConfiguration();
Protos.FrameworkInfo frameworkInfo = builder.setUser(mesosConfig.getUser()).setName(frameworkName)
.setHostname(mesosConfig.getHostname()).setFailoverTimeout(MesosConfiguration.FRAMEWORK_FAILOVER_TIMEOUT_SECONDS)
.setWebuiUrl(WEB_UI_PROTOCOL + env.getFrameworkHostPort()).setCheckpoint(true).build();
return new MesosSchedulerDriver(new SchedulerEngine(taskScheduler, facadeService, jobEventBus, frameworkIDService, statisticManager), frameworkInfo, mesosConfig.getUrl());
}
示例2: before
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Before
public void before() throws Throwable {
mapper = new ObjectMapper();
mapper.registerModule(new Jdk8Module());
Protos.FrameworkInfo frameworkInfo = Protos.FrameworkInfo.newBuilder()
.setUser("")
.setName(RetzScheduler.FRAMEWORK_NAME)
.build();
InputStream in = Launcher.class.getResourceAsStream("/retz.properties");
Launcher.Configuration conf = new Launcher.Configuration(new ServerConfiguration(in));
Database.getInstance().init(conf.getServerConfig());
scheduler = new RetzScheduler(conf, frameworkInfo);
driver = new MesosSchedulerDummyDriver(scheduler, frameworkInfo, conf.getMesosMaster());
}
示例3: registered
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(final ExecutorDriver executorDriver, final Protos.ExecutorInfo executorInfo, final Protos.FrameworkInfo frameworkInfo, final Protos.SlaveInfo slaveInfo) {
if (!executorInfo.getData().isEmpty()) {
Map<String, String> data = SerializationUtils.deserialize(executorInfo.getData().toByteArray());
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(data.get("event_trace_rdb_driver"));
dataSource.setUrl(data.get("event_trace_rdb_url"));
dataSource.setPassword(data.get("event_trace_rdb_password"));
dataSource.setUsername(data.get("event_trace_rdb_username"));
jobEventBus = new JobEventBus(new JobEventRdbConfiguration(dataSource));
}
}
示例4: registered
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(ExecutorDriver driver, Protos.ExecutorInfo executorInfo, Protos.FrameworkInfo frameworkInfo, Protos.SlaveInfo slaveInfo) {
final String[] bootConfig = executorInfo.getData().toStringUtf8().split(";");
this.dcosAuthToken = nullOnEmpty(bootConfig[0]);
this.metricsContainersEnabled = Boolean.parseBoolean(bootConfig[1]);
slaveId = slaveInfo.getId().getValue();
System.out.println("HumioExecutor.registered");
}
示例5: Framework
import org.apache.mesos.Protos; //导入方法依赖的package包/类
/**
* Constructor for the framework
*
* @param processor
* The processor that this framework is responsible for
* @param configuration
* Configuration that came from environment variables
*/
public Framework(Processor processor, Configuration configuration) {
this.configuration = configuration;
this.leasesQueue = new LinkedBlockingQueue<>();
scheduler = new TaskScheduler.Builder().withLeaseOfferExpirySecs(10)
.withLeaseRejectAction(new Action1<VirtualMachineLease>() {
@Override
public void call(VirtualMachineLease lease) {
LOG.trace("Declining offer on " + lease.hostname());
ref.get().declineOffer(lease.getOffer().getId());
}
}).build();
// Construct the Framework
String frameworkName = configuration.frameworkName + "_" + processor.name + "_" + VERSION;
Protos.FrameworkInfo framework = Protos.FrameworkInfo.newBuilder().setName(frameworkName).setUser("").build();
// Build the Kafka components
input = new KafkaInput(this, configuration, processor);
output = new KafkaOutput(this, configuration, processor);
// Build the Scheduler
Scheduler mesosScheduler = new MesosScheduler(scheduler, leasesQueue, input, this);
mesosSchedulerDriver = new MesosSchedulerDriver(mesosScheduler, framework, configuration.mesosMaster);
ref.set(mesosSchedulerDriver);
}
示例6: runScheduler
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private static void runScheduler(
Scheduler mesosScheduler, ServiceSpec serviceSpec, SchedulerConfig schedulerConfig, StateStore stateStore) {
Protos.FrameworkInfo frameworkInfo = getFrameworkInfo(serviceSpec, stateStore);
LOGGER.info("Registering framework: {}", TextFormat.shortDebugString(frameworkInfo));
String zkUri = String.format("zk://%s/mesos", serviceSpec.getZookeeperConnection());
Protos.Status status = new SchedulerDriverFactory()
.create(mesosScheduler, frameworkInfo, zkUri, schedulerConfig)
.run();
LOGGER.error("Scheduler driver exited with status: {}", status);
// DRIVER_STOPPED will occur when we call stop(boolean) during uninstall.
// When this happens, we want to continue running so that we can advertise that the uninstall plan is complete.
if (status != Protos.Status.DRIVER_STOPPED) {
SchedulerUtils.hardExit(SchedulerErrorCode.DRIVER_EXITED);
}
}
示例7: testFrameworkInfoNoRevocable
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testFrameworkInfoNoRevocable() {
Protos.FrameworkInfo info = CommandLineDriverSettingsModule.buildFrameworkInfo(
"user",
Optional.absent(),
Amount.of(1L, Time.MINUTES),
false,
Optional.absent());
assertEquals("", info.getPrincipal());
assertEquals(0, info.getCapabilitiesCount());
assertFalse(info.hasRole());
}
示例8: registered
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(
ExecutorDriver driver,
Protos.ExecutorInfo executorInfo,
Protos.FrameworkInfo frameworkInfo,
Protos.SlaveInfo agentInfo) {
LOGGER.info("Registered executor: {}", TextFormat.shortDebugString(executorInfo));
executorService.submit(launchedTaskStore.getMonitor());
}
示例9: testFrameworkInfoNoRevocableWithAnnouncedPrincipal
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testFrameworkInfoNoRevocableWithAnnouncedPrincipal() {
Protos.FrameworkInfo info = CommandLineDriverSettingsModule.buildFrameworkInfo(
"user",
Optional.of("auroraprincipal"),
Amount.of(1L, Time.MINUTES),
false,
Optional.absent());
assertEquals("auroraprincipal", info.getPrincipal());
assertEquals(0, info.getCapabilitiesCount());
assertFalse(info.hasRole());
}
示例10: testFrameworkInfoRevocableWithAnnouncedPrincipalAndRole
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Test
public void testFrameworkInfoRevocableWithAnnouncedPrincipalAndRole() {
Protos.FrameworkInfo info = CommandLineDriverSettingsModule.buildFrameworkInfo(
"user",
Optional.of("auroraprincipal"),
Amount.of(1L, Time.MINUTES),
true,
Optional.of(TEST_ROLE));
assertEquals("auroraprincipal", info.getPrincipal());
assertEquals(1, info.getCapabilitiesCount());
assertEquals(REVOCABLE_RESOURCES, info.getCapabilities(0).getType());
assertTrue(info.hasRole());
assertEquals(TEST_ROLE, info.getRole());
}
示例11: registered
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public void registered(ExecutorDriver driver,
Protos.ExecutorInfo executorInfo,
Protos.FrameworkInfo frameworkInfo,
Protos.SlaveInfo slaveInfo) {
cassandraTaskFactory = new CassandraTaskFactory(driver);
customExecutor = new CustomExecutor(clusterJobExecutorService, cassandraTaskFactory);
}
示例12: registerFramework
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public void registerFramework() throws IOException {
final SchedulerDriverFactory factory = new SchedulerDriverFactory();
final CassandraSchedulerConfiguration targetConfig =
(CassandraSchedulerConfiguration) defaultConfigurationManager.getTargetConfig();
final ServiceConfig serviceConfig = targetConfig.getServiceConfig();
final Optional<ByteString> secretBytes = serviceConfig.readSecretBytes();
final Protos.FrameworkInfo.Builder builder = Protos.FrameworkInfo.newBuilder()
.setRole(serviceConfig.getRole())
.setUser(serviceConfig.getUser())
.setName(targetConfig.getServiceConfig().getName())
.setPrincipal(serviceConfig.getPrincipal())
.setCheckpoint(serviceConfig.isCheckpoint())
.setFailoverTimeout(serviceConfig.getFailoverTimeoutS());
Optional<Protos.FrameworkID> frameworkID = stateStore.fetchFrameworkId();
if (frameworkID.isPresent() && frameworkID.get().hasValue()) {
builder.setId(frameworkID.get());
} else {
LOGGER.info("No framework id found");
}
final Protos.FrameworkInfo frameworkInfo = builder.build();
if (secretBytes.isPresent()) {
// Authenticated if a non empty secret is provided.
setSchedulerDriver(factory.create(
this,
frameworkInfo,
mesosConfig.toZooKeeperUrl(),
secretBytes.get().toByteArray()));
} else {
setSchedulerDriver(factory.create(
this,
frameworkInfo,
mesosConfig.toZooKeeperUrl()));
}
LOGGER.info("Starting driver...");
final Protos.Status startStatus = this.driver.start();
LOGGER.info("Driver started with status: {}", startStatus);
}
示例13: LocalSchedulerDriver
import org.apache.mesos.Protos; //导入方法依赖的package包/类
LocalSchedulerDriver(Scheduler scheduler,
Protos.FrameworkInfo frameworkInfo,
String mesosMaster)
throws InvalidProtocolBufferException {
LOG.info("{} starting", this.getClass().getName());
LOG.warn("Currently this is just a mock to test HTTP server and clients. No jobs will be executed.");
/*
assertNotNull(scheduler);
assertNotNull(frameworkInfo);
assertNotNull(frameworkInfo.getId());
assertNotNull(frameworkInfo.getName());
assertNotNull(mesosMaster);
*/
this.scheduler = scheduler;
Protos.FrameworkID frameworkID = Protos.FrameworkID.newBuilder()
.setValue(UUID.randomUUID().toString())
.build();
this.frameworkInfo = frameworkInfo.toBuilder()
.setId(frameworkID)
.build();
System.err.println(mesosMaster);
String[] master = mesosMaster.split(":");
this.masterInfo = Protos.MasterInfo.newBuilder()
.setHostname(master[0])
.setPort(Integer.parseInt(master[1]))
.setId("mesosMaster")
.setIp(10)
.build();
declined = new ArrayList<>();
accepted = new ArrayList<>();
tasks = new ArrayList<>();
}
示例14: RetzScheduler
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public RetzScheduler(Launcher.Configuration conf, Protos.FrameworkInfo frameworkInfo) throws Throwable {
objectMapper.registerModule(new Jdk8Module());
planner = PlannerFactory.create(conf.getServerConfig().getPlannerName(), conf.getServerConfig());
this.conf = Objects.requireNonNull(conf);
this.frameworkInfo = frameworkInfo;
this.slaves = new ConcurrentHashMap<>();
this.filters = Protos.Filters.newBuilder().setRefuseSeconds(conf.getServerConfig().getRefuseSeconds()).build();
maxJobSize = conf.getServerConfig().getMaxJobSize();
maxFileSize = conf.getServerConfig().getMaxFileSize();
this.master = Optional.empty();
}
示例15: setUp
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Before
public void setUp() throws Throwable {
Protos.FrameworkInfo frameworkInfo = Protos.FrameworkInfo.newBuilder()
.setUser("")
.setName(RetzScheduler.FRAMEWORK_NAME)
.build();
// Non-TLS tests are not to be done, I believe when it works with TLS tests, it should work
// on Non-TLS setup too. I believe his is because Sparkjava does not cleanly clear TLS setting in
// Spark.stop(), because with retz.properties it succeeds alone, but fails when right after TLS tests.
// TODO: investigate and report this to sparkjava
Launcher.Configuration conf = makeConfig();
mapper = new ObjectMapper();
mapper.registerModule(new Jdk8Module());
RetzScheduler scheduler = new RetzScheduler(conf, frameworkInfo);
config = conf.getServerConfig();
Database.getInstance().init(config);
assertTrue(Database.getMigrator().isFinished());
WebConsole.set(scheduler, null);
WebConsole.start(config);
awaitInitialization();
cliConfig = makeClientConfig();
System.err.println(config.authenticationEnabled());
System.err.println(config.toString());
webClient = Client.newBuilder(cliConfig.getUri())
.setAuthenticator(cliConfig.getAuthenticator())
.checkCert(!cliConfig.insecure())
.setVerboseLog(true)
.build();
}