Search in sources :

Example 1 with BaseRunnerConfiguration

use of com.hubspot.singularity.runner.base.configuration.BaseRunnerConfiguration in project Singularity by HubSpot.

the class SingularityExecutorRunner method main.

public static void main(String... args) {
    final long start = System.currentTimeMillis();
    try {
        final Injector injector = Guice.createInjector(Stage.PRODUCTION, new SingularityRunnerBaseModule(SingularityExecutorConfiguration.class, ImmutableSet.<Class<? extends BaseRunnerConfiguration>>of(SingularityS3Configuration.class)), new SingularityExecutorModule());
        final SingularityExecutorRunner executorRunner = injector.getInstance(SingularityExecutorRunner.class);
        final LocalDownloadServiceFetcher downloadServiceFetcher = injector.getInstance(LocalDownloadServiceFetcher.class);
        downloadServiceFetcher.start();
        final Protos.Status driverStatus = executorRunner.run();
        LOG.info("Executor finished after {} with status: {}", JavaUtils.duration(start), driverStatus);
        downloadServiceFetcher.stop();
        stopLog();
        System.exit(driverStatus == Protos.Status.DRIVER_STOPPED ? 0 : 1);
    } catch (Throwable t) {
        LOG.error("Finished after {} with error", JavaUtils.duration(start), t);
        stopLog();
        System.exit(1);
    }
}
Also used : SingularityExecutorConfiguration(com.hubspot.singularity.executor.config.SingularityExecutorConfiguration) BaseRunnerConfiguration(com.hubspot.singularity.runner.base.configuration.BaseRunnerConfiguration) Protos(org.apache.mesos.Protos) Injector(com.google.inject.Injector) SingularityRunnerBaseModule(com.hubspot.singularity.runner.base.config.SingularityRunnerBaseModule) SingularityExecutorModule(com.hubspot.singularity.executor.config.SingularityExecutorModule) LocalDownloadServiceFetcher(com.hubspot.singularity.executor.task.LocalDownloadServiceFetcher)

Example 2 with BaseRunnerConfiguration

use of com.hubspot.singularity.runner.base.configuration.BaseRunnerConfiguration in project Singularity by HubSpot.

the class SingularityRunnerBaseLogging method printProperties.

public void printProperties() {
    for (BaseRunnerConfiguration configuration : configurations) {
        try {
            final Configuration annotation = configuration.getClass().getAnnotation(Configuration.class);
            final String filename = consolidatedConfigFilename.orElse(annotation == null ? "(unknown)" : annotation.filename());
            LOG.trace(String.format("Loaded %s from %s:%n%s", configuration.getClass().getSimpleName(), filename, yamlMapper.writeValueAsString(configuration)));
        } catch (Exception e) {
            LOG.warn(String.format("Exception while attempting to print %s!", configuration.getClass().getName()), e);
        }
    }
}
Also used : BaseRunnerConfiguration(com.hubspot.singularity.runner.base.configuration.BaseRunnerConfiguration) BaseRunnerConfiguration(com.hubspot.singularity.runner.base.configuration.BaseRunnerConfiguration) SingularityRunnerBaseConfiguration(com.hubspot.singularity.runner.base.configuration.SingularityRunnerBaseConfiguration) Configuration(com.hubspot.singularity.runner.base.configuration.Configuration)

Aggregations

BaseRunnerConfiguration (com.hubspot.singularity.runner.base.configuration.BaseRunnerConfiguration)2 Injector (com.google.inject.Injector)1 SingularityExecutorConfiguration (com.hubspot.singularity.executor.config.SingularityExecutorConfiguration)1 SingularityExecutorModule (com.hubspot.singularity.executor.config.SingularityExecutorModule)1 LocalDownloadServiceFetcher (com.hubspot.singularity.executor.task.LocalDownloadServiceFetcher)1 SingularityRunnerBaseModule (com.hubspot.singularity.runner.base.config.SingularityRunnerBaseModule)1 Configuration (com.hubspot.singularity.runner.base.configuration.Configuration)1 SingularityRunnerBaseConfiguration (com.hubspot.singularity.runner.base.configuration.SingularityRunnerBaseConfiguration)1 Protos (org.apache.mesos.Protos)1