本文整理汇总了Java中org.apache.mesos.MesosExecutorDriver类的典型用法代码示例。如果您正苦于以下问题:Java MesosExecutorDriver类的具体用法?Java MesosExecutorDriver怎么用?Java MesosExecutorDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MesosExecutorDriver类属于org.apache.mesos包,在下文中一共展示了MesosExecutorDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
public static void main(String[] args) {
System.out.println("Starting executor");
if (new File("config").mkdir()) {
System.out.println("Created config directory");
}
MustacheFactory mustacheFactory = new DefaultMustacheFactory();
final Mustache filebeatMustache = mustacheFactory.compile("filebeat.yaml.mustache");
final Mustache metricbeatMustache = mustacheFactory.compile("metricbeat.yaml.mustache");
try {
MesosExecutorDriver driver = new MesosExecutorDriver(new HumioExecutor(filebeatMustache, metricbeatMustache));
final Protos.Status status = driver.run();
System.out.println("status = " + status);
if (status.equals(Protos.Status.DRIVER_STOPPED)) {
System.exit(0);
} else {
System.err.println("Error: " + status);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: run
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
public Protos.Status run() {
LOG.info("{} starting MesosExecutorDriver...", name);
final MesosExecutorDriver driver = new MesosExecutorDriver(singularityExecutor);
Runtime.getRuntime().addShutdownHook(new Thread("SingularityExecutorRunnerGracefulShutdown") {
@Override
public void run() {
LOG.info("Executor is shutting down, ensuring shutdown via shutdown hook");
monitor.shutdown(Optional.of((ExecutorDriver) driver));
}
});
return driver.run();
}
示例3: prepare
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
@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();
if (startLogViewer(conf)) {
LOG.info("Starting logviewer...");
LogViewerController logController = new LogViewerController(conf);
logController.start();
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
LOG.info("Executor initialized...");
Thread suicide = new SuicideDetector(conf);
suicide.setDaemon(true);
suicide.start();
}
示例4: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
public static void main(final String[] args) {
final MesosExecutorDriver driver = new MesosExecutorDriver(new HazelcastExecutor());
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);
}
示例5: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
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);
}
示例6: run
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
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();
}
示例7: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
public static void main(String[] args) {
BasicConfigurator.configure(); // log4j setup
LOGGER.info("Starting Executer");
MesosExecutorDriver driver = new MesosExecutorDriver(new EchoExecutor());
System.exit(driver.run() == Protos.Status.DRIVER_STOPPED ? 0 : 1);
}
示例8: addShutdownHook
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
private static void addShutdownHook(final CrateExecutor executor, final MesosExecutorDriver driver) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
executor.forceShutdownCrate(driver);
}
});
}
示例9: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
/**
* Main method for executor.
*/
public static void main(String[] args) throws IOException {
BasicConfigurator.configure();
LOGGER.debug("Launch executor process ...");
final CrateExecutor executor = new CrateExecutor();
MesosExecutorDriver driver = new MesosExecutorDriver(executor);
addShutdownHook(executor, driver);
System.exit(driver.run() == Status.DRIVER_STOPPED ? 0 : 1);
}
示例10: run
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
public void run() {
DockerClient dockerClient = new DockerClient();
FileLogSteamWriter writer = new FileLogSteamWriter(MAX_LOG_SIZE);
DockerStreamer streamer = new DockerStreamer(writer, dockerClient);
DockerLogStreamManager streamManager = new DockerLogStreamManager(streamer);
LogstashService logstashService = new LogstashService(dockerClient);
logstashService.start();
ConfigManager configManager = new ConfigManager(logstashService, dockerClient, streamManager);
LiveState liveState = new LiveState(logstashService, dockerClient, streamManager);
LogstashExecutor executor = new LogstashExecutor(configManager, dockerClient, liveState);
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);
}
}
示例11: run
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
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);
}
}
示例12: serviceStart
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
@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();
}
示例13: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
/**
* Main method for executor, which injects the configuration and state and starts the driver.
*/
public static void main(String[] args) {
Injector injector = Guice.createInjector();
MesosExecutorDriver driver = new MesosExecutorDriver(injector.getInstance(NodeExecutor.class));
System.exit(driver.run() == Status.DRIVER_STOPPED ? 0 : 1);
}
示例14: main
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
/**
* Main method which injects the configuration and state and creates the driver.
*/
public static void main(String[] args) {
Injector injector = Guice.createInjector();
MesosExecutorDriver driver = new MesosExecutorDriver(
injector.getInstance(AbstractNodeExecutor.class));
System.exit(driver.run() == Status.DRIVER_STOPPED ? 0 : 1);
}
示例15: REEFExecutor
import org.apache.mesos.MesosExecutorDriver; //导入依赖的package包/类
@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;
}