Repository: aurora Updated Branches: refs/heads/master c8e65d33e -> f28564782
Remove unused components from the scheduler application stack. Reviewed at https://reviews.apache.org/r/37987/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/f2856478 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/f2856478 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/f2856478 Branch: refs/heads/master Commit: f28564782f0cc9868dfe1f2b5375e4991f8643a9 Parents: c8e65d3 Author: Bill Farner <[email protected]> Authored: Mon Aug 31 22:09:17 2015 -0700 Committer: Bill Farner <[email protected]> Committed: Mon Aug 31 22:09:17 2015 -0700 ---------------------------------------------------------------------- .../thrift/org/apache/aurora/gen/storage.thrift | 10 - .../common/application/AbstractApplication.java | 29 --- .../aurora/common/application/AppLauncher.java | 119 ++------- .../application/modules/AppLauncherModule.java | 6 +- .../application/modules/LifecycleModule.java | 47 ---- .../modules/LocalServiceRegistry.java | 247 ------------------- .../common/application/modules/StatsModule.java | 35 --- .../apache/aurora/common/util/BuildInfo.java | 108 -------- .../common/application/AppLauncherTest.java | 74 ------ .../modules/LifecycleModuleTest.java | 109 -------- .../modules/LocalServiceRegistryTest.java | 147 ----------- .../modules/StartStatPollerTest.java | 63 ----- .../aurora/scheduler/app/SchedulerMain.java | 6 +- .../storage/log/SnapshotStoreImpl.java | 9 - 14 files changed, 28 insertions(+), 981 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/api/src/main/thrift/org/apache/aurora/gen/storage.thrift ---------------------------------------------------------------------- diff --git a/api/src/main/thrift/org/apache/aurora/gen/storage.thrift b/api/src/main/thrift/org/apache/aurora/gen/storage.thrift index b7c4665..670ba08 100644 --- a/api/src/main/thrift/org/apache/aurora/gen/storage.thrift +++ b/api/src/main/thrift/org/apache/aurora/gen/storage.thrift @@ -127,16 +127,6 @@ struct StoredCronJob { struct SchedulerMetadata { 1: string frameworkId - // The SHA of the repo. - 2: string revision - // The tag of the repo. - 3: string tag - // The timestamp of the build. - 4: string timestamp - // The user who built the scheduler - 5: string user - // The machine that built the scheduler - 6: string machine 7: api.APIVersion version } http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/application/AbstractApplication.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/application/AbstractApplication.java b/commons/src/main/java/org/apache/aurora/common/application/AbstractApplication.java deleted file mode 100644 index afb3691..0000000 --- a/commons/src/main/java/org/apache/aurora/common/application/AbstractApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.application; - -import java.util.Collections; - -import com.google.inject.Module; - -/** - * A base application class that provides empty implementations of all but the {@link #run()} - * method. - */ -public abstract class AbstractApplication implements Application { - @Override - public Iterable<? extends Module> getModules() { - return Collections.emptyList(); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/application/AppLauncher.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/application/AppLauncher.java b/commons/src/main/java/org/apache/aurora/common/application/AppLauncher.java index c842f42..78ed7d0 100644 --- a/commons/src/main/java/org/apache/aurora/common/application/AppLauncher.java +++ b/commons/src/main/java/org/apache/aurora/common/application/AppLauncher.java @@ -13,22 +13,17 @@ */ package org.apache.aurora.common.application; -import java.lang.reflect.Field; import java.util.Arrays; -import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.inject.Guice; -import com.google.inject.Inject; import com.google.inject.Injector; +import com.google.inject.Key; import com.google.inject.Module; -import com.google.inject.Stage; import com.google.inject.util.Modules; import org.apache.aurora.common.application.modules.AppLauncherModule; @@ -38,7 +33,6 @@ import org.apache.aurora.common.args.ArgFilters; import org.apache.aurora.common.args.ArgScanner; import org.apache.aurora.common.args.ArgScanner.ArgScanException; import org.apache.aurora.common.args.CmdLine; -import org.apache.aurora.common.args.constraints.NotNull; import org.apache.aurora.common.base.ExceptionalCommand; /** @@ -59,41 +53,34 @@ public final class AppLauncher { private static final Logger LOG = Logger.getLogger(AppLauncher.class.getName()); - private static final String APP_CLASS_NAME = "app_class"; - @NotNull - @CmdLine(name = APP_CLASS_NAME, - help = "Fully-qualified name of the application class, which must implement Runnable.") - private static final Arg<Class<? extends Application>> APP_CLASS = Arg.create(); - - @CmdLine(name = "guice_stage", - help = "Guice development stage to create injector with.") - private static final Arg<Stage> GUICE_STAGE = Arg.create(Stage.DEVELOPMENT); - - private static final Predicate<Field> SELECT_APP_CLASS = - ArgFilters.selectCmdLineArg(AppLauncher.class, APP_CLASS_NAME); - - @Inject @StartupStage private ExceptionalCommand startupCommand; - @Inject private Lifecycle lifecycle; - private AppLauncher() { // This should not be invoked directly. } private void run(Application application) { + Lifecycle lifecycle = null; try { - configureInjection(application); + Iterable<Module> modules = ImmutableList.<Module>builder() + .add(new LifecycleModule()) + .add(new AppLauncherModule()) + .addAll(application.getModules()) + .build(); + + Injector injector = Guice.createInjector(Modules.combine(modules)); + + ExceptionalCommand startupCommand = + injector.getInstance(Key.get(ExceptionalCommand.class, StartupStage.class)); + lifecycle = injector.getInstance(Lifecycle.class); + + injector.injectMembers(application); LOG.info("Executing startup actions."); - // We're an app framework and this is the outer shell - it makes sense to handle all errors - // before exiting. - // SUPPRESS CHECKSTYLE:OFF IllegalCatch try { startupCommand.execute(); } catch (Exception e) { LOG.log(Level.SEVERE, "Startup action failed, quitting.", e); throw Throwables.propagate(e); } - // SUPPRESS CHECKSTYLE:ON IllegalCatch try { application.run(); @@ -107,85 +94,21 @@ public final class AppLauncher { } } - private void configureInjection(Application application) { - Iterable<Module> modules = ImmutableList.<Module>builder() - .add(new LifecycleModule()) - .add(new AppLauncherModule()) - .addAll(application.getModules()) - .build(); - - Injector injector = Guice.createInjector(GUICE_STAGE.get(), Modules.combine(modules)); - injector.injectMembers(this); - injector.injectMembers(application); - } - - public static void main(String... args) throws IllegalAccessException, InstantiationException { - // TODO(John Sirois): Support a META-INF/MANIFEST.MF App-Class attribute to allow java -jar - parseArgs(ArgFilters.SELECT_ALL, Arrays.asList(args)); - new AppLauncher().run(APP_CLASS.get().newInstance()); - } - - /** - * A convenience for main wrappers. Equivalent to: - * <pre> - * AppLauncher.launch(appClass, ArgFilters.SELECT_ALL, Arrays.asList(args)); - * </pre> - * - * @param appClass The application class to instantiate and launch. - * @param args The command line arguments to parse. - * @see ArgFilters - */ - public static void launch(Class<? extends Application> appClass, String... args) { - launch(appClass, ArgFilters.SELECT_ALL, Arrays.asList(args)); - } - - /** - * A convenience for main wrappers. Equivalent to: - * <pre> - * AppLauncher.launch(appClass, argFilter, Arrays.asList(args)); - * </pre> - * - * @param appClass The application class to instantiate and launch. - * @param argFilter A filter that selects the {@literal @CmdLine} {@link Arg}s to enable for - * parsing. - * @param args The command line arguments to parse. - * @see ArgFilters - */ - public static void launch(Class<? extends Application> appClass, Predicate<Field> argFilter, - String... args) { - launch(appClass, argFilter, Arrays.asList(args)); - } - /** * Used to launch an application with a restricted set of {@literal @CmdLine} {@link Arg}s * considered for parsing. This is useful if the classpath includes annotated fields you do not * wish arguments to be parsed for. * * @param appClass The application class to instantiate and launch. - * @param argFilter A filter that selects the {@literal @CmdLine} {@link Arg}s to enable for - * parsing. * @param args The command line arguments to parse. * @see ArgFilters */ - public static void launch(Class<? extends Application> appClass, Predicate<Field> argFilter, - List<String> args) { + public static void launch(Class<? extends Application> appClass, String... args) { Preconditions.checkNotNull(appClass); - Preconditions.checkNotNull(argFilter); Preconditions.checkNotNull(args); - parseArgs(Predicates.<Field>and(Predicates.not(SELECT_APP_CLASS), argFilter), args); try { - new AppLauncher().run(appClass.newInstance()); - } catch (InstantiationException e) { - throw new IllegalStateException(e); - } catch (IllegalAccessException e) { - throw new IllegalStateException(e); - } - } - - private static void parseArgs(Predicate<Field> filter, List<String> args) { - try { - if (!new ArgScanner().parse(filter, args)) { + if (!new ArgScanner().parse(Arrays.asList(args))) { System.exit(0); } } catch (ArgScanException e) { @@ -193,6 +116,14 @@ public final class AppLauncher { } catch (IllegalArgumentException e) { exit("Failed to apply arguments", e); } + + try { + new AppLauncher().run(appClass.newInstance()); + } catch (InstantiationException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } } private static void exit(String message, Exception error) { http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/application/modules/AppLauncherModule.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/AppLauncherModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/AppLauncherModule.java index 65e9250..1c08f7e 100644 --- a/commons/src/main/java/org/apache/aurora/common/application/modules/AppLauncherModule.java +++ b/commons/src/main/java/org/apache/aurora/common/application/modules/AppLauncherModule.java @@ -19,12 +19,9 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.google.inject.AbstractModule; -import com.google.inject.Singleton; - -import org.apache.aurora.common.stats.Stats; -import org.apache.aurora.common.util.BuildInfo; import org.apache.aurora.common.application.AppLauncher; +import org.apache.aurora.common.stats.Stats; /** * Binding module for the bare minimum requirements for the @@ -39,7 +36,6 @@ public class AppLauncherModule extends AbstractModule { @Override protected void configure() { - bind(BuildInfo.class).in(Singleton.class); bind(UncaughtExceptionHandler.class).to(LoggingExceptionHandler.class); } http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java index 6414208..1b6bd08 100644 --- a/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java +++ b/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java @@ -16,7 +16,6 @@ package org.apache.aurora.common.application.modules; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import com.google.common.annotations.VisibleForTesting; import com.google.inject.AbstractModule; import com.google.inject.Binder; import com.google.inject.BindingAnnotation; @@ -30,7 +29,6 @@ import org.apache.aurora.common.application.ShutdownRegistry; import org.apache.aurora.common.application.ShutdownStage; import org.apache.aurora.common.application.StartupRegistry; import org.apache.aurora.common.application.StartupStage; - import org.apache.aurora.common.base.Command; import org.apache.aurora.common.base.ExceptionalCommand; @@ -50,10 +48,6 @@ import static com.google.common.base.Preconditions.checkNotNull; * <li>{@code ShutdownRegistry} - Registry for adding shutdown actions. * <li>{@code @ShutdownStage Command} - Command to execute all shutdown commands. * </ul> - * - * If you would like to register a startup action that starts a local network service, please - * consider using {@link LocalServiceRegistry}. - * * @author William Farner */ public class LifecycleModule extends AbstractModule { @@ -78,13 +72,6 @@ public class LifecycleModule extends AbstractModule { bind(Key.get(Command.class, ShutdownStage.class)).to(ShutdownRegistry.ShutdownRegistryImpl.class); bind(ShutdownRegistry.ShutdownRegistryImpl.class).in(Singleton.class); bindStartupAction(binder(), ShutdownHookRegistration.class); - - bind(LocalServiceRegistry.class).in(Singleton.class); - - // Ensure that there is at least an empty set for the service runners. - runnerBinder(binder()); - - bindStartupAction(binder(), LocalServiceLauncher.class); } /** @@ -101,25 +88,6 @@ public class LifecycleModule extends AbstractModule { } /** - * Responsible for starting and stopping a local service. - */ - public interface ServiceRunner { - - /** - * Launches the local service. - * - * @return Information about the launched service. - * @throws LaunchException If the service failed to launch. - */ - LocalServiceRegistry.LocalService launch() throws LaunchException; - } - - @VisibleForTesting - static Multibinder<ServiceRunner> runnerBinder(Binder binder) { - return Multibinder.newSetBinder(binder, ServiceRunner.class, Service.class); - } - - /** * Adds a startup action to the startup registry binding. * * @param binder Binder to bind against. @@ -150,19 +118,4 @@ public class LifecycleModule extends AbstractModule { }, "ShutdownRegistry-Hook")); } } - - /** - * Startup command that ensures startup and shutdown of local services. - */ - private static class LocalServiceLauncher implements Command { - private final LocalServiceRegistry serviceRegistry; - - @Inject LocalServiceLauncher(LocalServiceRegistry serviceRegistry) { - this.serviceRegistry = checkNotNull(serviceRegistry); - } - - @Override public void execute() { - serviceRegistry.ensureLaunched(); - } - } } http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/application/modules/LocalServiceRegistry.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/LocalServiceRegistry.java b/commons/src/main/java/org/apache/aurora/common/application/modules/LocalServiceRegistry.java deleted file mode 100644 index 806951b..0000000 --- a/commons/src/main/java/org/apache/aurora/common/application/modules/LocalServiceRegistry.java +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.application.modules; - -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; -import com.google.inject.Inject; -import com.google.inject.Provider; - -import org.apache.aurora.common.application.ShutdownRegistry; -import org.apache.commons.lang.builder.ToStringBuilder; - -import org.apache.aurora.common.application.modules.LifecycleModule.LaunchException; -import org.apache.aurora.common.application.modules.LifecycleModule.Service; -import org.apache.aurora.common.application.modules.LifecycleModule.ServiceRunner; -import org.apache.aurora.common.base.Command; -import org.apache.aurora.common.base.MorePreconditions; -import org.apache.aurora.common.net.InetSocketAddressHelper; - -/** - * Registry for services that should be exported from the application. - * - * Example of announcing and registering a port: - * <pre> - * class MyLauncher implements Provider<LocalService> { - * public LocalService get() { - * // Launch service. - * } - * } - * - * class MyServiceModule extends AbstractModule { - * public void configure() { - * LifeCycleModule.bindServiceLauncher(binder(), MyLauncher.class); - * } - * } - * </pre> - */ -public class LocalServiceRegistry { - - private static final Predicate<LocalService> IS_PRIMARY = new Predicate<LocalService>() { - @Override public boolean apply(LocalService service) { - return service.primary; - } - }; - - private static final Function<LocalService, InetSocketAddress> SERVICE_TO_SOCKET = - new Function<LocalService, InetSocketAddress>() { - @Override public InetSocketAddress apply(LocalService service) { - try { - return InetSocketAddressHelper.getLocalAddress(service.port); - } catch (UnknownHostException e) { - throw new RuntimeException("Failed to resolve local address for " + service, e); - } - } - }; - - private static final Function<LocalService, String> GET_NAME = - new Function<LocalService, String>() { - @Override public String apply(LocalService service) { - return Iterables.getOnlyElement(service.names); - } - }; - - private final ShutdownRegistry shutdownRegistry; - private final Provider<Set<ServiceRunner>> runnerProvider; - - private Optional<InetSocketAddress> primarySocket = null; - private Map<String, InetSocketAddress> auxiliarySockets = null; - - /** - * Creates a new local service registry. - * - * @param runnerProvider provider of registered local services. - * @param shutdownRegistry Shutdown registry to tear down launched services. - */ - @Inject - public LocalServiceRegistry(@Service Provider<Set<ServiceRunner>> runnerProvider, - ShutdownRegistry shutdownRegistry) { - this.runnerProvider = Preconditions.checkNotNull(runnerProvider); - this.shutdownRegistry = Preconditions.checkNotNull(shutdownRegistry); - } - - private static final Function<LocalService, Iterable<LocalService>> AUX_NAME_BREAKOUT = - new Function<LocalService, Iterable<LocalService>>() { - @Override public Iterable<LocalService> apply(final LocalService service) { - Preconditions.checkArgument(!service.primary); - Function<String, LocalService> oneNameService = new Function<String, LocalService>() { - @Override public LocalService apply(String name) { - return LocalService.auxiliaryService(name, service.port, service.shutdownCommand); - } - }; - return Iterables.transform(service.names, oneNameService); - } - }; - - /** - * Launches the local services if not already launched, otherwise this is a no-op. - */ - void ensureLaunched() { - if (primarySocket == null) { - ImmutableList.Builder<LocalService> builder = ImmutableList.builder(); - - for (ServiceRunner runner : runnerProvider.get()) { - try { - LocalService service = runner.launch(); - builder.add(service); - shutdownRegistry.addAction(service.shutdownCommand); - } catch (LaunchException e) { - throw new IllegalStateException("Failed to launch " + runner, e); - } - } - - List<LocalService> localServices = builder.build(); - Iterable<LocalService> primaries = Iterables.filter(localServices, IS_PRIMARY); - switch (Iterables.size(primaries)) { - case 0: - primarySocket = Optional.absent(); - break; - - case 1: - primarySocket = Optional.of(SERVICE_TO_SOCKET.apply(Iterables.getOnlyElement(primaries))); - break; - - default: - throw new IllegalArgumentException("More than one primary local service: " + primaries); - } - - Iterable<LocalService> auxSinglyNamed = Iterables.concat( - FluentIterable.from(localServices) - .filter(Predicates.not(IS_PRIMARY)) - .transform(AUX_NAME_BREAKOUT)); - - Map<String, LocalService> byName; - try { - byName = Maps.uniqueIndex(auxSinglyNamed, GET_NAME); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Auxiliary services with identical names.", e); - } - - auxiliarySockets = ImmutableMap.copyOf(Maps.transformValues(byName, SERVICE_TO_SOCKET)); - } - } - - /** - * Gets the mapping from auxiliary port name to socket. - * - * @return Auxiliary port mapping. - */ - public synchronized Map<String, InetSocketAddress> getAuxiliarySockets() { - ensureLaunched(); - return auxiliarySockets; - } - - /** - * Gets the optional primary socket address, and returns an unresolved local socket address - * representing that port. - * - * @return Local socket address for the primary port. - * @throws IllegalStateException If the primary port was not set. - */ - public synchronized Optional<InetSocketAddress> getPrimarySocket() { - ensureLaunched(); - return primarySocket; - } - - /** - * An individual local service. - */ - public static final class LocalService { - private final boolean primary; - private final Set<String> names; - private final int port; - private final Command shutdownCommand; - - private LocalService(boolean primary, Set<String> names, int port, - Command shutdownCommand) { - this.primary = primary; - this.names = names; - this.port = port; - this.shutdownCommand = Preconditions.checkNotNull(shutdownCommand); - } - - @Override - public String toString() { - return new ToStringBuilder(this) - .append("primary", primary) - .append("name", names) - .append("port", port) - .toString(); - } - - /** - * Creates a named auxiliary service. - * - * @param name Service name. - * @param port Service port. - * @param shutdownCommand A command that will shut down the service. - * @return A new auxiliary local service. - */ - public static LocalService auxiliaryService(String name, int port, Command shutdownCommand) { - return auxiliaryService(ImmutableSet.of(name), port, shutdownCommand); - } - - /** - * Creates an auxiliary service identified by multiple names. - * - * @param names Service names. - * @param port Service port. - * @param shutdownCommand A command that will shut down the service. - * @return A new auxiliary local service. - */ - public static LocalService auxiliaryService( - Set<String> names, - int port, - Command shutdownCommand) { - - MorePreconditions.checkNotBlank(names); - return new LocalService(false, names, port, shutdownCommand); - } - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/application/modules/StatsModule.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/StatsModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/StatsModule.java index 78d9512..3959ce3 100644 --- a/commons/src/main/java/org/apache/aurora/common/application/modules/StatsModule.java +++ b/commons/src/main/java/org/apache/aurora/common/application/modules/StatsModule.java @@ -13,11 +13,9 @@ */ package org.apache.aurora.common.application.modules; -import java.util.Properties; import java.util.logging.Logger; import com.google.common.base.Supplier; -import com.google.common.primitives.Longs; import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -32,12 +30,10 @@ import org.apache.aurora.common.quantity.Amount; import org.apache.aurora.common.quantity.Time; import org.apache.aurora.common.stats.JvmStats; import org.apache.aurora.common.stats.Stat; -import org.apache.aurora.common.stats.StatImpl; import org.apache.aurora.common.stats.StatRegistry; import org.apache.aurora.common.stats.Stats; import org.apache.aurora.common.stats.TimeSeriesRepository; import org.apache.aurora.common.stats.TimeSeriesRepositoryImpl; -import org.apache.aurora.common.util.BuildInfo; import static com.google.common.base.Preconditions.checkNotNull; @@ -69,14 +65,9 @@ public class StatsModule extends AbstractModule { private static final Arg<Amount<Long, Time>> RETENTION_PERIOD = Arg.create(Amount.of(1L, Time.HOURS)); - public static Amount<Long, Time> getSamplingInterval() { - return SAMPLING_INTERVAL.get(); - } - @Override protected void configure() { requireBinding(ShutdownRegistry.class); - requireBinding(BuildInfo.class); // Bindings for TimeSeriesRepositoryImpl. bind(StatRegistry.class).toInstance(Stats.STAT_REGISTRY); @@ -102,43 +93,17 @@ public class StatsModule extends AbstractModule { public static final class StartStatPoller implements Command { private static final Logger LOG = Logger.getLogger(StartStatPoller.class.getName()); private final ShutdownRegistry shutdownRegistry; - private final BuildInfo buildInfo; private final TimeSeriesRepository timeSeriesRepository; @Inject StartStatPoller( ShutdownRegistry shutdownRegistry, - BuildInfo buildInfo, TimeSeriesRepository timeSeriesRepository) { this.shutdownRegistry = checkNotNull(shutdownRegistry); - this.buildInfo = checkNotNull(buildInfo); this.timeSeriesRepository = checkNotNull(timeSeriesRepository); } @Override public void execute() { - Properties properties = buildInfo.getProperties(); - LOG.info("Build information: " + properties); - for (String name : properties.stringPropertyNames()) { - final String stringValue = properties.getProperty(name); - if (stringValue == null) { - continue; - } - final Long longValue = Longs.tryParse(stringValue); - if (longValue != null) { - Stats.exportStatic(new StatImpl<Long>(Stats.normalizeName(name)) { - @Override public Long read() { - return longValue; - } - }); - } else { - Stats.exportString(new StatImpl<String>(Stats.normalizeName(name)) { - @Override public String read() { - return stringValue; - } - }); - } - } - JvmStats.export(); timeSeriesRepository.start(shutdownRegistry); } http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/main/java/org/apache/aurora/common/util/BuildInfo.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/util/BuildInfo.java b/commons/src/main/java/org/apache/aurora/common/util/BuildInfo.java deleted file mode 100644 index c290d32..0000000 --- a/commons/src/main/java/org/apache/aurora/common/util/BuildInfo.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util; - -import java.io.InputStream; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.google.common.annotations.VisibleForTesting; - -import org.apache.aurora.common.base.MorePreconditions; - -/** - * Handles loading of a build properties file, and provides keys to look up known values in the - * properties. - */ -public class BuildInfo { - - private static final Logger LOG = Logger.getLogger(BuildInfo.class.getName()); - - private static final String DEFAULT_BUILD_PROPERTIES_PATH = "build.properties"; - - private final String resourcePath; - - private Properties properties = null; - - /** - * Creates a build info container that will use the default properties file path. - */ - public BuildInfo() { - this(DEFAULT_BUILD_PROPERTIES_PATH); - } - - /** - * Creates a build info container, reading from the given path. - * - * @param resourcePath The resource path to read build properties from. - */ - public BuildInfo(String resourcePath) { - this.resourcePath = MorePreconditions.checkNotBlank(resourcePath); - } - - @VisibleForTesting - public BuildInfo(Properties properties) { - this.resourcePath = null; - this.properties = properties; - } - - private void fetchProperties() { - properties = new Properties(); - LOG.info("Fetching build properties from " + resourcePath); - InputStream in = ClassLoader.getSystemResourceAsStream(resourcePath); - if (in == null) { - LOG.warning("Failed to fetch build properties from " + resourcePath); - return; - } - - try { - properties.load(in); - } catch (Exception e) { - LOG.log(Level.WARNING, "Failed to load properties file " + resourcePath, e); - } - } - - /** - * Fetches the properties stored in the resource location. - * - * @return The loaded properties, or a default properties object if there was a problem loading - * the specified properties resource. - */ - public Properties getProperties() { - if (properties == null) fetchProperties(); - return properties; - } - - /** - * Values of keys that are expected to exist in the loaded properties file. - */ - public enum Key { - PATH("build.path"), - USER("build.user.name"), - MACHINE("build.machine"), - DATE("build.date"), - TIME("build.time"), - TIMESTAMP("build.timestamp"), - GIT_TAG("build.git.tag"), - GIT_REVISION("build.git.revision"), - GIT_REVISION_NUMBER("build.git.revision.number"), - GIT_BRANCHNAME("build.git.branchname"); - - public final String value; - private Key(String value) { - this.value = value; - } - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/test/java/org/apache/aurora/common/application/AppLauncherTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/application/AppLauncherTest.java b/commons/src/test/java/org/apache/aurora/common/application/AppLauncherTest.java deleted file mode 100644 index d821240..0000000 --- a/commons/src/test/java/org/apache/aurora/common/application/AppLauncherTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.application; - -import java.lang.reflect.Field; - -import com.google.common.base.Predicates; - -import org.junit.Test; - -import org.apache.aurora.common.args.Arg; -import org.apache.aurora.common.args.ArgFilters; -import org.apache.aurora.common.args.CmdLine; -import org.apache.aurora.common.args.constraints.NotNull; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -/** - * @author John Sirois - */ -public class AppLauncherTest { - - public static class TestApp1 extends AbstractApplication { - @NotNull - @CmdLine(name = "user", help = "a username") - static final Arg<String> USER = Arg.create(); - - private static boolean hasRun; - - @Override public void run() { - hasRun = true; - } - } - - @Test - public void testLaunch1() { - AppLauncher.launch(TestApp1.class, ArgFilters.selectClass(TestApp1.class), "-user", "jake"); - assertTrue(TestApp1.hasRun); - assertEquals("jake", TestApp1.USER.get()); - } - - public static class TestApp2 extends AbstractApplication { - @NotNull - @CmdLine(name = "user", help = "a username") - static final Arg<String> USER = Arg.create(null); - - private static boolean hasRun; - - @Override public void run() { - hasRun = true; - } - } - - @Test - public void testLaunch2() { - // We filter out the NotNull Arg so we should be able to launch without specifying it. - AppLauncher.launch(TestApp2.class, Predicates.<Field>alwaysFalse()); - assertTrue(TestApp2.hasRun); - assertNull(TestApp2.USER.get()); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java b/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java deleted file mode 100644 index 940607e..0000000 --- a/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.application.modules; - -import java.lang.Thread.UncaughtExceptionHandler; -import java.net.InetSocketAddress; - -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableMap; -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Module; - -import org.apache.aurora.common.application.ShutdownRegistry; -import org.apache.aurora.common.application.modules.LifecycleModule.LaunchException; -import org.apache.aurora.common.application.modules.LifecycleModule.ServiceRunner; -import org.apache.aurora.common.application.modules.LocalServiceRegistry.LocalService; -import org.apache.aurora.common.base.Command; -import org.apache.aurora.common.testing.easymock.EasyMockTest; -import org.junit.Test; - -import static org.apache.aurora.common.net.InetSocketAddressHelper.getLocalAddress; -import static org.easymock.EasyMock.expect; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * @author William Farner - */ -public class LifecycleModuleTest extends EasyMockTest { - - private static class SystemModule extends AbstractModule { - @Override protected void configure() { - install(new LifecycleModule()); - bind(UncaughtExceptionHandler.class).toInstance(new UncaughtExceptionHandler() { - @Override public void uncaughtException(Thread thread, Throwable throwable) { - fail("Uncaught exception."); - } - }); - } - } - - @Test - public void testNoServices() { - control.replay(); - - Injector injector = Guice.createInjector(new SystemModule()); - - LocalServiceRegistry registry = injector.getInstance(LocalServiceRegistry.class); - assertEquals(Optional.<InetSocketAddress>absent(), registry.getPrimarySocket()); - assertEquals(ImmutableMap.<String, InetSocketAddress>of(), registry.getAuxiliarySockets()); - } - - @Test - public void testOrdering() throws Exception { - final ServiceRunner runner = createMock(ServiceRunner.class); - Command shutdown = createMock(Command.class); - - expect(runner.launch()).andReturn(LocalService.auxiliaryService("a", 100, shutdown)); - shutdown.execute(); - - Module testModule = new AbstractModule() { - @Override protected void configure() { - LifecycleModule.runnerBinder(binder()).addBinding().toInstance(runner); - } - }; - - Injector injector = Guice.createInjector(new SystemModule(), testModule); - LocalServiceRegistry registry = injector.getInstance(LocalServiceRegistry.class); - - control.replay(); - - assertEquals(Optional.<InetSocketAddress>absent(), registry.getPrimarySocket()); - assertEquals(ImmutableMap.of("a", getLocalAddress(100)), registry.getAuxiliarySockets()); - injector.getInstance(ShutdownRegistry.ShutdownRegistryImpl.class).execute(); - } - - @Test(expected = IllegalStateException.class) - public void testFailedLauncher() throws Exception { - final ServiceRunner runner = createMock(ServiceRunner.class); - - expect(runner.launch()).andThrow(new LaunchException("Injected failure.")); - - Module testModule = new AbstractModule() { - @Override protected void configure() { - LifecycleModule.runnerBinder(binder()).addBinding().toInstance(runner); - } - }; - - Injector injector = Guice.createInjector(new SystemModule(), testModule); - LocalServiceRegistry registry = injector.getInstance(LocalServiceRegistry.class); - - control.replay(); - - assertEquals(Optional.of(getLocalAddress(100)), registry.getPrimarySocket()); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/test/java/org/apache/aurora/common/application/modules/LocalServiceRegistryTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/application/modules/LocalServiceRegistryTest.java b/commons/src/test/java/org/apache/aurora/common/application/modules/LocalServiceRegistryTest.java deleted file mode 100644 index 7f679cb..0000000 --- a/commons/src/test/java/org/apache/aurora/common/application/modules/LocalServiceRegistryTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.application.modules; - -import java.net.InetSocketAddress; -import java.util.Map; -import java.util.Set; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.inject.Provider; - -import org.junit.Before; -import org.junit.Test; - -import org.apache.aurora.common.application.ShutdownRegistry; -import org.apache.aurora.common.application.modules.LifecycleModule.LaunchException; -import org.apache.aurora.common.application.modules.LifecycleModule.ServiceRunner; -import org.apache.aurora.common.application.modules.LocalServiceRegistry.LocalService; -import org.apache.aurora.common.base.Commands; -import org.apache.aurora.common.testing.easymock.EasyMockTest; - -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -/** - * @author William Farner - */ -public class LocalServiceRegistryTest extends EasyMockTest { - - private static final Function<InetSocketAddress, Integer> INET_TO_PORT = - new Function<InetSocketAddress, Integer>() { - @Override public Integer apply(InetSocketAddress address) { - return address.getPort(); - } - }; - - private static final String A = "a"; - private static final String B = "b"; - private static final String C = "c"; - - private ServiceRunner runner1; - private ServiceRunner runner2; - private Provider<Set<ServiceRunner>> serviceProvider; - private ShutdownRegistry shutdownRegistry; - private LocalServiceRegistry registry; - - @Before - public void setUp() { - runner1 = createMock(ServiceRunner.class); - runner2 = createMock(ServiceRunner.class); - serviceProvider = createMock(new Clazz<Provider<Set<ServiceRunner>>>() { }); - shutdownRegistry = createMock(ShutdownRegistry.class); - registry = new LocalServiceRegistry(serviceProvider, shutdownRegistry); - } - - @Test - public void testCreate() throws LaunchException { - expect(serviceProvider.get()).andReturn(ImmutableSet.of(runner1)); - expect(runner1.launch()).andReturn(auxiliary(A, 2)); - shutdownRegistry.addAction(Commands.NOOP); - - control.replay(); - - checkPorts(ImmutableMap.of(A, 2)); - } - - private LocalService auxiliary(String name, int port) { - return LocalService.auxiliaryService(name, port, Commands.NOOP); - } - - private LocalService auxiliary(Set<String> names, int port) { - return LocalService.auxiliaryService(names, port, Commands.NOOP); - } - - @Test - public void testNoPrimary() throws LaunchException { - expect(serviceProvider.get()).andReturn(ImmutableSet.of(runner1)); - expect(runner1.launch()).andReturn(auxiliary(A, 2)); - shutdownRegistry.addAction(Commands.NOOP); - expectLastCall().times(1); - - control.replay(); - - assertFalse(registry.getPrimarySocket().isPresent()); - } - - @Test(expected = IllegalArgumentException.class) - public void testDuplicateName() throws LaunchException { - expect(serviceProvider.get()).andReturn(ImmutableSet.of(runner1, runner2)); - expect(runner1.launch()).andReturn(auxiliary(A, 1)); - expect(runner2.launch()).andReturn(auxiliary(A, 2)); - shutdownRegistry.addAction(Commands.NOOP); - expectLastCall().times(2); - - control.replay(); - - registry.getPrimarySocket(); - } - - @Test - public void testAllowsPortReuse() throws LaunchException { - expect(serviceProvider.get()).andReturn(ImmutableSet.of(runner1, runner2)); - expect(runner1.launch()).andReturn(auxiliary(A, 2)); - expect(runner2.launch()).andReturn(auxiliary(B, 2)); - shutdownRegistry.addAction(Commands.NOOP); - expectLastCall().times(2); - - control.replay(); - - checkPorts(ImmutableMap.of(A, 2, B, 2)); - } - - @Test - public void testMultiNameBreakout() throws LaunchException { - expect(serviceProvider.get()).andReturn(ImmutableSet.of(runner1, runner2)); - expect(runner1.launch()).andReturn(auxiliary(A, 2)); - expect(runner2.launch()).andReturn(auxiliary(ImmutableSet.of(B, C), 6)); - shutdownRegistry.addAction(Commands.NOOP); - expectLastCall().times(2); - - control.replay(); - - checkPorts(ImmutableMap.of(A, 2, B, 6, C, 6)); - } - - private void checkPorts(Map<String, Integer> expected) { - assertEquals(Optional.<InetSocketAddress>absent(), registry.getPrimarySocket()); - assertEquals(expected, Maps.transformValues(registry.getAuxiliarySockets(), INET_TO_PORT)); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/commons/src/test/java/org/apache/aurora/common/application/modules/StartStatPollerTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/application/modules/StartStatPollerTest.java b/commons/src/test/java/org/apache/aurora/common/application/modules/StartStatPollerTest.java deleted file mode 100644 index 5860eab..0000000 --- a/commons/src/test/java/org/apache/aurora/common/application/modules/StartStatPollerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.application.modules; - -import java.util.Properties; - -import org.apache.aurora.common.application.ShutdownRegistry; -import org.junit.Test; - -import org.apache.aurora.common.stats.Stat; -import org.apache.aurora.common.stats.Stats; -import org.apache.aurora.common.stats.TimeSeriesRepository; -import org.apache.aurora.common.testing.easymock.EasyMockTest; -import org.apache.aurora.common.util.BuildInfo; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -public class StartStatPollerTest extends EasyMockTest { - @Test - public void testStartStatPollerExecute() { - ShutdownRegistry shutdownRegistry = createMock(ShutdownRegistry.class); - TimeSeriesRepository repository = createMock(TimeSeriesRepository.class); - - Properties properties = new Properties(); - final Long gitRevisionNumber = 1404461016779713L; - properties.setProperty(BuildInfo.Key.GIT_REVISION_NUMBER.value, gitRevisionNumber.toString()); - String gitRevision = "foo_branch"; - properties.setProperty(BuildInfo.Key.GIT_REVISION.value, gitRevision); - BuildInfo buildInfo = new BuildInfo(properties); - - StatsModule.StartStatPoller poller = - new StatsModule.StartStatPoller(shutdownRegistry, buildInfo, repository); - - repository.start(shutdownRegistry); - control.replay(); - - poller.execute(); - - Stat<Long> gitRevisionNumberStat = - Stats.getVariable(Stats.normalizeName(BuildInfo.Key.GIT_REVISION_NUMBER.value)); - assertEquals(gitRevisionNumber, gitRevisionNumberStat.read()); - - Stat<String> gitRevisionStat = - Stats.getVariable(Stats.normalizeName(BuildInfo.Key.GIT_REVISION.value)); - assertEquals(gitRevision, gitRevisionStat.read()); - - Stat<String> gitBranchNameStat = - Stats.getVariable(Stats.normalizeName(BuildInfo.Key.GIT_BRANCHNAME.value)); - assertNull(gitBranchNameStat); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java b/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java index 0c440b5..8047622 100644 --- a/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java +++ b/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java @@ -28,8 +28,8 @@ import com.google.common.net.HostAndPort; import com.google.inject.AbstractModule; import com.google.inject.Module; -import org.apache.aurora.common.application.AbstractApplication; import org.apache.aurora.common.application.AppLauncher; +import org.apache.aurora.common.application.Application; import org.apache.aurora.common.application.Lifecycle; import org.apache.aurora.common.application.modules.StatsModule; import org.apache.aurora.common.args.Arg; @@ -66,8 +66,7 @@ import static org.apache.aurora.common.logging.RootLogConfig.Configuration; /** * Launcher for the aurora scheduler. */ -public class SchedulerMain extends AbstractApplication { - +public class SchedulerMain implements Application { private static final Logger LOG = Logger.getLogger(SchedulerMain.class.getName()); @NotNull @@ -216,7 +215,6 @@ public class SchedulerMain extends AbstractApplication { .build(); } - @Override public void run() { // Setup log4j to match our jul glog config in order to pick up zookeeper logging. Configuration logConfiguration = RootLogConfig.configurationFromFlags(); http://git-wip-us.apache.org/repos/asf/aurora/blob/f2856478/src/main/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImpl.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImpl.java b/src/main/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImpl.java index 7f0cb5c..50838de 100644 --- a/src/main/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImpl.java +++ b/src/main/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImpl.java @@ -15,7 +15,6 @@ package org.apache.aurora.scheduler.storage.log; import java.util.Arrays; import java.util.Map; -import java.util.Properties; import java.util.logging.Logger; import javax.inject.Inject; @@ -24,7 +23,6 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; import org.apache.aurora.common.inject.TimedInterceptor.Timed; -import org.apache.aurora.common.util.BuildInfo; import org.apache.aurora.common.util.Clock; import org.apache.aurora.gen.HostAttributes; import org.apache.aurora.gen.JobInstanceUpdateEvent; @@ -154,16 +152,9 @@ public class SnapshotStoreImpl implements SnapshotStore<Snapshot> { new SnapshotField() { @Override public void saveToSnapshot(StoreProvider store, Snapshot snapshot) { - Properties props = new BuildInfo().getProperties(); - snapshot.setSchedulerMetadata( new SchedulerMetadata() .setFrameworkId(store.getSchedulerStore().fetchFrameworkId().orNull()) - .setRevision(props.getProperty(BuildInfo.Key.GIT_REVISION.value)) - .setTag(props.getProperty(BuildInfo.Key.GIT_TAG.value)) - .setTimestamp(props.getProperty(BuildInfo.Key.TIMESTAMP.value)) - .setUser(props.getProperty(BuildInfo.Key.USER.value)) - .setMachine(props.getProperty(BuildInfo.Key.MACHINE.value)) .setVersion(CURRENT_API_VERSION)); }
