in modules/mesos-ext/src/main/java/org/apache/ignite/mesos/IgniteFramework.java [64:124]
public static void main(String[] args) throws Exception {
IgniteFramework igniteFramework = new IgniteFramework();
ClusterProperties clusterProps = ClusterProperties.from(args.length >= 1 ? args[0] : null);
String baseUrl = String.format("http://%s:%d", clusterProps.httpServerHost(), clusterProps.httpServerPort());
JettyServer httpSrv = new JettyServer();
httpSrv.start(
new ResourceHandler(clusterProps.userLibs(), clusterProps.igniteCfg(), clusterProps.igniteWorkDir()),
clusterProps
);
ResourceProvider provider = new ResourceProvider();
IgniteProvider igniteProvider = new IgniteProvider(clusterProps.igniteWorkDir());
provider.init(clusterProps, igniteProvider, baseUrl);
// Create the scheduler.
Scheduler scheduler = new IgniteScheduler(clusterProps, provider);
// Create the driver.
MesosSchedulerDriver driver;
if (System.getenv(MESOS_AUTHENTICATE) != null) {
log.info("Enabling authentication for the framework");
if (System.getenv(DEFAULT_PRINCIPAL) == null) {
log.log(Level.SEVERE, "Expecting authentication principal in the environment");
System.exit(1);
}
if (System.getenv(DEFAULT_SECRET) == null) {
log.log(Level.SEVERE, "Expecting authentication secret in the environment");
System.exit(1);
}
Protos.Credential cred = Protos.Credential.newBuilder()
.setPrincipal(System.getenv(DEFAULT_PRINCIPAL))
.setSecret(System.getenv(DEFAULT_SECRET))
.build();
driver = new MesosSchedulerDriver(scheduler, igniteFramework.getFrameworkInfo(), clusterProps.masterUrl(),
cred);
}
else
driver = new MesosSchedulerDriver(scheduler, igniteFramework.getFrameworkInfo(), clusterProps.masterUrl());
int status = driver.run() == Protos.Status.DRIVER_STOPPED ? 0 : 1;
httpSrv.stop();
// Ensure that the driver process terminates.
driver.stop();
System.exit(status);
}