You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2017/09/27 18:39:06 UTC

aurora git commit: Fix binding issues preventing ./gradle run from working

Repository: aurora
Updated Branches:
  refs/heads/master 474320bce -> 001484f7f


Fix binding issues preventing ./gradle run from working

Reviewed at https://reviews.apache.org/r/62620/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/001484f7
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/001484f7
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/001484f7

Branch: refs/heads/master
Commit: 001484f7f4144b7c85cfd419aa6e892ffc65b751
Parents: 474320b
Author: Bill Farner <wf...@apache.org>
Authored: Wed Sep 27 11:38:25 2017 -0700
Committer: Bill Farner <wf...@apache.org>
Committed: Wed Sep 27 11:38:25 2017 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/app/SchedulerMain.java     | 21 +++++++++++++++++++-
 .../scheduler/app/local/LocalSchedulerMain.java |  5 +++++
 .../local/simulator/ClusterSimulatorModule.java | 10 +++++-----
 3 files changed, 30 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/001484f7/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 3fbe99c..4b3ba5e 100644
--- a/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java
+++ b/src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java
@@ -27,9 +27,11 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.net.HostAndPort;
 import com.google.inject.AbstractModule;
+import com.google.inject.CreationException;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Module;
+import com.google.inject.spi.Message;
 import com.google.inject.util.Modules;
 
 import org.apache.aurora.GuavaUtils.ServiceManagerIface;
@@ -189,7 +191,24 @@ public class SchedulerMain {
     AtomicLong uncaughtExceptions = Stats.exportLong("uncaught_exceptions");
     Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
       uncaughtExceptions.incrementAndGet();
-      LOG.error("Uncaught exception from " + t + ":" + e, e);
+
+      if (e instanceof CreationException) {
+        try {
+          LOG.error("Uncaught exception from " + t + ":" + e, e);
+        } catch (RuntimeException ex) {
+          LOG.warn("Using fallback printer for guice CreationException");
+
+          // Special handling for guice creation exceptions, which break in guice 3 when java 8
+          // lambdas are used.  Remove this once using guice >=4.0.
+          CreationException creationException = (CreationException) e;
+          for (Message m : creationException.getErrorMessages()) {
+            LOG.error(m.getMessage());
+            LOG.error("  source: " + m.getSource());
+          }
+        }
+      } else {
+        LOG.error("Uncaught exception from " + t + ":" + e, e);
+      }
     });
 
     Module module = Modules.combine(

http://git-wip-us.apache.org/repos/asf/aurora/blob/001484f7/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java b/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
index 7a342bd..b63f014 100644
--- a/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
+++ b/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
@@ -15,11 +15,13 @@ package org.apache.aurora.scheduler.app.local;
 
 import java.io.File;
 import java.util.List;
+import java.util.Set;
 
 import javax.inject.Singleton;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.io.Files;
 import com.google.inject.AbstractModule;
 import com.google.inject.Key;
@@ -37,6 +39,7 @@ import org.apache.aurora.scheduler.storage.DistributedSnapshotStore;
 import org.apache.aurora.scheduler.storage.Storage;
 import org.apache.aurora.scheduler.storage.Storage.NonVolatileStorage;
 import org.apache.aurora.scheduler.storage.log.SnapshotStoreImpl;
+import org.apache.aurora.scheduler.storage.log.SnapshotStoreImpl.HydrateSnapshotFields;
 import org.apache.mesos.SchedulerDriver;
 import org.apache.mesos.v1.Protos;
 import org.apache.shiro.io.ResourceUtils;
@@ -103,6 +106,8 @@ public final class LocalSchedulerMain {
         bind(FrameworkInfoFactory.class).to(FrameworkInfoFactory.FrameworkInfoFactoryImpl.class);
         bind(FrameworkInfoFactory.FrameworkInfoFactoryImpl.class).in(Singleton.class);
         install(new ClusterSimulatorModule());
+        bind(new TypeLiteral<Set<String>>() { }).annotatedWith(HydrateSnapshotFields.class)
+            .toInstance(ImmutableSet.of());
       }
     };
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/001484f7/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java b/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
index 963e4dc..8c0d179 100644
--- a/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
+++ b/src/test/java/org/apache/aurora/scheduler/app/local/simulator/ClusterSimulatorModule.java
@@ -24,8 +24,8 @@ import com.google.inject.AbstractModule;
 import com.google.inject.multibindings.Multibinder;
 
 import org.apache.aurora.scheduler.SchedulerServicesModule;
-import org.apache.mesos.v1.Protos;
-import org.apache.mesos.v1.Protos.Offer;
+import org.apache.mesos.Protos;
+import org.apache.mesos.Protos.Offer;
 
 import static java.util.Objects.requireNonNull;
 
@@ -34,8 +34,8 @@ import static org.apache.aurora.scheduler.resources.ResourceType.CPUS;
 import static org.apache.aurora.scheduler.resources.ResourceType.DISK_MB;
 import static org.apache.aurora.scheduler.resources.ResourceType.PORTS;
 import static org.apache.aurora.scheduler.resources.ResourceType.RAM_MB;
-import static org.apache.mesos.v1.Protos.Value.Type.RANGES;
-import static org.apache.mesos.v1.Protos.Value.Type.SCALAR;
+import static org.apache.mesos.Protos.Value.Type.RANGES;
+import static org.apache.mesos.Protos.Value.Type.SCALAR;
 
 /**
  * Module that sets up bindings to simulate fake cluster resources.
@@ -108,7 +108,7 @@ public class ClusterSimulatorModule extends AbstractModule {
         .addAttributes(Protos.Attribute.newBuilder().setType(Protos.Value.Type.TEXT)
             .setName("rack")
             .setText(Protos.Value.Text.newBuilder().setValue(rack)))
-        .setAgentId(Protos.AgentID.newBuilder().setValue(slaveId))
+        .setSlaveId(Protos.SlaveID.newBuilder().setValue(slaveId))
         .setHostname(host)
         .setFrameworkId(Protos.FrameworkID.newBuilder().setValue("frameworkId").build())
         .setId(Protos.OfferID.newBuilder().setValue(UUID.randomUUID().toString()))