aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsir...@apache.org
Subject aurora git commit: Eliminate I* isSet methods for collection fields.
Date Mon, 28 Mar 2016 15:26:56 GMT
Repository: aurora
Updated Branches:
  refs/heads/master b352e8b16 -> 83a078b6b


Eliminate I* isSet methods for collection fields.

These methods always returned `true`, which was misleading.  Eliminate
these query methods and force users to consult the collection for
emptiness to make intentions more clear.

Bugs closed: AURORA-1650

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


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

Branch: refs/heads/master
Commit: 83a078b6ba468382a171e1c131f1e55984ac7126
Parents: b352e8b
Author: John Sirois <jsirois@apache.org>
Authored: Mon Mar 28 09:28:25 2016 -0600
Committer: John Sirois <john.sirois@gmail.com>
Committed: Mon Mar 28 09:28:25 2016 -0600

----------------------------------------------------------------------
 .../aurora/scheduler/configuration/ConfigurationManager.java     | 3 +--
 src/main/java/org/apache/aurora/scheduler/http/Mname.java        | 4 +---
 .../java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java | 4 +---
 .../apache/aurora/scheduler/scheduling/RescheduleCalculator.java | 2 +-
 .../org/apache/aurora/scheduler/storage/db/DbAttributeStore.java | 1 -
 .../python/apache/aurora/tools/java/thrift_wrapper_codegen.py    | 2 +-
 6 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/83a078b6/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
b/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
index b3b8ccf..9d2bc82 100644
--- a/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
+++ b/src/main/java/org/apache/aurora/scheduler/configuration/ConfigurationManager.java
@@ -253,8 +253,7 @@ public class ConfigurationManager {
         if (!containerConfig.getDocker().isSetImage()) {
           throw new TaskDescriptionException("A container must specify an image.");
         }
-        if (!containerConfig.getDocker().isSetParameters()
-            || containerConfig.getDocker().getParameters().isEmpty()) {
+        if (containerConfig.getDocker().getParameters().isEmpty()) {
           for (Map.Entry<String, String> e : this.defaultDockerParameters.entries())
{
             builder.getContainer().getDocker().addToParameters(
                 new DockerParameter(e.getKey(), e.getValue()));

http://git-wip-us.apache.org/repos/asf/aurora/blob/83a078b6/src/main/java/org/apache/aurora/scheduler/http/Mname.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/Mname.java b/src/main/java/org/apache/aurora/scheduler/http/Mname.java
index 807a198..c1ff654 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/Mname.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/Mname.java
@@ -33,7 +33,6 @@ import javax.ws.rs.core.UriInfo;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 
@@ -221,8 +220,7 @@ public class Mname {
 
   @VisibleForTesting
   static Optional<Integer> getRedirectPort(IAssignedTask task) {
-    Map<String, Integer> ports = task.isSetAssignedPorts()
-        ? task.getAssignedPorts() : ImmutableMap.of();
+    Map<String, Integer> ports = task.getAssignedPorts();
     for (String httpPortName : HTTP_PORT_NAMES) {
       Integer port = ports.get(httpPortName);
       if (port != null) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/83a078b6/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java b/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
index 20cbd41..85c550b 100644
--- a/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
+++ b/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
@@ -127,9 +127,7 @@ public interface MesosTaskFactory {
             offer,
             ResourceSlot.from(config),
             executorSettings.getExecutorOverhead(),
-            task.isSetAssignedPorts()
-                ? ImmutableSet.copyOf(task.getAssignedPorts().values())
-                : ImmutableSet.of(),
+            ImmutableSet.copyOf(task.getAssignedPorts().values()),
             tierManager.getTier(task.getTask()));
       } catch (Resources.InsufficientResourcesException e) {
         throw new SchedulerException(e);

http://git-wip-us.apache.org/repos/asf/aurora/blob/83a078b6/src/main/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculator.java
b/src/main/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculator.java
index 4b0ef81..18edb01 100644
--- a/src/main/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculator.java
+++ b/src/main/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculator.java
@@ -85,7 +85,7 @@ public interface RescheduleCalculator {
     private final Predicate<IScheduledTask> flapped = new Predicate<IScheduledTask>()
{
       @Override
       public boolean apply(IScheduledTask task) {
-        if (!task.isSetTaskEvents()) {
+        if (task.getTaskEvents().isEmpty()) {
           return false;
         }
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/83a078b6/src/main/java/org/apache/aurora/scheduler/storage/db/DbAttributeStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/db/DbAttributeStore.java b/src/main/java/org/apache/aurora/scheduler/storage/db/DbAttributeStore.java
index 6901098..fee465b 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/db/DbAttributeStore.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/db/DbAttributeStore.java
@@ -51,7 +51,6 @@ class DbAttributeStore implements AttributeStore.Mutable {
   @Override
   public boolean saveHostAttributes(IHostAttributes hostAttributes) {
     checkNotBlank(hostAttributes.getHost());
-    checkArgument(hostAttributes.isSetAttributes());
     checkArgument(hostAttributes.isSetMode());
 
     if (Iterables.any(hostAttributes.getAttributes(), EMPTY_VALUES)) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/83a078b6/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py b/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
index e9e9368..3465fe9 100644
--- a/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
+++ b/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
@@ -547,7 +547,7 @@ def generate_struct_field(code, struct, field, builder_calls):
 
   code.add_field(FIELD_DECLARATION % {'field': field.name, 'type': field_type })
 
-  nullable = field.ttype.name == 'String' or not isinstance(field.ttype, PrimitiveType)
+  nullable = field.ttype.name == 'String' or not isinstance(field.ttype, (PrimitiveType,
ParameterizedType))
   if nullable:
     code.add_accessor(FIELD_TEMPLATE % {'type': 'boolean',
                                         'fn_name': field.isset_method(),


Mime
View raw message