本文整理汇总了Java中org.apache.mesos.Protos.FrameworkInfo类的典型用法代码示例。如果您正苦于以下问题:Java FrameworkInfo类的具体用法?Java FrameworkInfo怎么用?Java FrameworkInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FrameworkInfo类属于org.apache.mesos.Protos包,在下文中一共展示了FrameworkInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFrameworkBuilder
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
private FrameworkInfo.Builder createFrameworkBuilder() throws IOException {
Number failoverTimeout = Optional.fromNullable((Number) _conf.get(CONF_MASTER_FAILOVER_TIMEOUT_SECS)).or(24 * 7 * 3600);
String role = Optional.fromNullable((String) _conf.get(CONF_MESOS_ROLE)).or("*");
Boolean checkpoint = Optional.fromNullable((Boolean) _conf.get(CONF_MESOS_CHECKPOINT)).or(false);
String frameworkName = Optional.fromNullable((String) _conf.get(CONF_MESOS_FRAMEWORK_NAME)).or("Storm!!!");
FrameworkInfo.Builder finfo = FrameworkInfo.newBuilder()
.setName(frameworkName)
.setFailoverTimeout(failoverTimeout.doubleValue())
.setUser("")
.setRole(role)
.setCheckpoint(checkpoint);
String id = _state.get(FRAMEWORK_ID);
if (id != null) {
finfo.setId(FrameworkID.newBuilder().setValue(id).build());
}
return finfo;
}
示例2: run
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Override
public void run() {
FrameworkInfo.Builder frameworkInfo = FrameworkInfo.newBuilder()
.setName(hbaseFrameworkConfig.getFrameworkName())
.setFailoverTimeout(hbaseFrameworkConfig.getFailoverTimeout())
.setUser(hbaseFrameworkConfig.getHbaseUser())
.setRole(hbaseFrameworkConfig.getHbaseRole())
.setCheckpoint(true);
try {
FrameworkID frameworkID = persistenceStore.getFrameworkId();
if (frameworkID != null) {
frameworkInfo.setId(frameworkID);
}
} catch (PersistenceException e) {
final String msg = "Error recovering framework id";
log.error(msg, e);
throw new SchedulerException(msg, e);
}
registerFramework(this, frameworkInfo.build(), hbaseFrameworkConfig.getMesosMasterUri());
}
示例3: MyriadDriver
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Inject
public MyriadDriver(final MyriadScheduler scheduler,
final MyriadConfiguration cfg, final SchedulerState schedulerState) {
this.scheduler = scheduler;
FrameworkID frameworkId = schedulerState.getFrameworkId();
Builder frameworkInfoBuilder = FrameworkInfo.newBuilder().setUser("")
.setName(cfg.getFrameworkName())
.setCheckpoint(cfg.getCheckpoint())
.setFailoverTimeout(cfg.getFrameworkFailoverTimeout());
if (frameworkId != null) {
frameworkInfoBuilder.setId(frameworkId);
}
this.myriadFrameworkInfo = frameworkInfoBuilder.build();
this.driver = new MesosSchedulerDriver(this.scheduler,
this.myriadFrameworkInfo, cfg.getMesosMaster());
}
示例4: SingularityDriver
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Inject
SingularityDriver(final SingularityMesosSchedulerDelegator scheduler, final SingularityConfiguration singularityConfiguration, final MesosConfiguration configuration,
@Named(SingularityMainModule.SINGULARITY_URI_BASE) final String singularityUriBase) throws IOException {
final FrameworkInfo.Builder frameworkInfoBuilder = Protos.FrameworkInfo.newBuilder()
.setCheckpoint(configuration.getCheckpoint())
.setFailoverTimeout(configuration.getFrameworkFailoverTimeout())
.setName(configuration.getFrameworkName())
.setId(FrameworkID.newBuilder().setValue(configuration.getFrameworkId()))
.setUser(""); // let mesos assign
if (singularityConfiguration.getHostname().isPresent()) {
frameworkInfoBuilder.setHostname(singularityConfiguration.getHostname().get());
}
// only set the web UI URL if it's fully qualified
if (singularityUriBase.startsWith("http://") || singularityUriBase.startsWith("https://")) {
if (singularityConfiguration.getUiConfiguration().getRootUrlMode() == UIConfiguration.RootUrlMode.INDEX_CATCHALL) {
frameworkInfoBuilder.setWebuiUrl(singularityUriBase);
} else {
frameworkInfoBuilder.setWebuiUrl(singularityUriBase + UiResource.UI_RESOURCE_LOCATION);
}
}
this.frameworkInfo = frameworkInfoBuilder.build();
this.scheduler = scheduler;
if (configuration.getCredentialPrincipal().isPresent() && configuration.getCredentialSecret().isPresent()) {
Credential credential = Credential.newBuilder()
.setPrincipal(configuration.getCredentialPrincipal().get())
.setSecret(ByteString.copyFrom(configuration.getCredentialSecret().get().getBytes(StandardCharsets.UTF_8)))
.build();
this.driver = new MesosSchedulerDriver(scheduler, frameworkInfo, configuration.getMaster(), credential);
} else {
this.driver = new MesosSchedulerDriver(scheduler, frameworkInfo, configuration.getMaster());
}
}
示例5: startUp
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Override
protected void startUp() {
Optional<String> frameworkId = storage.read(
storeProvider -> storeProvider.getSchedulerStore().fetchFrameworkId());
LOG.info("Connecting to mesos master: " + driverSettings.getMasterUri());
if (!driverSettings.getCredentials().isPresent()) {
LOG.warn("Connecting to master without authentication!");
}
FrameworkInfo.Builder frameworkBuilder = driverSettings.getFrameworkInfo().toBuilder();
if (frameworkId.isPresent()) {
LOG.info("Found persisted framework ID: " + frameworkId);
frameworkBuilder.setId(FrameworkID.newBuilder().setValue(frameworkId.get()));
} else {
LOG.warn("Did not find a persisted framework ID, connecting as a new framework.");
}
SchedulerDriver schedulerDriver = driverFactory.create(
scheduler,
driverSettings.getCredentials(),
frameworkBuilder.build(),
driverSettings.getMasterUri());
Protos.Status status = schedulerDriver.start();
LOG.info("Driver started with code " + status);
driverFuture.set(schedulerDriver);
}
示例6: registered
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
LOG.info("Received executor data <{}>", executorInfo.getData().toStringUtf8());
Map ids = (Map) JSONValue.parse(executorInfo.getData().toStringUtf8());
_executorId = executorInfo.getExecutorId().getValue();
_supervisorId = (String) ids.get(MesosCommon.SUPERVISOR_ID);
_assignmentId = (String) ids.get(MesosCommon.ASSIGNMENT_ID);
LOG.info("Registered supervisor with Mesos: {}, {} ", _supervisorId, _assignmentId);
// Completed registration, let anything waiting for us to do so continue
_registeredLatch.countDown();
}
示例7: getFrameworkInfo
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
public static FrameworkInfo getFrameworkInfo() {
FrameworkInfo.Builder builder = FrameworkInfo.newBuilder();
builder.setFailoverTimeout(5);
builder.setUser("");
builder.setName(FRAMEWORK_NAME);
return builder.build();
}
示例8: create
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
/**
* Creates and returns a new {@link SchedulerDriver} with the provided credential secret.
*
* @param scheduler The Framework {@link Scheduler} implementation which should receive callbacks
* from the {@link SchedulerDriver}
* @param frameworkInfo The {@link FrameworkInfo} which describes the framework implementation.
* The 'principal' field MUST be populated and non-empty
* @param masterUrl The URL of the currently active Mesos Master, of the form "zk://host/mesos"
* @param credentialSecret The secret to be included in the framework
* {@link org.apache.mesos.Protos.Credential}, ignored if {@code null}/empty
* @return A {@link SchedulerDriver} configured with the provided info
* @throws IllegalArgumentException if {@link FrameworkInfo}.principal is unset or empty when
* authentication is needed
*/
public SchedulerDriver create(
final Scheduler scheduler,
final FrameworkInfo frameworkInfo,
final String masterUrl,
final SchedulerConfig schedulerConfig,
final byte[] credentialSecret) {
Credential credential;
if (credentialSecret != null && credentialSecret.length > 0) {
// User has manually provided a Secret. Provide a Credential with Principal + Secret.
// (note: we intentionally avoid logging the content of the credential secret, just in case)
LOGGER.info("Creating secret authenticated MesosSchedulerDriver for "
+ "scheduler[{}], frameworkInfo[{}], masterUrl[{}], credentialSecret[{} bytes]",
scheduler, TextFormat.shortDebugString(frameworkInfo), masterUrl, credentialSecret.length);
credential = Credential.newBuilder()
.setPrincipal(getPrincipal(frameworkInfo, "secret"))
.setSecretBytes(ByteString.copyFrom(credentialSecret))
.build();
} else if (schedulerConfig.isSideChannelActive()) {
// Sidechannel auth is enabled. Provide a Credential with only the Principal set.
LOGGER.info("Creating sidechannel authenticated MesosSchedulerDriver for "
+ "scheduler[{}], frameworkInfo[{}], masterUrl[{}]",
scheduler, TextFormat.shortDebugString(frameworkInfo), masterUrl);
credential = Credential.newBuilder()
.setPrincipal(getPrincipal(frameworkInfo, "sidechannel"))
.build();
} else {
// No auth. Provide no credential.
LOGGER.info("Creating unauthenticated MesosSchedulerDriver for "
+ "scheduler[{}], frameworkInfo[{}], masterUrl[{}]",
scheduler, TextFormat.shortDebugString(frameworkInfo), masterUrl);
credential = null;
}
return createInternal(scheduler, frameworkInfo, masterUrl, credential, schedulerConfig.getMesosApiVersion());
}
示例9: getPrincipal
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
/**
* Extracts the Principal name from the provided {@link FrameworkInfo}, or throws an
* {@link IllegalArgumentException} (mentioning the provided {@code authType}) if the Principal
* is unavailable.
*/
private static String getPrincipal(final FrameworkInfo frameworkInfo, final String authType) {
if (!frameworkInfo.hasPrincipal() || StringUtils.isEmpty(frameworkInfo.getPrincipal())) {
throw new IllegalArgumentException(
"Unable to create MesosSchedulerDriver for " + authType + " auth, "
+ "FrameworkInfo lacks required principal: " + frameworkInfo.toString());
}
return frameworkInfo.getPrincipal();
}
示例10: initialize
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Override
protected void initialize() throws Exception {
LOG.info("Initializing Mesos resource master");
workerStore.start();
// create the scheduler driver to communicate with Mesos
schedulerCallbackHandler = new SchedulerProxy(self());
// register with Mesos
FrameworkInfo.Builder frameworkInfo = mesosConfig.frameworkInfo()
.clone()
.setCheckpoint(true);
Option<Protos.FrameworkID> frameworkID = workerStore.getFrameworkID();
if (frameworkID.isEmpty()) {
LOG.info("Registering as new framework.");
}
else {
LOG.info("Recovery scenario: re-registering using framework ID {}.", frameworkID.get().getValue());
frameworkInfo.setId(frameworkID.get());
}
MesosConfiguration initializedMesosConfig = mesosConfig.withFrameworkInfo(frameworkInfo);
MesosConfiguration.logMesosConfig(LOG, initializedMesosConfig);
schedulerDriver = initializedMesosConfig.createDriver(schedulerCallbackHandler, false);
// create supporting actors
connectionMonitor = createConnectionMonitor();
launchCoordinator = createLaunchCoordinator();
reconciliationCoordinator = createReconciliationCoordinator();
taskRouter = createTaskRouter();
recoverWorkers();
connectionMonitor.tell(new ConnectionMonitor.Start(), self());
schedulerDriver.start();
}
示例11: registered
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo,
FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
System.out.println("Registered the Exectutor");
System.out.println("Executor : " + executorInfo);
System.out.println("Framework : " + frameworkInfo);
System.out.println("SlaveInfo : " + slaveInfo);
}
示例12: getFrameworkInfo
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
private static FrameworkInfo getFrameworkInfo() {
FrameworkInfo.Builder builder = FrameworkInfo.newBuilder();
builder.setFailoverTimeout(120000);
builder.setUser("");
builder.setName(frameworkName);
return builder.build();
}
示例13: registered
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
@Override
public void registered(ExecutorDriver executorDriver, ExecutorInfo executorInfo,
FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
log.debug("executor registered with framework:"+frameworkInfo.getName()+":on slave:"+slaveInfo.getHostname());
this.executorInfo = executorInfo;
this.executorDriver = executorDriver;
}
示例14: registered
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
/**
* Register the framework with the executor.
*/
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo,
FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
// Set up data dir
setUpDataDir();
if (!hbaseFrameworkConfig.usingNativeHadoopBinaries()) {
createSymbolicLink();
}
log.info("Executor registered with the slave");
}
示例15: registerFramework
import org.apache.mesos.Protos.FrameworkInfo; //导入依赖的package包/类
private void registerFramework(HBaseScheduler sched, FrameworkInfo fInfo, String masterUri) {
Credential cred = getCredential();
if (cred != null) {
log.info("Registering with credentials.");
new MesosSchedulerDriver(sched, fInfo, masterUri, cred).run();
} else {
log.info("Registering without authentication");
new MesosSchedulerDriver(sched, fInfo, masterUri).run();
}
}