myriad-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smare...@apache.org
Subject [06/20] incubator-myriad git commit: spacing changes
Date Wed, 28 Oct 2015 16:07:38 GMT
http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/ClustersResource.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/ClustersResource.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/ClustersResource.java
index 657db76..70b257d 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/ClustersResource.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/ClustersResource.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -55,250 +55,233 @@ import javax.ws.rs.core.Response.Status;
  */
 @Path("/cluster")
 public class ClustersResource {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ClustersResource.class);
-    private static final String LIKE_CONSTRAINT_FORMAT =
-        "'<mesos_slave_attribute|hostname> LIKE <value_regex>'";
-
-    private MyriadConfiguration cfg;
-    private SchedulerState schedulerState;
-    private ServiceProfileManager profileManager;
-    private MyriadOperations myriadOperations;
-
-    @Inject
-    public ClustersResource(MyriadConfiguration cfg,
-                            SchedulerState state,
-                            ServiceProfileManager profileManager,
-                            MyriadOperations myriadOperations) {
-      this.cfg = cfg;
-      this.schedulerState = state;
-      this.profileManager = profileManager;
-      this.myriadOperations = myriadOperations;
+  private static final Logger LOGGER = LoggerFactory.getLogger(ClustersResource.class);
+  private static final String LIKE_CONSTRAINT_FORMAT = "'<mesos_slave_attribute|hostname> LIKE <value_regex>'";
+
+  private MyriadConfiguration cfg;
+  private SchedulerState schedulerState;
+  private ServiceProfileManager profileManager;
+  private MyriadOperations myriadOperations;
+
+  @Inject
+  public ClustersResource(MyriadConfiguration cfg, SchedulerState state, ServiceProfileManager profileManager, MyriadOperations myriadOperations) {
+    this.cfg = cfg;
+    this.schedulerState = state;
+    this.profileManager = profileManager;
+    this.myriadOperations = myriadOperations;
+  }
+
+  @Timed
+  @PUT
+  @Path("/flexup")
+  @Produces(MediaType.TEXT_PLAIN)
+  @Consumes(MediaType.APPLICATION_JSON)
+  public Response flexUp(FlexUpClusterRequest request) {
+    Preconditions.checkNotNull(request, "request object cannot be null or empty");
+
+    Integer instances = request.getInstances();
+    String profile = request.getProfile();
+    List<String> constraints = request.getConstraints();
+    LOGGER.info("Received flexup request. Profile: {}, Instances: {}, Constraints: {}", profile, instances, constraints);
+
+    Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
+    boolean isValidRequest = validateProfile(profile, response);
+    isValidRequest = isValidRequest && validateInstances(instances, response);
+    isValidRequest = isValidRequest && validateConstraints(constraints, response);
+
+    Response returnResponse = response.build();
+    if (returnResponse.getStatus() == Response.Status.ACCEPTED.getStatusCode()) {
+      String constraint = constraints != null && !constraints.isEmpty() ? constraints.get(0) : null;
+      this.myriadOperations.flexUpCluster(this.profileManager.get(profile), instances, ConstraintFactory.createConstraint(constraint));
     }
 
-    @Timed
-    @PUT
-    @Path("/flexup")
-    @Produces(MediaType.TEXT_PLAIN)
-    @Consumes(MediaType.APPLICATION_JSON)
-    public Response flexUp(FlexUpClusterRequest request) {
-        Preconditions.checkNotNull(request, "request object cannot be null or empty");
-
-        Integer instances = request.getInstances();
-        String profile = request.getProfile();
-        List<String> constraints = request.getConstraints();
-        LOGGER.info("Received flexup request. Profile: {}, Instances: {}, Constraints: {}",
-            profile, instances, constraints);
-
-        Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
-        boolean isValidRequest = validateProfile(profile, response);
-        isValidRequest = isValidRequest && validateInstances(instances, response);
-        isValidRequest = isValidRequest && validateConstraints(constraints, response);
-
-        Response returnResponse = response.build();
-        if (returnResponse.getStatus() == Response.Status.ACCEPTED.getStatusCode()) {
-          String constraint = constraints != null && !constraints.isEmpty() ? constraints.get(0) : null;
-          this.myriadOperations.flexUpCluster(this.profileManager.get(profile), instances,
-              ConstraintFactory.createConstraint(constraint));
-        }
-
-        return returnResponse;
-    }
+    return returnResponse;
+  }
 
-    @Timed
-    @PUT
-    @Path("/flexupservice")
-    @Produces(MediaType.TEXT_PLAIN)
-    @Consumes(MediaType.APPLICATION_JSON)
-    public Response flexUpservice(FlexUpServiceRequest request) {
-      Preconditions.checkNotNull(request,
-              "request object cannot be null or empty");
-
-      LOGGER.info("Received Flexup a Service Request");
-
-      Integer instances = request.getInstances();
-      String serviceName = request.getServiceName();
-
-      LOGGER.info("Instances: {}", instances);
-      LOGGER.info("Service: {}", serviceName);
-      
-      // Validate profile request
-      Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
-      
-      if (cfg.getServiceConfiguration(serviceName) == null) {
-        response.status(Response.Status.BAD_REQUEST)
-                .entity("Service does not exist: " + serviceName);
-        LOGGER.error("Provided service does not exist " + serviceName);
-        return response.build();
-      }
-      
-      if (!validateInstances(instances, response)) {
-        return response.build();
-      }
+  @Timed
+  @PUT
+  @Path("/flexupservice")
+  @Produces(MediaType.TEXT_PLAIN)
+  @Consumes(MediaType.APPLICATION_JSON)
+  public Response flexUpservice(FlexUpServiceRequest request) {
+    Preconditions.checkNotNull(request, "request object cannot be null or empty");
 
-      try {
-        this.myriadOperations.flexUpAService(instances, serviceName);
-      } catch (MyriadBadConfigurationException e) {
-        return response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
-      }
+    LOGGER.info("Received Flexup a Service Request");
 
+    Integer instances = request.getInstances();
+    String serviceName = request.getServiceName();
+
+    LOGGER.info("Instances: {}", instances);
+    LOGGER.info("Service: {}", serviceName);
+
+    // Validate profile request
+    Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
+
+    if (cfg.getServiceConfiguration(serviceName) == null) {
+      response.status(Response.Status.BAD_REQUEST).entity("Service does not exist: " + serviceName);
+      LOGGER.error("Provided service does not exist " + serviceName);
       return response.build();
     }
 
-    @Timed
-    @PUT
-    @Path("/flexdown")
-    @Produces(MediaType.TEXT_PLAIN)
-    @Consumes(MediaType.APPLICATION_JSON)
-    public Response flexDown(FlexDownClusterRequest request) {
-        Preconditions.checkNotNull(request, "request object cannot be null or empty");
-
-        Integer instances = request.getInstances();
-        String profile = request.getProfile();
-        List<String> constraints = request.getConstraints();
-        LOGGER.info("Received flex down request. Profile: {}, Instances: {}, Constraints: {}",
-            profile, instances, constraints);
-
-        Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
-        boolean isValidRequest = validateProfile(profile, response);
-        isValidRequest = isValidRequest && validateInstances(instances, response);
-        isValidRequest = isValidRequest && validateConstraints(constraints, response);
-
-        if (isValidRequest)  {
-          Integer numFlexedUp = this.getNumFlexedupNMs(profile);
-          if (numFlexedUp < instances) {
-            String message = String.format("Number of requested instances for flexdown is greater than the number of " +
-                "Node Managers previously flexed up for profile '%s'. Requested: %d, Previously flexed Up: %d. " +
-                "Only %d Node Managers will be flexed down.", profile, instances, numFlexedUp, numFlexedUp);
-            response.entity(message);
-            LOGGER.warn(message);
-          }
-        }
-
-        Response returnResponse = response.build();
-        if (returnResponse.getStatus() == Response.Status.ACCEPTED.getStatusCode()) {
-            String constraint = constraints != null && !constraints.isEmpty() ? constraints.get(0) : null;
-            this.myriadOperations.flexDownCluster(profileManager.get(profile),
-                ConstraintFactory.createConstraint(constraint), instances);
-        }
-        return returnResponse;
+    if (!validateInstances(instances, response)) {
+      return response.build();
     }
 
-    private boolean validateProfile(String profile, ResponseBuilder response) {
-      if (profile == null || profile.isEmpty()) {
-        response.status(Response.Status.BAD_REQUEST).entity("'profile' is null or empty");
-        LOGGER.error("'profile' is null or empty");
-        return false;
-      }
-      if (!this.profileManager.exists(profile)) {
-        response.status(Response.Status.BAD_REQUEST)
-            .entity("Profile does not exist: '" + profile + "'");
-        LOGGER.error("Provided profile does not exist: '" + profile + "'");
-        return false;
-      }
-      return true;
+    try {
+      this.myriadOperations.flexUpAService(instances, serviceName);
+    } catch (MyriadBadConfigurationException e) {
+      return response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
     }
 
-    private boolean validateInstances(Integer instances, ResponseBuilder response) {
-      if (instances == null) {
-        response.status(Response.Status.BAD_REQUEST).entity("'instances' is null");
-        LOGGER.error("'instances' is null");
-        return false;
-      } else if (!(instances > 0)) {
-          response.status(Response.Status.BAD_REQUEST)
-                  .entity("Invalid instance size: " + instances);
-          LOGGER.error("Invalid instance size request " + instances);
-        return false;
+    return response.build();
+  }
+
+  @Timed
+  @PUT
+  @Path("/flexdown")
+  @Produces(MediaType.TEXT_PLAIN)
+  @Consumes(MediaType.APPLICATION_JSON)
+  public Response flexDown(FlexDownClusterRequest request) {
+    Preconditions.checkNotNull(request, "request object cannot be null or empty");
+
+    Integer instances = request.getInstances();
+    String profile = request.getProfile();
+    List<String> constraints = request.getConstraints();
+    LOGGER.info("Received flex down request. Profile: {}, Instances: {}, Constraints: {}", profile, instances, constraints);
+
+    Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
+    boolean isValidRequest = validateProfile(profile, response);
+    isValidRequest = isValidRequest && validateInstances(instances, response);
+    isValidRequest = isValidRequest && validateConstraints(constraints, response);
+
+    if (isValidRequest) {
+      Integer numFlexedUp = this.getNumFlexedupNMs(profile);
+      if (numFlexedUp < instances) {
+        String message = String.format("Number of requested instances for flexdown is greater than the number of " +
+            "Node Managers previously flexed up for profile '%s'. Requested: %d, Previously flexed Up: %d. " +
+            "Only %d Node Managers will be flexed down.", profile, instances, numFlexedUp, numFlexedUp);
+        response.entity(message);
+        LOGGER.warn(message);
       }
-      return true;
     }
 
-    private boolean validateConstraints(List<String> constraints, ResponseBuilder response) {
-      if (constraints != null && !constraints.isEmpty()) {
-        boolean valid = validateConstraintsSize(constraints, response);
-        valid = valid && validateLIKEConstraint(constraints.get(0), response);
-        return valid;
-      }
-      return true;
+    Response returnResponse = response.build();
+    if (returnResponse.getStatus() == Response.Status.ACCEPTED.getStatusCode()) {
+      String constraint = constraints != null && !constraints.isEmpty() ? constraints.get(0) : null;
+      this.myriadOperations.flexDownCluster(profileManager.get(profile), ConstraintFactory.createConstraint(constraint), instances);
+    }
+    return returnResponse;
+  }
+
+  private boolean validateProfile(String profile, ResponseBuilder response) {
+    if (profile == null || profile.isEmpty()) {
+      response.status(Response.Status.BAD_REQUEST).entity("'profile' is null or empty");
+      LOGGER.error("'profile' is null or empty");
+      return false;
+    }
+    if (!this.profileManager.exists(profile)) {
+      response.status(Response.Status.BAD_REQUEST).entity("Profile does not exist: '" + profile + "'");
+      LOGGER.error("Provided profile does not exist: '" + profile + "'");
+      return false;
+    }
+    return true;
+  }
+
+  private boolean validateInstances(Integer instances, ResponseBuilder response) {
+    if (instances == null) {
+      response.status(Response.Status.BAD_REQUEST).entity("'instances' is null");
+      LOGGER.error("'instances' is null");
+      return false;
+    } else if (!(instances > 0)) {
+      response.status(Response.Status.BAD_REQUEST).entity("Invalid instance size: " + instances);
+      LOGGER.error("Invalid instance size request " + instances);
+      return false;
+    }
+    return true;
+  }
+
+  private boolean validateConstraints(List<String> constraints, ResponseBuilder response) {
+    if (constraints != null && !constraints.isEmpty()) {
+      boolean valid = validateConstraintsSize(constraints, response);
+      valid = valid && validateLIKEConstraint(constraints.get(0), response);
+      return valid;
+    }
+    return true;
+  }
+
+  private boolean validateConstraintsSize(List<String> constraints, ResponseBuilder response) {
+    if (constraints.size() > 1) {
+      String message = String.format("Only 1 constraint is currently supported. Received: %s", constraints.toString());
+      response.status(Status.BAD_REQUEST).entity(message);
+      LOGGER.error(message);
+      return false;
+    }
+    return true;
+  }
+
+  private boolean validateLIKEConstraint(String constraint, ResponseBuilder response) {
+    if (constraint.isEmpty()) {
+      String message = String.format("The value provided for 'constraints' is empty. Format: %s", LIKE_CONSTRAINT_FORMAT);
+      response.status(Status.BAD_REQUEST).entity(message);
+      LOGGER.error(message);
+      return false;
     }
 
-    private boolean validateConstraintsSize(List<String> constraints, ResponseBuilder response) {
-      if (constraints.size() > 1) {
-        String message = String.format("Only 1 constraint is currently supported. Received: %s", constraints.toString());
-        response.status(Status.BAD_REQUEST).entity(message);
-        LOGGER.error(message);
-        return false;
-      }
-      return true;
+    String[] splits = constraint.split(" LIKE "); // "<key> LIKE <val_regex>"
+    if (splits.length != 2) {
+      String message = String.format("Invalid format for LIKE operator in constraint: %s. Format: %s", constraint, LIKE_CONSTRAINT_FORMAT);
+      response.status(Status.BAD_REQUEST).entity(message);
+      LOGGER.error(message);
+      return false;
+    }
+    try {
+      Pattern.compile(splits[1]);
+    } catch (PatternSyntaxException e) {
+      String message = String.format("Invalid regex for LIKE operator in constraint: %s", constraint);
+      response.status(Status.BAD_REQUEST).entity(message);
+      LOGGER.error(message, e);
+      return false;
     }
+    return true;
+  }
 
-    private boolean validateLIKEConstraint(String constraint, ResponseBuilder response) {
-      if (constraint.isEmpty()) {
-        String message = String.format("The value provided for 'constraints' is empty. Format: %s",
-          LIKE_CONSTRAINT_FORMAT);
-        response.status(Status.BAD_REQUEST).entity(message);
-        LOGGER.error(message);
-        return false;
-      }
 
-      String[] splits = constraint.split(" LIKE "); // "<key> LIKE <val_regex>"
-      if (splits.length != 2) {
-        String message = String.format("Invalid format for LIKE operator in constraint: %s. Format: %s",
-            constraint, LIKE_CONSTRAINT_FORMAT);
-        response.status(Status.BAD_REQUEST).entity(message);
-        LOGGER.error(message);
-        return false;
-      }
-      try {
-        Pattern.compile(splits[1]);
-      } catch (PatternSyntaxException e) {
-        String message = String.format("Invalid regex for LIKE operator in constraint: %s", constraint);
-        response.status(Status.BAD_REQUEST).entity(message);
-        LOGGER.error(message, e);
-        return false;
-      }
-      return true;
-    }
+  private Integer getNumFlexedupNMs(String profile) {
+    ServiceResourceProfile serviceProfile = profileManager.get(profile);
+    return this.schedulerState.getActiveTaskIDsForProfile(serviceProfile).size() + this.schedulerState.getStagingTaskIDsForProfile(serviceProfile).size() + this.schedulerState.getPendingTaskIDsForProfile(serviceProfile).size();
+  }
 
+  @Timed
+  @PUT
+  @Path("/flexdownservice")
+  @Produces(MediaType.TEXT_PLAIN)
+  @Consumes(MediaType.APPLICATION_JSON)
+  public Response flexDownservice(FlexDownServiceRequest request) {
+    Preconditions.checkNotNull(request, "request object cannot be null or empty");
 
-    private Integer getNumFlexedupNMs(String profile) {
-      ServiceResourceProfile serviceProfile = profileManager.get(profile);
-      return this.schedulerState.getActiveTaskIDsForProfile(serviceProfile).size()
-                + this.schedulerState.getStagingTaskIDsForProfile(serviceProfile).size()
-                + this.schedulerState.getPendingTaskIDsForProfile(serviceProfile).size();
-    }
+    Integer instances = request.getInstances();
+    String serviceName = request.getServiceName();
 
-    @Timed
-    @PUT
-    @Path("/flexdownservice")
-    @Produces(MediaType.TEXT_PLAIN)
-    @Consumes(MediaType.APPLICATION_JSON)
-    public Response flexDownservice(FlexDownServiceRequest request) {
-      Preconditions.checkNotNull(request,
-              "request object cannot be null or empty");
-      
-      Integer instances = request.getInstances();
-      String serviceName = request.getServiceName();
-      
-      LOGGER.info("Received flexdown request for service {}", serviceName);
-      LOGGER.info("Instances: " + instances);
-
-      Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
-
-      if (!validateInstances(instances, response)) {
-          return response.build();
-      }
+    LOGGER.info("Received flexdown request for service {}", serviceName);
+    LOGGER.info("Instances: " + instances);
 
-      // warn that number of requested instances isn't available
-      // but instances will still be flexed down
-      Integer flexibleInstances = this.myriadOperations.getFlexibleInstances(serviceName);
-      if (flexibleInstances < instances)  {
-          response.entity("Number of requested instances is greater than available.");
-          // just doing a simple check here. pass the requested number of instances
-          // to myriadOperations and let it sort out how many actually get flexxed down.
-          LOGGER.warn("Requested number of instances greater than available: {} < {}", flexibleInstances, instances);
-      }
+    Response.ResponseBuilder response = Response.status(Response.Status.ACCEPTED);
 
-      this.myriadOperations.flexDownAService(instances, serviceName);
+    if (!validateInstances(instances, response)) {
       return response.build();
     }
+
+    // warn that number of requested instances isn't available
+    // but instances will still be flexed down
+    Integer flexibleInstances = this.myriadOperations.getFlexibleInstances(serviceName);
+    if (flexibleInstances < instances) {
+      response.entity("Number of requested instances is greater than available.");
+      // just doing a simple check here. pass the requested number of instances
+      // to myriadOperations and let it sort out how many actually get flexxed down.
+      LOGGER.warn("Requested number of instances greater than available: {} < {}", flexibleInstances, instances);
+    }
+
+    this.myriadOperations.flexDownAService(instances, serviceName);
+    return response.build();
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/ConfigurationResource.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/ConfigurationResource.java
index 926df84..9d32d79 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/ConfigurationResource.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/ConfigurationResource.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -33,16 +33,16 @@ import javax.ws.rs.core.MediaType;
 @Path("/config")
 @Produces(MediaType.APPLICATION_JSON)
 public class ConfigurationResource {
-    private MyriadConfiguration cfg;
+  private MyriadConfiguration cfg;
 
-    @Inject
-    public ConfigurationResource(MyriadConfiguration cfg) {
-        this.cfg = cfg;
-    }
+  @Inject
+  public ConfigurationResource(MyriadConfiguration cfg) {
+    this.cfg = cfg;
+  }
 
-    @Timed
-    @GET
-    public MyriadConfiguration getConfig() throws InterruptedException {
-        return this.cfg;
-    }
+  @Timed
+  @GET
+  public MyriadConfiguration getConfig() throws InterruptedException {
+    return this.cfg;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/SchedulerStateResource.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/SchedulerStateResource.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/SchedulerStateResource.java
index 310208b..b8f087c 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/SchedulerStateResource.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/SchedulerStateResource.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -40,33 +40,30 @@ import java.util.Collections;
 @Path("/state")
 @Produces(MediaType.APPLICATION_JSON)
 public class SchedulerStateResource {
-    private MyriadConfiguration cfg;
-    private SchedulerState state;
+  private MyriadConfiguration cfg;
+  private SchedulerState state;
 
-    @Inject
-    public SchedulerStateResource(final MyriadConfiguration cfg,
-                                  final SchedulerState state) {
-        this.cfg = cfg;
-        this.state = state;
-    }
-
-    @Timed
-    @GET
-    public GetSchedulerStateResponse getState() {
-        return new GetSchedulerStateResponse(toStringCollection(state.getPendingTaskIds()),
-                toStringCollection(state.getStagingTaskIds()), toStringCollection(state.getActiveTaskIds()),
-                toStringCollection(state.getKillableTasks()));
-    }
+  @Inject
+  public SchedulerStateResource(final MyriadConfiguration cfg, final SchedulerState state) {
+    this.cfg = cfg;
+    this.state = state;
+  }
 
-    private Collection<String> toStringCollection(Collection<Protos.TaskID> collection) {
-        if (CollectionUtils.isEmpty(collection)) {
-            return Collections.emptyList();
-        }
-        Collection<String> returnCollection = new ArrayList<>();
-        for (Protos.TaskID task : collection) {
-            returnCollection.add(task.getValue());
-        }
+  @Timed
+  @GET
+  public GetSchedulerStateResponse getState() {
+    return new GetSchedulerStateResponse(toStringCollection(state.getPendingTaskIds()), toStringCollection(state.getStagingTaskIds()), toStringCollection(state.getActiveTaskIds()), toStringCollection(state.getKillableTasks()));
+  }
 
-        return returnCollection;
+  private Collection<String> toStringCollection(Collection<Protos.TaskID> collection) {
+    if (CollectionUtils.isEmpty(collection)) {
+      return Collections.emptyList();
     }
+    Collection<String> returnCollection = new ArrayList<>();
+    for (Protos.TaskID task : collection) {
+      returnCollection.add(task.getValue());
+    }
+
+    return returnCollection;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownClusterRequest.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownClusterRequest.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownClusterRequest.java
index b2a7519..e17534c 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownClusterRequest.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownClusterRequest.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -27,49 +27,49 @@ import org.hibernate.validator.constraints.NotEmpty;
  */
 public class FlexDownClusterRequest {
 
-    @NotEmpty
-    public String profile;
+  @NotEmpty
+  public String profile;
 
-    @NotEmpty
-    public Integer instances;
+  @NotEmpty
+  public Integer instances;
 
-    public List<String> constraints;
+  public List<String> constraints;
 
-    public FlexDownClusterRequest() {
-    }
+  public FlexDownClusterRequest() {
+  }
 
-    public FlexDownClusterRequest(String profile, Integer instances, List<String> constraints) {
-        this.instances = instances;
-        this.profile = profile;
-        this.constraints = constraints;
-    }
+  public FlexDownClusterRequest(String profile, Integer instances, List<String> constraints) {
+    this.instances = instances;
+    this.profile = profile;
+    this.constraints = constraints;
+  }
 
-    public Integer getInstances() {
-        return instances;
-    }
+  public Integer getInstances() {
+    return instances;
+  }
 
-    public void setInstances(Integer instances) {
-        this.instances = instances;
-    }
+  public void setInstances(Integer instances) {
+    this.instances = instances;
+  }
 
-    public String getProfile() {
-      return profile;
-    }
+  public String getProfile() {
+    return profile;
+  }
 
-    public void setProfile(String profile) {
-      this.profile = profile;
-    }
+  public void setProfile(String profile) {
+    this.profile = profile;
+  }
 
-    public List<String> getConstraints() {
-      return constraints;
-    }
+  public List<String> getConstraints() {
+    return constraints;
+  }
 
-    public void setConstraints(List<String> constraints) {
-      this.constraints = constraints;
-    }
+  public void setConstraints(List<String> constraints) {
+    this.constraints = constraints;
+  }
 
-    public String toString() {
-        Gson gson = new Gson();
-        return gson.toJson(this);
-    }
+  public String toString() {
+    Gson gson = new Gson();
+    return gson.toJson(this);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownServiceRequest.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownServiceRequest.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownServiceRequest.java
index d565a0a..f0f15ea 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownServiceRequest.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexDownServiceRequest.java
@@ -1,20 +1,20 @@
 /**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you 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.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 com.ebay.myriad.api.model;
 
@@ -26,38 +26,38 @@ import org.hibernate.validator.constraints.NotEmpty;
  */
 public class FlexDownServiceRequest {
 
-    @NotEmpty
-    public Integer instances;
-    
-    @NotEmpty
-    public String serviceName;
+  @NotEmpty
+  public Integer instances;
+
+  @NotEmpty
+  public String serviceName;
 
-    public FlexDownServiceRequest() {
-    }
+  public FlexDownServiceRequest() {
+  }
 
-    public FlexDownServiceRequest(Integer instances, String serviceName) {
-        this.instances = instances;
-        this.serviceName = serviceName;
-    }
+  public FlexDownServiceRequest(Integer instances, String serviceName) {
+    this.instances = instances;
+    this.serviceName = serviceName;
+  }
 
-    public Integer getInstances() {
-        return instances;
-    }
+  public Integer getInstances() {
+    return instances;
+  }
 
-    public void setInstances(Integer instances) {
-        this.instances = instances;
-    }
+  public void setInstances(Integer instances) {
+    this.instances = instances;
+  }
 
-    public String getServiceName() {
-      return serviceName;
-    }
+  public String getServiceName() {
+    return serviceName;
+  }
 
-    public void setServiceName(String serviceName) {
-      this.serviceName = serviceName;
-    }
+  public void setServiceName(String serviceName) {
+    this.serviceName = serviceName;
+  }
 
-    public String toString() {
-        Gson gson = new Gson();
-        return gson.toJson(this);
-    }
+  public String toString() {
+    Gson gson = new Gson();
+    return gson.toJson(this);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpClusterRequest.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpClusterRequest.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpClusterRequest.java
index 5953f8b..87a0c15 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpClusterRequest.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpClusterRequest.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -26,49 +26,49 @@ import org.hibernate.validator.constraints.NotEmpty;
  * Flex up an auxtask/service
  */
 public class FlexUpClusterRequest {
-    @NotEmpty
-    public Integer instances;
+  @NotEmpty
+  public Integer instances;
 
-    @NotEmpty
-    public String profile;
+  @NotEmpty
+  public String profile;
 
-    public List<String> constraints;
+  public List<String> constraints;
 
-    public FlexUpClusterRequest() {
-    }
-    
-    public FlexUpClusterRequest(Integer instances, String profile, List<String> constraints) {
-        this.instances = instances;
-        this.profile = profile;
-        this.constraints = constraints;
-    }
+  public FlexUpClusterRequest() {
+  }
 
-    public Integer getInstances() {
-        return instances;
-    }
+  public FlexUpClusterRequest(Integer instances, String profile, List<String> constraints) {
+    this.instances = instances;
+    this.profile = profile;
+    this.constraints = constraints;
+  }
 
-    public void setInstances(Integer instances) {
-        this.instances = instances;
-    }
+  public Integer getInstances() {
+    return instances;
+  }
 
-    public String getProfile() {
-        return profile;
-    }
+  public void setInstances(Integer instances) {
+    this.instances = instances;
+  }
 
-    public void setProfile(String profile) {
-        this.profile = profile;
-    }
+  public String getProfile() {
+    return profile;
+  }
 
-    public List<String> getConstraints() {
-      return constraints;
-    }
+  public void setProfile(String profile) {
+    this.profile = profile;
+  }
 
-    public void setConstraints(List<String> constraints) {
-      this.constraints = constraints;
-    }
+  public List<String> getConstraints() {
+    return constraints;
+  }
 
-    public String toString() {
-        Gson gson = new Gson();
-        return gson.toJson(this);
-    }
+  public void setConstraints(List<String> constraints) {
+    this.constraints = constraints;
+  }
+
+  public String toString() {
+    Gson gson = new Gson();
+    return gson.toJson(this);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpServiceRequest.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpServiceRequest.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpServiceRequest.java
index 1bc8db7..0a8a160 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpServiceRequest.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/FlexUpServiceRequest.java
@@ -1,20 +1,20 @@
 /**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you 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.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 com.ebay.myriad.api.model;
 
 import com.google.gson.Gson;
@@ -24,38 +24,38 @@ import org.hibernate.validator.constraints.NotEmpty;
  * Flex up request parameters
  */
 public class FlexUpServiceRequest {
-    @NotEmpty
-    public Integer instances;
-
-    @NotEmpty
-    public String serviceName;
-
-    public FlexUpServiceRequest() {
-    }
-    
-    public FlexUpServiceRequest(Integer instances, String profile) {
-        this.instances = instances;
-        this.serviceName = profile;
-    }
-
-    public Integer getInstances() {
-        return instances;
-    }
-
-    public void setInstances(Integer instances) {
-        this.instances = instances;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public void setServiceName(String profile) {
-        this.serviceName = profile;
-    }
-
-    public String toString() {
-        Gson gson = new Gson();
-        return gson.toJson(this);
-    }
+  @NotEmpty
+  public Integer instances;
+
+  @NotEmpty
+  public String serviceName;
+
+  public FlexUpServiceRequest() {
+  }
+
+  public FlexUpServiceRequest(Integer instances, String profile) {
+    this.instances = instances;
+    this.serviceName = profile;
+  }
+
+  public Integer getInstances() {
+    return instances;
+  }
+
+  public void setInstances(Integer instances) {
+    this.instances = instances;
+  }
+
+  public String getServiceName() {
+    return serviceName;
+  }
+
+  public void setServiceName(String profile) {
+    this.serviceName = profile;
+  }
+
+  public String toString() {
+    Gson gson = new Gson();
+    return gson.toJson(this);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/GetSchedulerStateResponse.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/GetSchedulerStateResponse.java b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/GetSchedulerStateResponse.java
index 634b13c..88a5ede 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/GetSchedulerStateResponse.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/api/model/GetSchedulerStateResponse.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -24,38 +24,36 @@ import java.util.Collection;
  * Response for the current state of Myriad
  */
 public class GetSchedulerStateResponse {
-    private Collection<String> pendingTasks;
-    private Collection<String> stagingTasks;
-    private Collection<String> activeTasks;
-    private Collection<String> killableTasks;
-
-    public GetSchedulerStateResponse() {
-
-    }
-
-    public GetSchedulerStateResponse(Collection<String> pendingTasks,
-                                     Collection<String> stagingTasks, Collection<String> activeTasks,
-                                     Collection<String> killableTasks) {
-        this.pendingTasks = pendingTasks;
-        this.stagingTasks = stagingTasks;
-        this.activeTasks = activeTasks;
-        this.killableTasks = killableTasks;
-    }
-
-    public Collection<String> getPendingTasks() {
-        return pendingTasks;
-    }
-
-    public Collection<String> getStagingTasks() {
-        return stagingTasks;
-    }
-
-    public Collection<String> getActiveTasks() {
-        return activeTasks;
-    }
-
-    public Collection<String> getKillableTasks() {
-        return killableTasks;
-    }
+  private Collection<String> pendingTasks;
+  private Collection<String> stagingTasks;
+  private Collection<String> activeTasks;
+  private Collection<String> killableTasks;
+
+  public GetSchedulerStateResponse() {
+
+  }
+
+  public GetSchedulerStateResponse(Collection<String> pendingTasks, Collection<String> stagingTasks, Collection<String> activeTasks, Collection<String> killableTasks) {
+    this.pendingTasks = pendingTasks;
+    this.stagingTasks = stagingTasks;
+    this.activeTasks = activeTasks;
+    this.killableTasks = killableTasks;
+  }
+
+  public Collection<String> getPendingTasks() {
+    return pendingTasks;
+  }
+
+  public Collection<String> getStagingTasks() {
+    return stagingTasks;
+  }
+
+  public Collection<String> getActiveTasks() {
+    return activeTasks;
+  }
+
+  public Collection<String> getKillableTasks() {
+    return killableTasks;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadBadConfigurationException.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadBadConfigurationException.java b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadBadConfigurationException.java
index 0ac7d5b..3496c4d 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadBadConfigurationException.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadBadConfigurationException.java
@@ -1,31 +1,30 @@
 /**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you 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.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 com.ebay.myriad.configuration;
 
 /**
  * Myriad specific exception
- *
  */
 @SuppressWarnings("serial")
 public class MyriadBadConfigurationException extends Exception {
 
-  
+
   public MyriadBadConfigurationException(String message) {
     super(message);
   }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadConfiguration.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadConfiguration.java b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadConfiguration.java
index 2dc8f02..3903bee 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadConfiguration.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadConfiguration.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -129,7 +129,7 @@ public class MyriadConfiguration {
 
   @JsonProperty
   private NodeManagerConfiguration nodemanager;
-  
+
   @JsonProperty
   private Map<String, ServiceConfiguration> services;
 
@@ -174,13 +174,11 @@ public class MyriadConfiguration {
   }
 
   public Double getFrameworkFailoverTimeout() {
-    return this.frameworkFailoverTimeout != null ? this.frameworkFailoverTimeout
-        : DEFAULT_FRAMEWORK_FAILOVER_TIMEOUT_MS;
+    return this.frameworkFailoverTimeout != null ? this.frameworkFailoverTimeout : DEFAULT_FRAMEWORK_FAILOVER_TIMEOUT_MS;
   }
 
   public String getFrameworkName() {
-    return Strings.isNullOrEmpty(this.frameworkName) ? DEFAULT_FRAMEWORK_NAME
-        : this.frameworkName;
+    return Strings.isNullOrEmpty(this.frameworkName) ? DEFAULT_FRAMEWORK_NAME : this.frameworkName;
   }
 
   public String getFrameworkRole() {
@@ -214,7 +212,7 @@ public class MyriadConfiguration {
   public NodeManagerConfiguration getNodeManagerConfiguration() {
     return this.nodemanager;
   }
-  
+
   public Map<String, ServiceConfiguration> getServiceConfigurations() {
     return this.services;
   }
@@ -225,7 +223,7 @@ public class MyriadConfiguration {
     }
     return this.services.get(taskName);
   }
-  
+
   public MyriadExecutorConfiguration getMyriadExecutorConfiguration() {
     return this.executor;
   }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadExecutorConfiguration.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadExecutorConfiguration.java b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadExecutorConfiguration.java
index 3d95859..375ff1c 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadExecutorConfiguration.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/MyriadExecutorConfiguration.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -30,30 +30,30 @@ import org.hibernate.validator.constraints.NotEmpty;
  * Configuration for the Executor
  */
 public class MyriadExecutorConfiguration {
-    /**
-     * Translates to -Xmx for the NodeManager JVM.
-     */
-    @JsonProperty
-    @JsonSerialize(using = OptionalSerializerDouble.class)
-    private Double jvmMaxMemoryMB;
-
-    @JsonProperty
-    @NotEmpty
-    private String path;
-
-    @JsonProperty
-    @JsonSerialize(using = OptionalSerializerString.class)
-    private String nodeManagerUri;
-
-    public Optional<Double> getJvmMaxMemoryMB() {
-        return Optional.fromNullable(jvmMaxMemoryMB);
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public Optional<String> getNodeManagerUri() {
-        return Optional.fromNullable(nodeManagerUri);
-    }
+  /**
+   * Translates to -Xmx for the NodeManager JVM.
+   */
+  @JsonProperty
+  @JsonSerialize(using = OptionalSerializerDouble.class)
+  private Double jvmMaxMemoryMB;
+
+  @JsonProperty
+  @NotEmpty
+  private String path;
+
+  @JsonProperty
+  @JsonSerialize(using = OptionalSerializerString.class)
+  private String nodeManagerUri;
+
+  public Optional<Double> getJvmMaxMemoryMB() {
+    return Optional.fromNullable(jvmMaxMemoryMB);
+  }
+
+  public String getPath() {
+    return path;
+  }
+
+  public Optional<String> getNodeManagerUri() {
+    return Optional.fromNullable(nodeManagerUri);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/NodeManagerConfiguration.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/NodeManagerConfiguration.java b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/NodeManagerConfiguration.java
index 5398aaf..f463957 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/NodeManagerConfiguration.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/NodeManagerConfiguration.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -30,65 +30,65 @@ import com.google.common.base.Optional;
  * Node Manager Configuration
  */
 public class NodeManagerConfiguration {
-    /**
-     * Allot 10% more memory to account for JVM overhead.
-     */
-    public static final double JVM_OVERHEAD = 0.1;
+  /**
+   * Allot 10% more memory to account for JVM overhead.
+   */
+  public static final double JVM_OVERHEAD = 0.1;
 
-    /**
-     * Default -Xmx for NodeManager JVM.
-     */
-    public static final double DEFAULT_JVM_MAX_MEMORY_MB = 2048;
+  /**
+   * Default -Xmx for NodeManager JVM.
+   */
+  public static final double DEFAULT_JVM_MAX_MEMORY_MB = 2048;
 
-    /**
-     * Default cpu for NodeManager JVM.
-     */
-    public static final double DEFAULT_NM_CPUS = 1;
-    
-    public static final String NM_TASK_PREFIX = "nm";
+  /**
+   * Default cpu for NodeManager JVM.
+   */
+  public static final double DEFAULT_NM_CPUS = 1;
 
-    /**
-     * Translates to -Xmx for the NodeManager JVM.
-     */
-    @JsonProperty
-    @JsonSerialize(using = OptionalSerializerDouble.class)
-    private Double jvmMaxMemoryMB;
+  public static final String NM_TASK_PREFIX = "nm";
 
-    /**
-     * Amount of CPU share given to NodeManger JVM. This is critical specially
-     * for NodeManager auxiliary services.
-     */
-    @JsonProperty
-    @JsonSerialize(using = OptionalSerializerDouble.class)
-    private Double cpus;
+  /**
+   * Translates to -Xmx for the NodeManager JVM.
+   */
+  @JsonProperty
+  @JsonSerialize(using = OptionalSerializerDouble.class)
+  private Double jvmMaxMemoryMB;
 
-    /**
-     * Translates to JAVA_OPTS for the NodeManager JVM.
-     */
-    @JsonProperty
-    @JsonSerialize(using = OptionalSerializerString.class)
-    private String jvmOpts;
+  /**
+   * Amount of CPU share given to NodeManger JVM. This is critical specially
+   * for NodeManager auxiliary services.
+   */
+  @JsonProperty
+  @JsonSerialize(using = OptionalSerializerDouble.class)
+  private Double cpus;
 
-    /**
-     * Determines if cgroups are enabled for NM or not.
-     */
-    @JsonProperty
-    @JsonSerialize(using = OptionalSerializerBoolean.class)
-    private Boolean cgroups;
+  /**
+   * Translates to JAVA_OPTS for the NodeManager JVM.
+   */
+  @JsonProperty
+  @JsonSerialize(using = OptionalSerializerString.class)
+  private String jvmOpts;
 
-    public Optional<Double> getJvmMaxMemoryMB() {
-        return Optional.fromNullable(jvmMaxMemoryMB);
-    }
+  /**
+   * Determines if cgroups are enabled for NM or not.
+   */
+  @JsonProperty
+  @JsonSerialize(using = OptionalSerializerBoolean.class)
+  private Boolean cgroups;
 
-    public Optional<String> getJvmOpts() {
-        return Optional.fromNullable(jvmOpts);
-    }
+  public Optional<Double> getJvmMaxMemoryMB() {
+    return Optional.fromNullable(jvmMaxMemoryMB);
+  }
 
-    public Optional<Double> getCpus() {
-        return Optional.fromNullable(cpus);
-    }
+  public Optional<String> getJvmOpts() {
+    return Optional.fromNullable(jvmOpts);
+  }
 
-    public Optional<Boolean> getCgroups() {
-        return Optional.fromNullable(cgroups);
-    }
+  public Optional<Double> getCpus() {
+    return Optional.fromNullable(cpus);
+  }
+
+  public Optional<Boolean> getCgroups() {
+    return Optional.fromNullable(cgroups);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/OptionalSerializer.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/OptionalSerializer.java b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/OptionalSerializer.java
index ce7346e..359abbc 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/OptionalSerializer.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/OptionalSerializer.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -31,10 +31,11 @@ import org.codehaus.jackson.map.SerializerProvider;
 import com.google.common.base.Optional;
 
 /**
- * Custom Serializer that allows to serialize Optional 
+ * Custom Serializer that allows to serialize Optional
  * today Optional does not serialize value, but just state: "present: true/false"
  * This class will serialize <T> value instead of state
  * This is needed for REST APIs and Myriad UI
+ *
  * @param <T>
  */
 public class OptionalSerializer<T> extends JsonSerializer<Optional<T>> {
@@ -42,83 +43,66 @@ public class OptionalSerializer<T> extends JsonSerializer<Optional<T>> {
   private static final JsonFactory jsonFactory = new ObjectMapper().getJsonFactory();
 
   protected ObjectMapper objMapper;
-  
+
   public OptionalSerializer() {
     objMapper = new ObjectMapper(jsonFactory);
   }
-  
+
   @Override
-  public void serialize(Optional<T> value,
-      JsonGenerator jgen, SerializerProvider provider)
-      throws IOException, JsonProcessingException {
+  public void serialize(Optional<T> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
     if (value.isPresent()) {
       objMapper.writeValue(jgen, value.get());
     } else {
       objMapper.writeValue(jgen, "value is absent");
     }
   }
-  
+
   /**
    * Custom String serializer
-   *
    */
   public static class OptionalSerializerString extends OptionalSerializer<String> {
     @Override
-    public void serialize(Optional<String> value, 
-        JsonGenerator jgen, SerializerProvider provider) throws IOException,
-        JsonProcessingException {
+    public void serialize(Optional<String> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
       super.serialize(value, jgen, provider);
     }
   }
-  
+
   /**
    * Custom Double serializer
-   *
    */
   public static class OptionalSerializerDouble extends OptionalSerializer<Double> {
     @Override
-    public void serialize(Optional<Double> value, 
-        JsonGenerator jgen, SerializerProvider provider) throws IOException,
-        JsonProcessingException {
+    public void serialize(Optional<Double> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
       super.serialize(value, jgen, provider);
     }
   }
-  
+
   /**
    * Custom Integer serializer
-   *
    */
   public static class OptionalSerializerInt extends OptionalSerializer<Integer> {
     @Override
-    public void serialize(Optional<Integer> value, 
-        JsonGenerator jgen, SerializerProvider provider) throws IOException,
-        JsonProcessingException {
+    public void serialize(Optional<Integer> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
       super.serialize(value, jgen, provider);
     }
   }
 
   /**
    * Custom Boolean serializer
-   *
    */
   public static class OptionalSerializerBoolean extends OptionalSerializer<Boolean> {
     @Override
-    public void serialize(Optional<Boolean> value, 
-        JsonGenerator jgen, SerializerProvider provider) throws IOException,
-        JsonProcessingException {
+    public void serialize(Optional<Boolean> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
       super.serialize(value, jgen, provider);
     }
   }
 
   /**
    * Custom Map serializer
-   *
    */
   public static class OptionalSerializerMap extends OptionalSerializer<Map<?, ?>> {
     @Override
-    public void serialize(Optional<Map<?, ?>> value, 
-        JsonGenerator jgen, SerializerProvider provider) throws IOException,
-        JsonProcessingException {
+    public void serialize(Optional<Map<?, ?>> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
       super.serialize(value, jgen, provider);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/ServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/ServiceConfiguration.java b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/ServiceConfiguration.java
index 775d4c0..6522728 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/ServiceConfiguration.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/configuration/ServiceConfiguration.java
@@ -1,20 +1,20 @@
 /**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you 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.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 com.ebay.myriad.configuration;
 
@@ -34,16 +34,15 @@ import com.google.common.base.Optional;
 
 /**
  * Configuration for any service/task to be started from Myriad Scheduler
- *
  */
 public class ServiceConfiguration {
-  
+
   private static final Logger LOGGER = LoggerFactory.getLogger(ServiceConfiguration.class);
 
   public static final Double DEFAULT_CPU = 0.1;
-  
+
   public static final Double DEFAULT_MEMORY = 256.0;
-  
+
   /**
    * Translates to -Xmx for the JVM.
    */
@@ -52,7 +51,7 @@ public class ServiceConfiguration {
   protected Double jvmMaxMemoryMB;
 
   /**
-   * Amount of CPU share given to  JVM. 
+   * Amount of CPU share given to  JVM.
    */
   @JsonProperty
   @JsonSerialize(using = OptionalSerializerDouble.class)
@@ -68,7 +67,7 @@ public class ServiceConfiguration {
   @JsonProperty
   @JsonSerialize(using = OptionalSerializerMap.class)
   protected Map<String, Long> ports;
-  
+
   /**
    * If we will have some services
    * that are not easy to express just by properties
@@ -77,36 +76,36 @@ public class ServiceConfiguration {
   @JsonProperty
   @JsonSerialize(using = OptionalSerializerString.class)
   protected String taskFactoryImplName;
-  
+
   @JsonProperty
   protected String envSettings;
-  
+
   @JsonProperty
   @NotEmpty
   protected String taskName;
-  
+
   @JsonProperty
   @JsonSerialize(using = OptionalSerializerInt.class)
   protected Integer maxInstances;
-  
+
   @JsonProperty
   @JsonSerialize(using = OptionalSerializerString.class)
   protected String command;
-  
+
   @JsonProperty
   protected String serviceOptsName;
-  
-  
+
+
   public Optional<Double> getJvmMaxMemoryMB() {
-      return Optional.fromNullable(jvmMaxMemoryMB);
+    return Optional.fromNullable(jvmMaxMemoryMB);
   }
 
   public Optional<String> getJvmOpts() {
-      return Optional.fromNullable(jvmOpts);
+    return Optional.fromNullable(jvmOpts);
   }
 
   public Optional<Double> getCpus() {
-      return Optional.fromNullable(cpus);
+    return Optional.fromNullable(cpus);
   }
 
   public String getTaskName() {
@@ -124,11 +123,11 @@ public class ServiceConfiguration {
   public String getEnvSettings() {
     return envSettings;
   }
-  
+
   public Optional<Map<String, Long>> getPorts() {
     return Optional.fromNullable(ports);
   }
-  
+
   public Optional<Integer> getMaxInstances() {
     return Optional.fromNullable(maxInstances);
   }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/health/HealthCheckUtils.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/health/HealthCheckUtils.java b/myriad-scheduler/src/main/java/com/ebay/myriad/health/HealthCheckUtils.java
index 64c7e35..7c47443 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/health/HealthCheckUtils.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/health/HealthCheckUtils.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -28,18 +28,18 @@ import java.net.Socket;
  * Health Check Utilities
  */
 public class HealthCheckUtils {
-    private static final Logger LOGGER = LoggerFactory.getLogger(HealthCheckUtils.class);
+  private static final Logger LOGGER = LoggerFactory.getLogger(HealthCheckUtils.class);
 
-    public static boolean checkHostPort(String connectionString) {
-        String[] split = connectionString.split(":");
-        String serverAddress = split[0];
-        Integer serverPort = Integer.valueOf(split[1]);
-        try (Socket s = new Socket(serverAddress, serverPort)) {
-            return true;
-        } catch (IOException ex) {
-            LOGGER.error("parsing host port", ex);
-        }
-
-        return false;
+  public static boolean checkHostPort(String connectionString) {
+    String[] split = connectionString.split(":");
+    String serverAddress = split[0];
+    Integer serverPort = Integer.valueOf(split[1]);
+    try (Socket s = new Socket(serverAddress, serverPort)) {
+      return true;
+    } catch (IOException ex) {
+      LOGGER.error("parsing host port", ex);
     }
+
+    return false;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosDriverHealthCheck.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosDriverHealthCheck.java b/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosDriverHealthCheck.java
index 13c1407..e1e05b1 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosDriverHealthCheck.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosDriverHealthCheck.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -29,21 +29,21 @@ import javax.inject.Inject;
  */
 public class MesosDriverHealthCheck extends HealthCheck {
 
-    public static final String NAME = "mesos-driver";
-    private MyriadDriverManager driverManager;
+  public static final String NAME = "mesos-driver";
+  private MyriadDriverManager driverManager;
 
-    @Inject
-    public MesosDriverHealthCheck(MyriadDriverManager driverManager) {
-        this.driverManager = driverManager;
-    }
+  @Inject
+  public MesosDriverHealthCheck(MyriadDriverManager driverManager) {
+    this.driverManager = driverManager;
+  }
 
-    @Override
-    protected Result check() throws Exception {
-        Status driverStatus = driverManager.getDriverStatus();
-        if (Status.DRIVER_RUNNING == driverStatus) {
-            return Result.healthy();
-        } else {
-            return Result.unhealthy("Driver status: " + driverStatus);
-        }
+  @Override
+  protected Result check() throws Exception {
+    Status driverStatus = driverManager.getDriverStatus();
+    if (Status.DRIVER_RUNNING == driverStatus) {
+      return Result.healthy();
+    } else {
+      return Result.unhealthy("Driver status: " + driverStatus);
     }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosMasterHealthCheck.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosMasterHealthCheck.java b/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosMasterHealthCheck.java
index e0d30f5..4a3bd1a 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosMasterHealthCheck.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/health/MesosMasterHealthCheck.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -33,58 +33,56 @@ import java.util.concurrent.TimeUnit;
  * Health check for Mesos master
  */
 public class MesosMasterHealthCheck extends HealthCheck {
-    public static final String NAME = "mesos-master";
+  public static final String NAME = "mesos-master";
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(MesosMasterHealthCheck.class);
+  private static final Logger LOGGER = LoggerFactory.getLogger(MesosMasterHealthCheck.class);
 
-    private MyriadConfiguration cfg;
+  private MyriadConfiguration cfg;
 
-    @Inject
-    public MesosMasterHealthCheck(MyriadConfiguration cfg) {
-        this.cfg = cfg;
-    }
+  @Inject
+  public MesosMasterHealthCheck(MyriadConfiguration cfg) {
+    this.cfg = cfg;
+  }
 
-    @Override
-    protected Result check() throws Exception {
-        String mesosMaster = cfg.getMesosMaster();
-        int zkIndex = mesosMaster.indexOf("zk://", 0);
-        Result result = Result.unhealthy("Unable to connect to: " + mesosMaster);
-        if (zkIndex >= 0) {
-            final int fromIndex = 5;
-            String zkHostPorts = mesosMaster.substring(fromIndex, mesosMaster.indexOf("/", fromIndex));
+  @Override
+  protected Result check() throws Exception {
+    String mesosMaster = cfg.getMesosMaster();
+    int zkIndex = mesosMaster.indexOf("zk://", 0);
+    Result result = Result.unhealthy("Unable to connect to: " + mesosMaster);
+    if (zkIndex >= 0) {
+      final int fromIndex = 5;
+      String zkHostPorts = mesosMaster.substring(fromIndex, mesosMaster.indexOf("/", fromIndex));
 
-            String[] hostPorts = zkHostPorts.split(",");
+      String[] hostPorts = zkHostPorts.split(",");
 
-            for (String hostPort : hostPorts) {
-                final int maxRetries = 3;
-                final int baseSleepTimeMs = 1000;
-                CuratorFramework client = CuratorFrameworkFactory.newClient(
-                        hostPort,
-                        new ExponentialBackoffRetry(baseSleepTimeMs, maxRetries));
-                client.start();
-                final int blockTime = 5;
-                client.blockUntilConnected(blockTime, TimeUnit.SECONDS);
+      for (String hostPort : hostPorts) {
+        final int maxRetries = 3;
+        final int baseSleepTimeMs = 1000;
+        CuratorFramework client = CuratorFrameworkFactory.newClient(hostPort, new ExponentialBackoffRetry(baseSleepTimeMs, maxRetries));
+        client.start();
+        final int blockTime = 5;
+        client.blockUntilConnected(blockTime, TimeUnit.SECONDS);
 
-                switch (client.getState()) {
-                    case STARTED:
-                        result = Result.healthy();
-                        break;
-                    case STOPPED:
-                        LOGGER.info("Unable to reach: ", hostPort);
-                        break;
-                    case LATENT:
-                        LOGGER.info("Unable to reach: ", hostPort);
-                        break;
-                    default:
-                        LOGGER.info("Unable to reach: ", hostPort);
-                }
-            }
-        } else {
-            if (HealthCheckUtils.checkHostPort(mesosMaster)) {
-                result = Result.healthy();
-            }
+        switch (client.getState()) {
+          case STARTED:
+            result = Result.healthy();
+            break;
+          case STOPPED:
+            LOGGER.info("Unable to reach: ", hostPort);
+            break;
+          case LATENT:
+            LOGGER.info("Unable to reach: ", hostPort);
+            break;
+          default:
+            LOGGER.info("Unable to reach: ", hostPort);
         }
-
-        return result;
+      }
+    } else {
+      if (HealthCheckUtils.checkHostPort(mesosMaster)) {
+        result = Result.healthy();
+      }
     }
+
+    return result;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/health/ZookeeperHealthCheck.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/health/ZookeeperHealthCheck.java b/myriad-scheduler/src/main/java/com/ebay/myriad/health/ZookeeperHealthCheck.java
index 65f0aba..079683b 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/health/ZookeeperHealthCheck.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/health/ZookeeperHealthCheck.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -27,17 +27,17 @@ import javax.inject.Inject;
  * Health Check on ZK
  */
 public class ZookeeperHealthCheck extends HealthCheck {
-    public static final String NAME = "zookeeper";
-    private MyriadConfiguration cfg;
+  public static final String NAME = "zookeeper";
+  private MyriadConfiguration cfg;
 
-    @Inject
-    public ZookeeperHealthCheck(MyriadConfiguration cfg) {
-        this.cfg = cfg;
-    }
+  @Inject
+  public ZookeeperHealthCheck(MyriadConfiguration cfg) {
+    this.cfg = cfg;
+  }
 
-    @Override
-    protected Result check() throws Exception {
-        // todo:  (kensipe) this needs to be implemented
-        return Result.healthy();
-    }
+  @Override
+  protected Result check() throws Exception {
+    // todo:  (kensipe) this needs to be implemented
+    return Result.healthy();
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/policy/LeastAMNodesFirstPolicy.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/policy/LeastAMNodesFirstPolicy.java b/myriad-scheduler/src/main/java/com/ebay/myriad/policy/LeastAMNodesFirstPolicy.java
index e27191e..ce26e9b 100644
--- a/myriad-scheduler/src/main/java/com/ebay/myriad/policy/LeastAMNodesFirstPolicy.java
+++ b/myriad-scheduler/src/main/java/com/ebay/myriad/policy/LeastAMNodesFirstPolicy.java
@@ -6,9 +6,9 @@
  * to you 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
- * 
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * 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
@@ -43,128 +43,124 @@ import java.util.concurrent.ConcurrentHashMap;
  * A scale down policy that maintains returns a list of nodes running least number of AMs.
  */
 public class LeastAMNodesFirstPolicy extends BaseInterceptor implements NodeScaleDownPolicy {
-    private static final Logger LOGGER = LoggerFactory.getLogger(LeastAMNodesFirstPolicy.class);
-
-    private final AbstractYarnScheduler yarnScheduler;
-    private final SchedulerState schedulerState;
-
-    //TODO(Santosh): Should figure out the right values for the hashmap properties.
-    // currently it's tuned for 200 nodes and 50 RM RPC threads (Yarn's default).
-    private static final int INITIAL_NODE_SIZE = 200;
-    private static final int EXPECTED_CONCURRENT_ACCCESS_COUNT = 50;
-    private static final float LOAD_FACTOR_DEFAULT = 0.75f;
-
-    private Map<String, SchedulerNode> schedulerNodes =
-        new ConcurrentHashMap<>(INITIAL_NODE_SIZE, LOAD_FACTOR_DEFAULT, EXPECTED_CONCURRENT_ACCCESS_COUNT);
-
-    @Inject
-    public LeastAMNodesFirstPolicy(InterceptorRegistry registry,
-                                   AbstractYarnScheduler yarnScheduler,
-                                   SchedulerState schedulerState) {
-        registry.register(this);
-        this.yarnScheduler = yarnScheduler;
-        this.schedulerState = schedulerState;
+  private static final Logger LOGGER = LoggerFactory.getLogger(LeastAMNodesFirstPolicy.class);
+
+  private final AbstractYarnScheduler yarnScheduler;
+  private final SchedulerState schedulerState;
+
+  //TODO(Santosh): Should figure out the right values for the hashmap properties.
+  // currently it's tuned for 200 nodes and 50 RM RPC threads (Yarn's default).
+  private static final int INITIAL_NODE_SIZE = 200;
+  private static final int EXPECTED_CONCURRENT_ACCCESS_COUNT = 50;
+  private static final float LOAD_FACTOR_DEFAULT = 0.75f;
+
+  private Map<String, SchedulerNode> schedulerNodes = new ConcurrentHashMap<>(INITIAL_NODE_SIZE, LOAD_FACTOR_DEFAULT, EXPECTED_CONCURRENT_ACCCESS_COUNT);
+
+  @Inject
+  public LeastAMNodesFirstPolicy(InterceptorRegistry registry, AbstractYarnScheduler yarnScheduler, SchedulerState schedulerState) {
+    registry.register(this);
+    this.yarnScheduler = yarnScheduler;
+    this.schedulerState = schedulerState;
+  }
+
+  /**
+   * Sort the given list of tasks by the number of App Master containers running on the corresponding NM node.
+   *
+   * @param taskIDs
+   */
+  @Override
+  public void apply(List<Protos.TaskID> taskIDs) {
+    if (LOGGER.isDebugEnabled()) {
+      for (SchedulerNode node : schedulerNodes.values()) {
+        LOGGER.debug("Host {} is running {} containers including {} App Masters", node.getNodeID().getHost(), node.getRunningContainers().size(), getNumAMContainers(node.getRunningContainers()));
+      }
     }
-
-    /**
-     *  Sort the given list of tasks by the number of App Master containers running on the corresponding NM node.
-     * @param taskIDs
-     */
-    @Override
-    public void apply(List<Protos.TaskID> taskIDs) {
-        if (LOGGER.isDebugEnabled()) {
-            for (SchedulerNode node : schedulerNodes.values()) {
-                LOGGER.debug("Host {} is running {} containers including {} App Masters",
-                        node.getNodeID().getHost(), node.getRunningContainers().size(),
-                        getNumAMContainers(node.getRunningContainers()));
+    // We need to lock the YARN scheduler here. If we don't do that, then the YARN scheduler can
+    // process HBs from NodeManagers and the state of SchedulerNode objects might change while we
+    // are in the middle of sorting them based on the least number of AM containers.
+    synchronized (yarnScheduler) {
+      Collections.sort(taskIDs, new Comparator<Protos.TaskID>() {
+        @Override
+        public int compare(Protos.TaskID t1, Protos.TaskID t2) {
+          SchedulerNode o1 = schedulerNodes.get(schedulerState.getTask(t1).getHostname());
+          SchedulerNode o2 = schedulerNodes.get(schedulerState.getTask(t2).getHostname());
+
+          if (o1 == null) { // a NM was launched by Myriad, but it hasn't yet registered with RM
+            if (o2 == null) {
+              return 0;
+            } else {
+              return -1;
             }
-        }
-        // We need to lock the YARN scheduler here. If we don't do that, then the YARN scheduler can
-        // process HBs from NodeManagers and the state of SchedulerNode objects might change while we
-        // are in the middle of sorting them based on the least number of AM containers.
-        synchronized (yarnScheduler) {
-            Collections.sort(taskIDs, new Comparator<Protos.TaskID>() {
-                @Override
-                public int compare(Protos.TaskID t1, Protos.TaskID t2) {
-                    SchedulerNode o1 = schedulerNodes.get(schedulerState.getTask(t1).getHostname());
-                    SchedulerNode o2 = schedulerNodes.get(schedulerState.getTask(t2).getHostname());
-
-                    if (o1 == null) { // a NM was launched by Myriad, but it hasn't yet registered with RM
-                      if (o2 == null) {
-                        return 0;
-                      } else {
-                        return -1;
-                      }
-                    } else if (o2 == null) {
-                      return 1;
-                    } // else, both the NMs have registered with RM
-
-                    List<RMContainer> runningContainers1 = o1.getRunningContainers();
-                    List<RMContainer> runningContainers2 = o2.getRunningContainers();
-
-                    Integer numRunningAMs1 = getNumAMContainers(runningContainers1);
-                    Integer numRunningAMs2 = getNumAMContainers(runningContainers2);
-
-                    Integer numRunningContainers1 = runningContainers1.size();
-                    Integer numRunningContainers2 = runningContainers2.size();
-
-                    // If two NMs are running equal number of AMs, sort them based on total num of running containers
-                    if (numRunningAMs1.compareTo(numRunningAMs2) == 0) {
-                        return numRunningContainers1.compareTo(numRunningContainers2);
-                    }
-                    return numRunningAMs1.compareTo(numRunningAMs2);
-                }
-            });
-        }
-    }
+          } else if (o2 == null) {
+            return 1;
+          } // else, both the NMs have registered with RM
 
-    @Override
-    public void afterSchedulerEventHandled(SchedulerEvent event) {
+          List<RMContainer> runningContainers1 = o1.getRunningContainers();
+          List<RMContainer> runningContainers2 = o2.getRunningContainers();
 
-        try {
-            switch (event.getType()) {
-                case NODE_UPDATE:
-                    onNodeUpdated((NodeUpdateSchedulerEvent) event);
-                    break;
+          Integer numRunningAMs1 = getNumAMContainers(runningContainers1);
+          Integer numRunningAMs2 = getNumAMContainers(runningContainers2);
 
-                case NODE_REMOVED:
-                    onNodeRemoved((NodeRemovedSchedulerEvent) event);
-                    break;
+          Integer numRunningContainers1 = runningContainers1.size();
+          Integer numRunningContainers2 = runningContainers2.size();
 
-                default:
-                    break;
-            }
-        } catch (ClassCastException e) {
-            LOGGER.error("incorrect event object", e);
+          // If two NMs are running equal number of AMs, sort them based on total num of running containers
+          if (numRunningAMs1.compareTo(numRunningAMs2) == 0) {
+            return numRunningContainers1.compareTo(numRunningContainers2);
+          }
+          return numRunningAMs1.compareTo(numRunningAMs2);
         }
+      });
     }
-
-    /**
-     * Called whenever a NM HBs to RM. The NM's updates will already be recorded in the
-     * SchedulerNode before this method is called.
-     *
-     * @param event
-     */
-    private void onNodeUpdated(NodeUpdateSchedulerEvent event) {
-        NodeId nodeID = event.getRMNode().getNodeID();
-        SchedulerNode schedulerNode = yarnScheduler.getSchedulerNode(nodeID);
-        schedulerNodes.put(nodeID.getHost(), schedulerNode); // keep track of only one node per host
+  }
+
+  @Override
+  public void afterSchedulerEventHandled(SchedulerEvent event) {
+
+    try {
+      switch (event.getType()) {
+        case NODE_UPDATE:
+          onNodeUpdated((NodeUpdateSchedulerEvent) event);
+          break;
+
+        case NODE_REMOVED:
+          onNodeRemoved((NodeRemovedSchedulerEvent) event);
+          break;
+
+        default:
+          break;
+      }
+    } catch (ClassCastException e) {
+      LOGGER.error("incorrect event object", e);
     }
-
-    private void onNodeRemoved(NodeRemovedSchedulerEvent event) {
-        SchedulerNode schedulerNode = schedulerNodes.get(event.getRemovedRMNode().getNodeID().getHost());
-        if (schedulerNode != null && schedulerNode.getNodeID().equals(event.getRemovedRMNode().getNodeID())) {
-            schedulerNodes.remove(schedulerNode.getNodeID().getHost());
-        }
+  }
+
+  /**
+   * Called whenever a NM HBs to RM. The NM's updates will already be recorded in the
+   * SchedulerNode before this method is called.
+   *
+   * @param event
+   */
+  private void onNodeUpdated(NodeUpdateSchedulerEvent event) {
+    NodeId nodeID = event.getRMNode().getNodeID();
+    SchedulerNode schedulerNode = yarnScheduler.getSchedulerNode(nodeID);
+    schedulerNodes.put(nodeID.getHost(), schedulerNode); // keep track of only one node per host
+  }
+
+  private void onNodeRemoved(NodeRemovedSchedulerEvent event) {
+    SchedulerNode schedulerNode = schedulerNodes.get(event.getRemovedRMNode().getNodeID().getHost());
+    if (schedulerNode != null && schedulerNode.getNodeID().equals(event.getRemovedRMNode().getNodeID())) {
+      schedulerNodes.remove(schedulerNode.getNodeID().getHost());
     }
-
-    private Integer getNumAMContainers(List<RMContainer> containers) {
-        int count = 0;
-        for (RMContainer container : containers) {
-            if (container.isAMContainer()) {
-                count++;
-            }
-        }
-        return count;
+  }
+
+  private Integer getNumAMContainers(List<RMContainer> containers) {
+    int count = 0;
+    for (RMContainer container : containers) {
+      if (container.isAMContainer()) {
+        count++;
+      }
     }
+    return count;
+  }
 }



Mime
View raw message