Search in sources :

Example 1 with SingularityMesosClientModule

use of com.hubspot.mesos.client.SingularityMesosClientModule in project Singularity by HubSpot.

the class SingularityServiceModule method configure.

@Override
public void configure(Binder binder) {
    SingularityConfiguration configuration = getConfiguration();
    binder.install(new SingularityMainModule(getConfiguration(), lbClientClass.orElseGet(() -> configuration.getLoadBalancerUri() != null ? BaragonLoadBalancerClientImpl.class : NoOpLoadBalancerClient.class)));
    binder.install(new SingularityDataModule(getConfiguration()));
    binder.install(new SingularitySchedulerModule());
    binder.install(new SingularityResourceModule(getConfiguration().getUiConfiguration()));
    binder.install(new SingularityTranscoderModule());
    binder.install(new SingularityHistoryModule());
    binder.install(dbModuleProvider.apply(getConfiguration()));
    binder.install(new SingularityMesosModule());
    binder.install(new SingularityZkMigrationsModule());
    binder.install(new SingularityJerseyModule());
    MesosConfiguration mesosConfiguration = getConfiguration().getMesosConfiguration();
    if (mesosConfiguration.getMesosUsername().isPresent() && mesosConfiguration.getMesosPassword().isPresent()) {
        binder.install(new SingularityMesosClientModule(new UserAndPassword(mesosConfiguration.getMesosUsername().get(), mesosConfiguration.getMesosPassword().get())));
    } else {
        binder.install(new SingularityMesosClientModule());
    }
    // API Docs
    getEnvironment().jersey().register(SingularityOpenApiResource.class);
    binder.install(new SingularityEventModule(getConfiguration().getWebhookQueueConfiguration()));
}
Also used : BaragonLoadBalancerClientImpl(com.hubspot.singularity.hooks.BaragonLoadBalancerClientImpl) SingularityResourceModule(com.hubspot.singularity.resources.SingularityResourceModule) SingularityDataModule(com.hubspot.singularity.data.SingularityDataModule) SingularityHistoryModule(com.hubspot.singularity.data.history.SingularityHistoryModule) NoOpLoadBalancerClient(com.hubspot.singularity.hooks.NoOpLoadBalancerClient) UserAndPassword(com.hubspot.mesos.client.UserAndPassword) SingularityZkMigrationsModule(com.hubspot.singularity.data.zkmigrations.SingularityZkMigrationsModule) MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) SingularityTranscoderModule(com.hubspot.singularity.data.transcoders.SingularityTranscoderModule) SingularitySchedulerModule(com.hubspot.singularity.scheduler.SingularitySchedulerModule) SingularityMesosModule(com.hubspot.singularity.mesos.SingularityMesosModule) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration) SingularityMesosClientModule(com.hubspot.mesos.client.SingularityMesosClientModule) SingularityJerseyModule(com.hubspot.singularity.jersey.SingularityJerseyModule) SingularityEventModule(com.hubspot.singularity.event.SingularityEventModule)

Example 2 with SingularityMesosClientModule

use of com.hubspot.mesos.client.SingularityMesosClientModule in project Singularity by HubSpot.

the class SingularityExecutorCleanupRunner method main.

public static void main(String... args) {
    final long start = System.currentTimeMillis();
    try {
        final Injector injector = Guice.createInjector(Stage.PRODUCTION, new SingularityRunnerBaseModule(SingularityExecutorCleanupConfiguration.class, ImmutableSet.of(SingularityS3Configuration.class, SingularityExecutorConfiguration.class)), new SingularityExecutorModule(), new SingularityExecutorCleanupModule(), new SingularityClientModule(), new SingularityMesosClientModule());
        final SingularityExecutorCleanupRunner runner = injector.getInstance(SingularityExecutorCleanupRunner.class);
        LOG.info("Starting cleanup");
        final SingularityExecutorCleanupStatistics statistics = runner.cleanup();
        LOG.info("Finished with {} after {}", statistics, JavaUtils.duration(start));
        System.exit(0);
    } catch (Throwable t) {
        LOG.error("Finished after {} with error", JavaUtils.duration(start), t);
        System.exit(1);
    }
}
Also used : SingularityExecutorCleanupConfiguration(com.hubspot.singularity.executor.cleanup.config.SingularityExecutorCleanupConfiguration) SingularityClientModule(com.hubspot.singularity.client.SingularityClientModule) Injector(com.google.inject.Injector) SingularityRunnerBaseModule(com.hubspot.singularity.runner.base.config.SingularityRunnerBaseModule) SingularityExecutorCleanupModule(com.hubspot.singularity.executor.cleanup.config.SingularityExecutorCleanupModule) SingularityExecutorCleanupStatistics(com.hubspot.singularity.executor.SingularityExecutorCleanupStatistics) SingularityExecutorModule(com.hubspot.singularity.executor.config.SingularityExecutorModule) SingularityMesosClientModule(com.hubspot.mesos.client.SingularityMesosClientModule)

Aggregations

SingularityMesosClientModule (com.hubspot.mesos.client.SingularityMesosClientModule)2 Injector (com.google.inject.Injector)1 UserAndPassword (com.hubspot.mesos.client.UserAndPassword)1 SingularityClientModule (com.hubspot.singularity.client.SingularityClientModule)1 MesosConfiguration (com.hubspot.singularity.config.MesosConfiguration)1 SingularityConfiguration (com.hubspot.singularity.config.SingularityConfiguration)1 SingularityDataModule (com.hubspot.singularity.data.SingularityDataModule)1 SingularityHistoryModule (com.hubspot.singularity.data.history.SingularityHistoryModule)1 SingularityTranscoderModule (com.hubspot.singularity.data.transcoders.SingularityTranscoderModule)1 SingularityZkMigrationsModule (com.hubspot.singularity.data.zkmigrations.SingularityZkMigrationsModule)1 SingularityEventModule (com.hubspot.singularity.event.SingularityEventModule)1 SingularityExecutorCleanupStatistics (com.hubspot.singularity.executor.SingularityExecutorCleanupStatistics)1 SingularityExecutorCleanupConfiguration (com.hubspot.singularity.executor.cleanup.config.SingularityExecutorCleanupConfiguration)1 SingularityExecutorCleanupModule (com.hubspot.singularity.executor.cleanup.config.SingularityExecutorCleanupModule)1 SingularityExecutorModule (com.hubspot.singularity.executor.config.SingularityExecutorModule)1 BaragonLoadBalancerClientImpl (com.hubspot.singularity.hooks.BaragonLoadBalancerClientImpl)1 NoOpLoadBalancerClient (com.hubspot.singularity.hooks.NoOpLoadBalancerClient)1 SingularityJerseyModule (com.hubspot.singularity.jersey.SingularityJerseyModule)1 SingularityMesosModule (com.hubspot.singularity.mesos.SingularityMesosModule)1 SingularityResourceModule (com.hubspot.singularity.resources.SingularityResourceModule)1