org.apache.mesos.MesosExecutorDriver Java Examples

The following examples show how to use org.apache.mesos.MesosExecutorDriver. 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: MesosWorker.java    From twister2 with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

    MesosWorker worker = new MesosWorker();
    //worker.printArgs(args);

    String twister2Home = Paths.get("").toAbsolutePath().toString();
    String configDir = "twister2-job";
    worker.config = ConfigLoader.loadConfig(twister2Home, configDir, "mesos");

    // we can not initialize the logger fully yet,
    // but we need to set the format as the first thing
    LoggingHelper.setLoggingFormat(LoggingHelper.DEFAULT_FORMAT);


    worker.jobID = args[0];
    String workerName = args[1];
    initLogging(worker.config, SchedulerContext.nfsServerPath(worker.config)
        + "/" + worker.jobID + "/logs", workerName);

    System.out.println(worker.config);
    MesosExecutorDriver driver = new MesosExecutorDriver(
        worker);

    driver.run();
  }
 
Example #2
Source File: MesosSupervisor.java    From storm with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(Map conf, String localDir) {
  _executor = new StormExecutor();
  _driver = new MesosExecutorDriver(_executor);
  _driver.start();
  LOG.info("Waiting for executor to initialize...");
  _conf = conf;
  try {
    _executor.waitUntilRegistered();
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
  LOG.info("Executor initialized...");
  Thread suicide = new SuicideDetector(conf);
  suicide.setDaemon(true);
  suicide.start();
}
 
Example #3
Source File: CassandraExecutor.java    From cassandra-mesos-deprecated with Apache License 2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final MesosExecutorDriver driver = new MesosExecutorDriver(new CassandraExecutor(new ProdObjectFactory()));
    final int status;
    switch (driver.run()) {
        case DRIVER_STOPPED:
            status = 0;
            break;
        case DRIVER_ABORTED:
            status = 1;
            break;
        case DRIVER_NOT_STARTED:
            status = 2;
            break;
        default:
            status = 3;
            break;
    }
    driver.stop();

    System.exit(status);
}
 
Example #4
Source File: SingularityExecutorRunner.java    From Singularity with Apache License 2.0 6 votes vote down vote up
public Protos.Status run() {
  LOG.info("{} starting MesosExecutorDriver...", name);

  final MesosExecutorDriver driver = new MesosExecutorDriver(singularityExecutor);
  monitor.start(driver);

  Runtime
    .getRuntime()
    .addShutdownHook(
      new Thread("SingularityExecutorRunnerGracefulShutdown") {

        @Override
        public void run() {
          LOG.info("Executor is shutting down, ensuring shutdown via shutdown hook");
          monitor.shutdown(driver);
        }
      }
    );

  return driver.run();
}
 
Example #5
Source File: Application.java    From logstash with Apache License 2.0 5 votes vote down vote up
public void run() {
        LogstashService logstashService = new LogstashService();

//        LiveState liveState = new LiveState(logstashService, dockerClient);

        LogstashExecutor executor = new LogstashExecutor(logstashService);

        MesosExecutorDriver driver = new MesosExecutorDriver(executor);

        // we start after the config manager is initiated
        // because it's sets a frameworkListener
//        dockerClient.start();

        LOGGER.info("Mesos Logstash Executor Started");
        Protos.Status status = driver.run();
        LOGGER.info("Mesos Logstash Executor Stopped");

//        logstashService.stop();
//        dockerClient.stop();

        if (status.equals(Protos.Status.DRIVER_STOPPED)) {
            System.exit(0);
        }
        else {
            System.exit(1);
        }
    }
 
Example #6
Source File: MyriadExecutorAuxService.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  LOGGER.info("Starting MyriadExecutor...");

  myriadExecutorThread = new Thread(new Runnable() {
    public void run() {
      driver = new MesosExecutorDriver(new MyriadExecutor(containerIds));
      LOGGER.error("MyriadExecutor exit with status " + Integer.toString(driver.run() == Status.DRIVER_STOPPED ? 0 : 1));
    }
  });
  myriadExecutorThread.start();
}
 
Example #7
Source File: REEFExecutor.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
REEFExecutor(final EvaluatorControlHandler evaluatorControlHandler,
             final MesosRemoteManager mesosRemoteManager,
             final REEFFileNames fileNames,
             @Parameter(MesosExecutorId.class) final String mesosExecutorId) {
  this.mesosRemoteManager = mesosRemoteManager;
  this.mesosRemoteManager.registerHandler(EvaluatorControl.class, evaluatorControlHandler);
  this.mesosExecutorDriver = new MesosExecutorDriver(this);
  this.executorService = Executors.newCachedThreadPool();
  this.fileNames = fileNames;
  this.mesosExecutorId = mesosExecutorId;
}
 
Example #8
Source File: BdsMesosExecutor.java    From BigDataScript with Apache License 2.0 5 votes vote down vote up
/**
 * Main: Entry point for executor, invoked by Mesos framework
 */
public static void main(String[] args) throws Exception {
	System.out.println("Starting executor: " + BdsMesosExecutor.class.getSimpleName());
	MesosExecutorDriver driver = new MesosExecutorDriver(new BdsMesosExecutor());
	System.out.println("Finished executor: " + BdsMesosExecutor.class.getSimpleName());
	System.exit(driver.run() == Status.DRIVER_STOPPED ? 0 : 1);
}
 
Example #9
Source File: JobBootstrap.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 4 votes vote down vote up
/**
 * Execute.
 */
public static void execute() {
    MesosExecutorDriver driver = new MesosExecutorDriver(new TaskExecutor());
    System.exit(Protos.Status.DRIVER_STOPPED == driver.run() ? 0 : -1);
}
 
Example #10
Source File: MesosExecutorDriverFactory.java    From dcos-cassandra-service with Apache License 2.0 4 votes vote down vote up
@Override
public ExecutorDriver getDriver(Executor executor) {
    return new MesosExecutorDriver(executor);
}
 
Example #11
Source File: App.java    From docker-compose-executor with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	ExecutorComponent executorComponent = DaggerExecutorComponent.builder().build();
	Executor executor = executorComponent.getExecutor();
	ExecutorDriver driver= new MesosExecutorDriver(executor);
	driver.run();
}
 
Example #12
Source File: ResourceExecutor.java    From oodt with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    MesosExecutorDriver driver = new MesosExecutorDriver(new ResourceExecutor());
    System.exit(driver.run() == Status.DRIVER_STOPPED ? 0 : 1);
}
 
Example #13
Source File: HelloWorldExecutor.java    From tutorials with MIT License 4 votes vote down vote up
public static void main(String[] args) {
    MesosExecutorDriver driver = new MesosExecutorDriver(new HelloWorldExecutor());
    System.exit(driver.run() == Protos.Status.DRIVER_STOPPED ? 0 : 1);
}