org.apache.mesos.Protos.FrameworkInfo Java Examples

The following examples show how to use org.apache.mesos.Protos.FrameworkInfo. 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: DriverFactoryImpl.java    From attic-aurora with Apache License 2.0 6 votes vote down vote up
@Override
public SchedulerDriver create(
    Scheduler scheduler,
    Optional<Protos.Credential> credentials,
    Protos.FrameworkInfo frameworkInfo,
    String master) {

  FrameworkInfo convertedFrameworkInfo = convert(frameworkInfo);
  Optional<Credential> convertedCredentials = credentials.map(ProtosConversion::convert);

  if (credentials.isPresent()) {
    return new MesosSchedulerDriver(
        scheduler,
        convertedFrameworkInfo,
        master,
        false, // Disable implicit acknowledgements.
        convertedCredentials.get());
  } else {
    return new MesosSchedulerDriver(
        scheduler,
        convertedFrameworkInfo,
        master,
        false); // Disable implicit acknowledgements.
  }
}
 
Example #2
Source File: MesosNimbus.java    From storm with Apache License 2.0 6 votes vote down vote up
private FrameworkInfo.Builder createFrameworkBuilder() throws IOException {
  Number failoverTimeout = Optional.fromNullable((Number) mesosStormConf.get(CONF_MASTER_FAILOVER_TIMEOUT_SECS)).or(24 * 7 * 3600);
  String role = Optional.fromNullable((String) mesosStormConf.get(CONF_MESOS_ROLE)).or("*");
  Boolean checkpoint = Optional.fromNullable((Boolean) mesosStormConf.get(CONF_MESOS_CHECKPOINT)).or(false);
  String frameworkUser = Optional.fromNullable((String) mesosStormConf.get(CONF_MESOS_FRAMEWORK_USER)).or("");

  FrameworkInfo.Builder finfo = FrameworkInfo.newBuilder()
                                             .setName(frameworkName)
                                             .setFailoverTimeout(failoverTimeout.doubleValue())
                                             .setUser(frameworkUser)
                                             .setRole(role)
                                             .setCheckpoint(checkpoint);

  String id = _state.get(FRAMEWORK_ID);

  if (id != null) {
    finfo.setId(FrameworkID.newBuilder().setValue(id).build());
  }

  return finfo;
}
 
Example #3
Source File: SchedulerDriverFactoryTest.java    From dcos-commons with Apache License 2.0 6 votes vote down vote up
/**
 * Avoid calls to the MesosSchedulerDriver constructor, which triggers errors about libmesos not
 * being present.
 */
@Override
protected MesosSchedulerDriver createInternal(
        final Scheduler scheduler,
        final FrameworkInfo frameworkInfo,
        final String masterUrl,
        final Credential credential,
        final String mesosAPIVersion) {
    createCalls++;
    if (credential != null) {
        lastCallHadCredential = true;
        lastCallHadSecret = credential.hasSecret();
    } else {
        lastCallHadCredential = false;
        lastCallHadSecret = false;
    }
    return null; // avoid requiring a NoOpSchedulerDriver
}
 
Example #4
Source File: MyriadDriver.java    From myriad with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #5
Source File: REEFExecutor.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void registered(final ExecutorDriver driver,
                       final ExecutorInfo executorInfo,
                       final FrameworkInfo frameworkInfo,
                       final SlaveInfo slaveInfo) {
  LOG.log(Level.FINEST, "Executor registered. driver: {0} executorInfo: {1} frameworkInfo: {2} slaveInfo {3}",
      new Object[]{driver, executorInfo, frameworkInfo, slaveInfo});
}
 
Example #6
Source File: MesosSupervisor.java    From storm with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #7
Source File: SchedulerDriverContext.java    From jesos with Apache License 2.0 5 votes vote down vote up
void setFrameworkId(final FrameworkID frameworkId)
{
    checkNotNull(frameworkId, "frameworkId is null");

    frameworkInfo.set(FrameworkInfo.newBuilder(frameworkInfo.get())
        .setId(frameworkId)
        .build());
}
 
Example #8
Source File: SchedulerDriverContext.java    From jesos with Apache License 2.0 5 votes vote down vote up
SchedulerDriverContext(final FrameworkInfo frameworkInfo)
                throws IOException
{
    this.frameworkInfo.set(checkNotNull(frameworkInfo, "frameworkInfo is null"));

    this.driverUpid = UPID.fromParts(UUID.randomUUID().toString(),
        HostAndPort.fromParts(frameworkInfo.getHostname(), NetworkUtil.findUnusedPort()));

    // If the framework info sent in has an id, we are in failover mode from the start.
    failover.set(hasFrameworkId(frameworkInfo));
}
 
Example #9
Source File: JesosSchedulerDriver.java    From jesos with Apache License 2.0 5 votes vote down vote up
public JesosSchedulerDriver(final Scheduler scheduler,
                            final FrameworkInfo frameworkInfo,
                            final String master,
                            boolean implicitAcknowledges,
                            final Credential credential)
                throws IOException
{
    super(scheduler, frameworkInfo, master, implicitAcknowledges, credential);
}
 
Example #10
Source File: JesosSchedulerDriver.java    From jesos with Apache License 2.0 5 votes vote down vote up
public JesosSchedulerDriver(final Scheduler scheduler,
                            final FrameworkInfo frameworkInfo,
                            final String master,
                            boolean implicitAcknowledges) throws IOException
{
    super(scheduler, frameworkInfo, master, implicitAcknowledges, null);
}
 
Example #11
Source File: JesosSchedulerDriver.java    From jesos with Apache License 2.0 5 votes vote down vote up
public JesosSchedulerDriver(final Scheduler scheduler,
                            final FrameworkInfo frameworkInfo,
                            final String master,
                            final Credential credential)
                throws IOException
{
    super(scheduler, frameworkInfo, master, true, credential);
}
 
Example #12
Source File: ResourceExecutor.java    From oodt with Apache License 2.0 5 votes vote down vote up
@Override
public void registered(ExecutorDriver arg0, ExecutorInfo arg1,
        FrameworkInfo arg2, SlaveInfo arg3) {
    System.out.println("Do-Wah-Do-Wah");
    str.println(id+"Registered, Huzzah!");

}
 
Example #13
Source File: SchedulerDriverFactory.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
/**
 * Broken out into a separate function to allow testing with custom SchedulerDrivers.
 */
protected SchedulerDriver createInternal(
    final Scheduler scheduler,
    final FrameworkInfo frameworkInfo,
    final String masterUrl,
    @Nullable final Credential credential,
    final String mesosAPIVersion)
{
  Capabilities capabilities = Capabilities.getInstance();
  // TODO(DCOS-29172): This can be removed if/when we switch to using our own Mesos Client
  // Love to work around the fact that the MesosToSchedulerDriverAdapter both depends directly on the
  // process environment *and* uses two unrelated constructors for the case of credential being null
  return credential == null ?
      new MesosToSchedulerDriverAdapter(scheduler, frameworkInfo, masterUrl, true) {
        @Override
        protected Mesos startInternal() {
          return startInternalCustom(
              this,
              capabilities,
              frameworkInfo,
              masterUrl,
              null,
              mesosAPIVersion
          );
        }
      } :
      new MesosToSchedulerDriverAdapter(scheduler, frameworkInfo, masterUrl, true, credential) {
        @Override
        protected Mesos startInternal() {
          return startInternalCustom(
              this,
              capabilities,
              frameworkInfo,
              masterUrl,
              credential,
              mesosAPIVersion
          );
        }
      };
}
 
Example #14
Source File: SchedulerDriverFactory.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
Mesos startInternalCustom(
    MesosToSchedulerDriverAdapter adapter,
    final Capabilities capabilities,
    final FrameworkInfo frameworkInfo,
    final String masterUrl,
    final Credential credential,
    final String mesosAPIVersion)
{
  LOGGER.info("Trying to use Mesos {} API, isCredentialNull: {}",
      mesosAPIVersion,
      credential == null);
  if (mesosAPIVersion.equals(SchedulerConfig.MESOS_API_VERSION_V1)) {
    if (capabilities.supportsV1APIByDefault()) {
      LOGGER.info("Using Mesos {} API", SchedulerConfig.MESOS_API_VERSION_V1);
      return new V1Mesos(
          adapter,
          masterUrl,
          credential == null ? null : EvolverDevolver.evolve(credential));
    } else {
      LOGGER.info("Current DC/OS cluster doesn't support the Mesos {} API",
          SchedulerConfig.MESOS_API_VERSION_V1);
    }
  }
  LOGGER.info("Using Mesos V0 API");
  return new V0Mesos(
      adapter,
      EvolverDevolver.evolve(frameworkInfo),
      masterUrl,
      credential == null ? null : EvolverDevolver.evolve(credential));
}
 
Example #15
Source File: SchedulerDriverFactory.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #16
Source File: ResourceMesosSchedulerFactory.java    From oodt with Apache License 2.0 4 votes vote down vote up
public Scheduler construct() {
    try {
        String uri = System.getProperty("org.apache.oodt.cas.resource.mesos.executor.uri","./oodt-executor.in");
        //Framework info
        FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder()
                    .setName("OODT Resource Manager Mesos Framework").setUser("")
                    .setId(FrameworkID.newBuilder().setValue("OODT-Resource Framework").build());
        FrameworkInfo framework = frameworkBuilder.build();
        ExecutorInfo executor = ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("OODT-Resource").build())
                .setCommand(CommandInfo.newBuilder().setValue(new File(uri).getCanonicalPath()).build())
                .setName("OODT Resource Manager Executor").build();
        SchedulerDriver driver = null;

        //Resource manager properties
        String batchmgrClassStr = "org.apache.oodt.cas.resource.batchmgr.MesosBatchManagerFactory";
        String monitorClassStr = "org.apache.oodt.cas.resource.monitor.MesosMonitorFactory";
        String jobQueueClassStr = System.getProperty("resource.jobqueue.factory","org.apache.oodt.cas.resource.jobqueue.JobStackJobQueueFactory");
        String ip = System.getProperty("resource.mesos.master.ip","127.0.0.1:5050");

        batch = (MesosBatchManager)GenericResourceManagerObjectFactory.getBatchmgrServiceFromFactory(batchmgrClassStr);
        mon = GenericResourceManagerObjectFactory.getMonitorServiceFromFactory(monitorClassStr);
        queue = GenericResourceManagerObjectFactory.getJobQueueServiceFromFactory(jobQueueClassStr);
        batch.setMonitor(mon);
        batch.setDriver(driver);
        batch.setJobRepository(queue.getJobRepository());

        LOG.log(Level.INFO,"Connecting to Mesos Master at: "+ip);
        System.out.println("Connecting to Mesos Master at: "+ip);
        ResourceMesosScheduler scheduler = new ResourceMesosScheduler(batch, executor, queue, mon);

        final MesosSchedulerDriver mesos = new MesosSchedulerDriver(scheduler, framework, ip);
        //Anonymous thread to run
        new Thread(new Runnable() {
            public void run() {
                int status = mesos.run() == Status.DRIVER_STOPPED ? 0 : 1;
                mesos.stop();
            }
        }).start();
        return scheduler;
    } catch(IOException ioe) {
        LOG.log(Level.SEVERE,"Exception detected: "+ioe.getMessage());
        ioLOG.log(Level.SEVERE, e.getMessage());
        throw new RuntimeException(ioe);
    }
}
 
Example #17
Source File: BdsMesosFramework.java    From BigDataScript with Apache License 2.0 4 votes vote down vote up
public FrameworkInfo getFrameworkInfo() {
	return frameworkInfo;
}
 
Example #18
Source File: VirtualMachineMasterServiceMesosImpl.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
/**
 * Due to circular dependency with SchedulingService, activate via VirtualMachineMasterServiceActivator
 */
public void enterActiveMode() {
    // Due to circular dependency, we need to differ services access until the activation phase.
    V3JobOperations v3JobOperations = injector.getInstance(V3JobOperations.class);

    logger.info("Registering Titus Framework with Mesos");

    if (!initializationDone.compareAndSet(false, true)) {
        throw new IllegalStateException("Duplicate start() call");
    }

    mesosCallbackHandler = new MesosSchedulerCallbackHandler(leaseHandler, vmLeaseRescindedObserver, vmTaskStatusObserver,
            v3JobOperations, taskStatusUpdateFitInjection, config, mesosConfiguration, titusRuntime);

    FrameworkInfo framework = FrameworkInfo.newBuilder()
            .setUser("root") // Fix to root, to enable running master as non-root
            .setName(getFrameworkName())
            .setFailoverTimeout(getMesosFailoverTimeoutSecs())
            .setId(Protos.FrameworkID.newBuilder().setValue(getFrameworkName()))
            .setCheckpoint(true)
            .build();

    String mesosMaster = timed(
            "Resolving Mesos master address",
            () -> {
                Optional<String> mm = mesosMasterResolver.resolveCanonical();
                if (!mm.isPresent()) {
                    throw new IllegalStateException("Mesos master address not configured");
                }
                return mm;
            }).get();

    mesosDriver = timed(
            "Creating Mesos driver using factory " + mesosDriverFactory.getClass().getSimpleName(),
            () -> mesosDriverFactory.createDriver(framework, mesosMaster, mesosCallbackHandler)
    );

    executor.execute(() -> {
        try {
            mesosDriver.run();
        } catch (Exception e) {
            logger.error("Failed to register Titus Framework with Mesos", e);
        }
    });
    this.active = true;
}
 
Example #19
Source File: SchedulerDriverContext.java    From jesos with Apache License 2.0 4 votes vote down vote up
/**
 * Static helper for use in the c'tor
 */
private static boolean hasFrameworkId(final FrameworkInfo frameworkInfo)
{
    return frameworkInfo.hasId() && !"".equals(frameworkInfo.getId().getValue());
}
 
Example #20
Source File: SchedulerDriverContext.java    From jesos with Apache License 2.0 4 votes vote down vote up
FrameworkInfo getFrameworkInfo()
{
    return frameworkInfo.get();
}
 
Example #21
Source File: InternalSchedulerDriver.java    From jesos with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new driver for the specified scheduler. The master
 * must be specified as
 *
 *     zk://host1:port1,host2:port2,.../path
 *     zk://username:password@host1:port1,host2:port2,.../path
 *
 * The driver will attempt to "failover" if the specified
 * FrameworkInfo includes a valid FrameworkID.
 */
protected InternalSchedulerDriver(final Scheduler scheduler,
                                  final FrameworkInfo frameworkInfo,
                                  final String master,
                                  boolean implicitAcknowledges,
                                  final Credential credential)
                throws IOException
{
    this.scheduler = checkNotNull(scheduler, "scheduler is null");
    checkNotNull(frameworkInfo, "frameworkInfo is null");
    checkNotNull(master, "master is null");
    this.implicitAcknowledges = implicitAcknowledges;
    this.credential = credential;

    checkState(!master.equals("local"), "Java client can not launch a local cluster!");

    // TODO - Any volunteers to do the SASL dance?
    checkState(this.credential == null, "Credential is not supported yet.");

    final FrameworkInfo.Builder frameworkInfoBuilder = FrameworkInfo.newBuilder(frameworkInfo);

    if (!frameworkInfo.hasHostname()) {
        frameworkInfoBuilder.setHostname(NetworkUtil.findPublicIp());
    }

    if (!frameworkInfo.hasUser() || "".equals(frameworkInfo.getUser())) {
        frameworkInfoBuilder.setUser(System.getProperty("user.name"));
    }

    context = new SchedulerDriverContext(frameworkInfoBuilder.build());

    this.eventBus = new ManagedEventBus("scheduler");

    this.localMessageProcessor = new LocalSchedulerMessageProcessor(context, eventBus, implicitAcknowledges);

    // Closer closes in reverse registration order.

    // Close the callback executor last, so that everything that was still scheduled to be delivered to the framework still has a chance.
    this.callbackExecutor = closer.register(CloseableExecutors.decorate(Executors.newScheduledThreadPool(5, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("scheduler-callback-%d").build())));

    this.receiver = closer.register(new HttpProtocolReceiver(context.getDriverUPID(), SchedulerMessageEnvelope.class, eventBus));

    // The sender is closed before the receiver, so that possible responses are still caught
    this.sender = closer.register(new HttpProtocolSender(context.getDriverUPID()));

    // Make sure that the event bus is drained next at shutdown.
    closer.register(eventBus);

    // Close the master detector first. No more master changes required.
    this.detector = closer.register(new ZookeeperMasterDetector(master, eventBus));

}
 
Example #22
Source File: MyriadExecutor.java    From incubator-myriad with Apache License 2.0 4 votes vote down vote up
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
  LOGGER.debug("Registered ", executorInfo, " for framework ", frameworkInfo, " on mesos slave ", slaveInfo);
}
 
Example #23
Source File: SchedulerDriverFactory.java    From dcos-commons with Apache License 2.0 4 votes vote down vote up
/**
 * 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.getClass().getSimpleName(),
        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 "
            // SUPPRESS CHECKSTYLE MultipleStringLiteralsCheck
            + "scheduler[{}], frameworkInfo[{}], masterUrl[{}]",
        scheduler.getClass().getSimpleName(),
        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.getClass().getSimpleName(),
        TextFormat.shortDebugString(frameworkInfo),
        masterUrl);
    credential = null;
  }
  return createInternal(
      scheduler,
      frameworkInfo,
      masterUrl,
      credential,
      schedulerConfig.getMesosApiVersion());
}
 
Example #24
Source File: MesosExecutorCallbackHandler.java    From mantis with Apache License 2.0 4 votes vote down vote up
@Override
public void registered(ExecutorDriver arg0, ExecutorInfo arg1,
                       FrameworkInfo arg2, SlaveInfo arg3) {
    // TODO Auto-generated method stub

}
 
Example #25
Source File: JesosSchedulerDriver.java    From jesos with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new driver for the specified scheduler. The master
 * must be specified as
 *
 *     zk://host1:port1,host2:port2,.../path
 *     zk://username:password@host1:port1,host2:port2,.../path
 *
 * The driver will attempt to "failover" if the specified
 * FrameworkInfo includes a valid FrameworkID.
 */
public JesosSchedulerDriver(final Scheduler scheduler,
                            final FrameworkInfo frameworkInfo,
                            final String master) throws IOException
{
    super(scheduler, frameworkInfo, master, true, null);
}
 
Example #26
Source File: HelloWorldMain.java    From tutorials with MIT License 3 votes vote down vote up
public static void main(String[] args) {

        String path = System.getProperty("user.dir")
                + "/target/libraries2-1.0.0-SNAPSHOT.jar";

        CommandInfo.URI uri = CommandInfo.URI.newBuilder().setValue(path).setExtract(false).build();

        String helloWorldCommand = "java -cp libraries2-1.0.0-SNAPSHOT.jar com.baeldung.mesos.executors.HelloWorldExecutor";
        CommandInfo commandInfoHelloWorld = CommandInfo.newBuilder().setValue(helloWorldCommand).addUris(uri)
                .build();

        ExecutorInfo executorHelloWorld = ExecutorInfo.newBuilder()
                .setExecutorId(Protos.ExecutorID.newBuilder().setValue("HelloWorldExecutor"))
                .setCommand(commandInfoHelloWorld).setName("Hello World (Java)").setSource("java").build();

        FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder().setFailoverTimeout(120000)
                .setUser("")
                .setName("Hello World Framework (Java)");

        frameworkBuilder.setPrincipal("test-framework-java");

        MesosSchedulerDriver driver = new MesosSchedulerDriver(new HelloWorldScheduler(executorHelloWorld), frameworkBuilder.build(), args[0]);

        int status = driver.run() == Protos.Status.DRIVER_STOPPED ? 0 : 1;

        // Ensure that the driver process terminates.
        driver.stop();

        System.exit(status);
    }
 
Example #27
Source File: SchedulerDriverFactory.java    From dcos-commons with Apache License 2.0 3 votes vote down vote up
/**
 * Creates and returns a new {@link SchedulerDriver} without a 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"
 * @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(
    Scheduler scheduler,
    FrameworkInfo frameworkInfo,
    String masterUrl,
    SchedulerConfig schedulerConfig)
{
  return create(scheduler, frameworkInfo, masterUrl, schedulerConfig, null /* credentialSecret */);
}
 
Example #28
Source File: BdsMesosExecutor.java    From BigDataScript with Apache License 2.0 2 votes vote down vote up
/**
 * Invoked once the executor driver has been able to successfully
 * connect with Mesos. In particular, a scheduler can pass some
 * data to it's executors through the FrameworkInfo.ExecutorInfo's
 * data field.
 */
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
	if (debug) Gpr.debug("Executor: Registered on " + slaveInfo.getHostname());
}