http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/SchedulerUtils.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/SchedulerUtils.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/SchedulerUtils.java index 3c868e6..cda1c0e 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/SchedulerUtils.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/SchedulerUtils.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 @@ -34,41 +34,40 @@ import java.util.Collection; * Provides utilities for scheduling with the mesos offers */ public class SchedulerUtils { - private static final Logger LOGGER = LoggerFactory.getLogger(SchedulerUtils.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SchedulerUtils.class); - public static boolean isUniqueHostname(Protos.OfferOrBuilder offer, NodeTask taskToLaunch, - Collection<NodeTask> tasks) { - Preconditions.checkArgument(offer != null); - String offerHostname = offer.getHostname(); + public static boolean isUniqueHostname(Protos.OfferOrBuilder offer, NodeTask taskToLaunch, Collection<NodeTask> tasks) { + Preconditions.checkArgument(offer != null); + String offerHostname = offer.getHostname(); - if (!CollectionUtils.isEmpty(tasks)) { - for (NodeTask task : tasks) { - if (offerHostname.equalsIgnoreCase(task.getHostname())) { - LOGGER.debug("Offer's hostname {} is not unique", offerHostname); - return false; - } - } + if (!CollectionUtils.isEmpty(tasks)) { + for (NodeTask task : tasks) { + if (offerHostname.equalsIgnoreCase(task.getHostname())) { + LOGGER.debug("Offer's hostname {} is not unique", offerHostname); + return false; } - LOGGER.debug("Offer's hostname {} is unique", offerHostname); - return true; + } } + LOGGER.debug("Offer's hostname {} is unique", offerHostname); + return true; + } /** - * Determines if a given host has a nodemanager running with zero profile. Node Managers - * launched with zero profile (zero cpu & memory) are eligible for fine grained scaling. - * Node Managers launched with a non-zero profile size are not eligible for fine grained scaling. - * - * @param hostName - * @return - */ - public static boolean isEligibleForFineGrainedScaling(String hostName, SchedulerState state) { - for (NodeTask activeNMTask : state.getActiveTasksByType(NodeManagerConfiguration.NM_TASK_PREFIX)) { - if (activeNMTask.getProfile().getCpus() == 0 && - activeNMTask.getProfile().getMemory() == 0 && - activeNMTask.getHostname().equals(hostName)) { - return true; - } + * Determines if a given host has a nodemanager running with zero profile. Node Managers + * launched with zero profile (zero cpu & memory) are eligible for fine grained scaling. + * Node Managers launched with a non-zero profile size are not eligible for fine grained scaling. + * + * @param hostName + * @return + */ + public static boolean isEligibleForFineGrainedScaling(String hostName, SchedulerState state) { + for (NodeTask activeNMTask : state.getActiveTasksByType(NodeManagerConfiguration.NM_TASK_PREFIX)) { + if (activeNMTask.getProfile().getCpus() == 0 && + activeNMTask.getProfile().getMemory() == 0 && + activeNMTask.getHostname().equals(hostName)) { + return true; } - return false; } + return false; + } }
http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceCommandLineGenerator.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceCommandLineGenerator.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceCommandLineGenerator.java index 7d6c578..aa8c1b6 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceCommandLineGenerator.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceCommandLineGenerator.java @@ -1,33 +1,31 @@ /** -* 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.scheduler; import com.ebay.myriad.configuration.MyriadConfiguration; /** * CommandLineGenerator for any aux service launched by Myriad as binary distro - * */ public class ServiceCommandLineGenerator extends DownloadNMExecutorCLGenImpl { - - public ServiceCommandLineGenerator(MyriadConfiguration cfg, - String nodeManagerUri) { + + public ServiceCommandLineGenerator(MyriadConfiguration cfg, String nodeManagerUri) { super(cfg, nodeManagerUri); } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceProfileManager.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceProfileManager.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceProfileManager.java index d333d92..8ee3bc1 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceProfileManager.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceProfileManager.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,7 +28,6 @@ import com.google.gson.Gson; /** * Class to keep all the ServiceResourceProfiles together - * */ public class ServiceProfileManager { private static final Logger LOGGER = LoggerFactory.getLogger(ServiceProfileManager.class); @@ -36,22 +35,21 @@ public class ServiceProfileManager { private Map<String, ServiceResourceProfile> profiles = new ConcurrentHashMap<>(); public ServiceResourceProfile get(String name) { - return profiles.get(name); + return profiles.get(name); } public void add(ServiceResourceProfile profile) { - LOGGER.info("Adding profile {} with CPU: {} and Memory: {}", - profile.getName(), profile.getCpus(), profile.getMemory()); - profiles.put(profile.getName(), profile); + LOGGER.info("Adding profile {} with CPU: {} and Memory: {}", profile.getName(), profile.getCpus(), profile.getMemory()); + profiles.put(profile.getName(), profile); } public boolean exists(String name) { - return this.profiles.containsKey(name); + return this.profiles.containsKey(name); } public String toString() { - Gson gson = new Gson(); - return gson.toJson(this); + 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/scheduler/ServiceResourceProfile.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceResourceProfile.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceResourceProfile.java index 6224024..2b36b22 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceResourceProfile.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceResourceProfile.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,8 +30,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonParseException; /** - * Resource Profile for any service - * + * Resource Profile for any service */ public class ServiceResourceProfile { @@ -48,11 +47,11 @@ public class ServiceResourceProfile { protected final Double memory; protected Double executorCpu = 0.0; - + protected Double executorMemory = 0.0; - + protected String className; - + public ServiceResourceProfile(String name, Double cpu, Double mem) { this.name = name; this.cpus = cpu; @@ -72,15 +71,15 @@ public class ServiceResourceProfile { public Double getMemory() { return memory; } - + public Double getAggregateMemory() { return memory; } - + public Double getAggregateCpu() { return cpus; } - + public Double getExecutorCpu() { return executorCpu; } @@ -100,26 +99,23 @@ public class ServiceResourceProfile { @Override public String toString() { - Gson gson = new Gson(); - return gson.toJson(this); + Gson gson = new Gson(); + return gson.toJson(this); } - + /** * Custom serializer to help with deserialization of class hierarchy - * since at the point of deserialization we don't know class of the data + * since at the point of deserialization we don't know class of the data * that is being deserialized - * */ public static class CustomDeserializer implements JsonDeserializer<ServiceResourceProfile> { private static final Logger LOGGER = LoggerFactory.getLogger(CustomDeserializer.class); - + @Override - public ServiceResourceProfile deserialize(JsonElement json, Type typeOfT, - JsonDeserializationContext context) throws JsonParseException { + public ServiceResourceProfile deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String type = json.getAsJsonObject().get("className").getAsString(); try { - @SuppressWarnings("rawtypes") - Class c = Class.forName(type); + @SuppressWarnings("rawtypes") Class c = Class.forName(type); if (ServiceResourceProfile.class.equals(c)) { return new Gson().fromJson(json, typeOfT); } @@ -130,6 +126,6 @@ public class ServiceResourceProfile { } return null; } - + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskConstraints.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskConstraints.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskConstraints.java index 0ec0667..45e5327 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskConstraints.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskConstraints.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,12 +27,11 @@ import com.ebay.myriad.configuration.ServiceConfiguration; * ServiceTaskConstraints is an implementation of TaskConstraints for a service * at this point constraints are on ports * Later on there may be other types of constraints added - * */ public class ServiceTaskConstraints implements TaskConstraints { private int portsCount; - + public ServiceTaskConstraints(MyriadConfiguration cfg, String taskPrefix) { this.portsCount = 0; Map<String, ServiceConfiguration> auxConfigs = cfg.getServiceConfigurations(); @@ -46,7 +45,7 @@ public class ServiceTaskConstraints implements TaskConstraints { } } } - + @Override public int portsCount() { return portsCount; http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskFactoryImpl.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskFactoryImpl.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskFactoryImpl.java index 19c76d0..ead2326 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskFactoryImpl.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/ServiceTaskFactoryImpl.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.scheduler; import java.util.ArrayList; @@ -50,14 +50,13 @@ import com.google.common.annotations.VisibleForTesting; * 1. command to run * 2. Additional env. variables to set (serviceOpts) * 3. ports to use with names of the properties - * 4. TODO (yufeldman) executor info - * + * 4. TODO (yufeldman) executor info */ public class ServiceTaskFactoryImpl implements TaskFactory { private static final Logger LOGGER = LoggerFactory.getLogger(ServiceTaskFactoryImpl.class); - + public static final long DEFAULT_PORT_NUMBER = 0; - + private MyriadConfiguration cfg; @SuppressWarnings("unused") private TaskUtils taskUtils; @@ -71,31 +70,29 @@ public class ServiceTaskFactoryImpl implements TaskFactory { } @Override - public TaskInfo createTask(Offer offer, FrameworkID frameworkId, - TaskID taskId, NodeTask nodeTask) { + public TaskInfo createTask(Offer offer, FrameworkID frameworkId, TaskID taskId, NodeTask nodeTask) { Objects.requireNonNull(offer, "Offer should be non-null"); Objects.requireNonNull(nodeTask, "NodeTask should be non-null"); - ServiceConfiguration serviceConfig = - cfg.getServiceConfiguration(nodeTask.getTaskPrefix()); - + ServiceConfiguration serviceConfig = cfg.getServiceConfiguration(nodeTask.getTaskPrefix()); + Objects.requireNonNull(serviceConfig, "ServiceConfig should be non-null"); Objects.requireNonNull(serviceConfig.getCommand().orNull(), "command for ServiceConfig should be non-null"); - + final String serviceHostName = "0.0.0.0"; final String serviceEnv = serviceConfig.getEnvSettings(); final String rmHostName = System.getProperty(YARN_RESOURCEMANAGER_HOSTNAME); List<Long> additionalPortsNumbers = null; - + final StringBuilder strB = new StringBuilder("env "); if (serviceConfig.getServiceOpts() != null) { strB.append(serviceConfig.getServiceOpts()).append("="); - + strB.append("\""); if (rmHostName != null && !rmHostName.isEmpty()) { strB.append("-D" + YARN_RESOURCEMANAGER_HOSTNAME + "=" + rmHostName + " "); } - + Map<String, Long> ports = serviceConfig.getPorts().orNull(); if (ports != null && !ports.isEmpty()) { int neededPortsCount = 0; @@ -117,53 +114,34 @@ public class ServiceTaskFactoryImpl implements TaskFactory { } strB.append("-D" + portProperty + "=" + serviceHostName + ":" + port + " "); } - } + } strB.append(serviceEnv); strB.append("\""); } strB.append(" "); strB.append(serviceConfig.getCommand().get()); - + CommandInfo commandInfo = createCommandInfo(nodeTask.getProfile(), strB.toString()); LOGGER.info("Command line for service: {} is: {}", nodeTask.getTaskPrefix(), strB.toString()); - - Scalar taskMemory = Scalar.newBuilder() - .setValue(nodeTask.getProfile().getMemory()) - .build(); - Scalar taskCpus = Scalar.newBuilder() - .setValue(nodeTask.getProfile().getCpus()) - .build(); + + Scalar taskMemory = Scalar.newBuilder().setValue(nodeTask.getProfile().getMemory()).build(); + Scalar taskCpus = Scalar.newBuilder().setValue(nodeTask.getProfile().getCpus()).build(); TaskInfo.Builder taskBuilder = TaskInfo.newBuilder(); - - taskBuilder.setName(nodeTask.getTaskPrefix()) - .setTaskId(taskId) - .setSlaveId(offer.getSlaveId()) - .addResources( - Resource.newBuilder().setName("cpus") - .setType(Value.Type.SCALAR) - .setScalar(taskCpus) - .build()) - .addResources( - Resource.newBuilder().setName("mem") - .setType(Value.Type.SCALAR) - .setScalar(taskMemory) - .build()); - + + taskBuilder.setName(nodeTask.getTaskPrefix()).setTaskId(taskId).setSlaveId(offer.getSlaveId()).addResources(Resource.newBuilder().setName("cpus").setType(Value.Type.SCALAR).setScalar(taskCpus).build()).addResources(Resource.newBuilder() + .setName("mem").setType(Value.Type.SCALAR).setScalar(taskMemory).build()); + if (additionalPortsNumbers != null && !additionalPortsNumbers.isEmpty()) { // set ports Value.Ranges.Builder valueRanger = Value.Ranges.newBuilder(); for (Long port : additionalPortsNumbers) { - valueRanger.addRange(Value.Range.newBuilder() - .setBegin(port) - .setEnd(port)); + valueRanger.addRange(Value.Range.newBuilder().setBegin(port).setEnd(port)); } - - taskBuilder.addResources(Resource.newBuilder().setName("ports") - .setType(Value.Type.RANGES) - .setRanges(valueRanger.build())); + + taskBuilder.addResources(Resource.newBuilder().setName("ports").setType(Value.Type.RANGES).setRanges(valueRanger.build())); } taskBuilder.setCommand(commandInfo); return taskBuilder.build(); @@ -175,11 +153,9 @@ public class ServiceTaskFactoryImpl implements TaskFactory { CommandInfo.Builder commandInfo = CommandInfo.newBuilder(); Map<String, String> envVars = cfg.getYarnEnvironment(); if (envVars != null && !envVars.isEmpty()) { - org.apache.mesos.Protos.Environment.Builder yarnHomeB = - org.apache.mesos.Protos.Environment.newBuilder(); + org.apache.mesos.Protos.Environment.Builder yarnHomeB = org.apache.mesos.Protos.Environment.newBuilder(); for (Map.Entry<String, String> envEntry : envVars.entrySet()) { - org.apache.mesos.Protos.Environment.Variable.Builder yarnEnvB = - org.apache.mesos.Protos.Environment.Variable.newBuilder(); + org.apache.mesos.Protos.Environment.Variable.Builder yarnEnvB = org.apache.mesos.Protos.Environment.Variable.newBuilder(); yarnEnvB.setName(envEntry.getKey()).setValue(envEntry.getValue()); yarnHomeB.addVariables(yarnEnvB.build()); } @@ -189,13 +165,12 @@ public class ServiceTaskFactoryImpl implements TaskFactory { if (myriadExecutorConfiguration.getNodeManagerUri().isPresent()) { //Both FrameworkUser and FrameworkSuperuser to get all of the directory permissions correct. if (!(cfg.getFrameworkUser().isPresent() && cfg.getFrameworkSuperUser().isPresent())) { - throw new RuntimeException("Trying to use remote distribution, but frameworkUser" + - "and/or frameworkSuperUser not set!"); + throw new RuntimeException("Trying to use remote distribution, but frameworkUser" + "and/or frameworkSuperUser not set!"); } LOGGER.info("Using remote distribution"); String clGeneratedCommand = clGenerator.generateCommandLine(profile, null); - + String nmURIString = myriadExecutorConfiguration.getNodeManagerUri().get(); //Concatenate all the subcommands @@ -204,14 +179,12 @@ public class ServiceTaskFactoryImpl implements TaskFactory { //get the nodemanagerURI //We're going to extract ourselves, so setExtract is false LOGGER.info("Getting Hadoop distribution from:" + nmURIString); - URI nmUri = URI.newBuilder().setValue(nmURIString).setExtract(false) - .build(); + URI nmUri = URI.newBuilder().setValue(nmURIString).setExtract(false).build(); //get configs directly from resource manager String configUrlString = clGenerator.getConfigurationUrl(); LOGGER.info("Getting config from:" + configUrlString); - URI configUri = URI.newBuilder().setValue(configUrlString) - .build(); + URI configUri = URI.newBuilder().setValue(configUrlString).build(); LOGGER.info("Slave will execute command:" + cmd); commandInfo.addUris(nmUri).addUris(configUri).setValue("echo \"" + cmd + "\";" + cmd); @@ -224,8 +197,7 @@ public class ServiceTaskFactoryImpl implements TaskFactory { } @Override - public ExecutorInfo getExecutorInfoForSlave(FrameworkID frameworkId, - Offer offer, CommandInfo commandInfo) { + public ExecutorInfo getExecutorInfoForSlave(FrameworkID frameworkId, Offer offer, CommandInfo commandInfo) { // TODO (yufeldman) if executor specified use it , otherwise return null // nothing to implement here, since we are using default slave executor return null; @@ -233,6 +205,7 @@ public class ServiceTaskFactoryImpl implements TaskFactory { /** * Helper method to reserve ports + * * @param offer * @param requestedPorts * @return @@ -242,8 +215,8 @@ public class ServiceTaskFactoryImpl implements TaskFactory { return null; } final List<Long> returnedPorts = new ArrayList<>(); - for (Resource resource : offer.getResourcesList()){ - if (resource.getName().equals("ports")){ + for (Resource resource : offer.getResourcesList()) { + if (resource.getName().equals("ports")) { Iterator<Value.Range> itr = resource.getRanges().getRangeList().iterator(); while (itr.hasNext()) { Value.Range range = itr.next(); @@ -253,7 +226,7 @@ public class ServiceTaskFactoryImpl implements TaskFactory { returnedPorts.add(i); i++; } - if (returnedPorts.size() >= requestedPorts) { + if (returnedPorts.size() >= requestedPorts) { return returnedPorts; } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraints.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraints.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraints.java index 5dbd894..2af11a7 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraints.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraints.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.scheduler; @@ -27,8 +27,9 @@ public interface TaskConstraints { /** * Required number of ports + * * @return portsNumber */ public int portsCount(); - + } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraintsManager.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraintsManager.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraintsManager.java index 3a80a6f..d4973c2 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraintsManager.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskConstraintsManager.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 @@ -23,7 +23,6 @@ import java.util.Map; /** * Factory class to keep map of the constraints - * */ public class TaskConstraintsManager { @@ -32,17 +31,17 @@ public class TaskConstraintsManager { * if/when later on it will change we may need to change HashMap to Concurrent one */ private Map<String, TaskConstraints> taskConstraintsMap = new HashMap<>(); - + public TaskConstraints getConstraints(String taskPrefix) { return taskConstraintsMap.get(taskPrefix); } - + public void addTaskConstraints(final String taskPrefix, final TaskConstraints taskConstraints) { if (taskConstraints != null) { taskConstraintsMap.put(taskPrefix, taskConstraints); } } - + public boolean exists(String taskPrefix) { return taskConstraintsMap.containsKey(taskPrefix); } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskFactory.java index a1bbed4..5166ee4 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskFactory.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,17 +55,15 @@ public interface TaskFactory { static final String YARN_HTTP_POLICY = "yarn.http.policy"; static final String YARN_HTTP_POLICY_HTTPS_ONLY = "HTTPS_ONLY"; - TaskInfo createTask(Offer offer, FrameworkID frameworkId, - TaskID taskId, NodeTask nodeTask); + TaskInfo createTask(Offer offer, FrameworkID frameworkId, TaskID taskId, NodeTask nodeTask); // TODO(Santosh): This is needed because the ExecutorInfo constructed // to launch NM needs to be specified to launch placeholder tasks for // yarn containers (for fine grained scaling). // If mesos supports just specifying the 'ExecutorId' without the full // ExecutorInfo, we wouldn't need this interface method. - ExecutorInfo getExecutorInfoForSlave(FrameworkID frameworkId, - Offer offer, CommandInfo commandInfo); - + ExecutorInfo getExecutorInfoForSlave(FrameworkID frameworkId, Offer offer, CommandInfo commandInfo); + /** * Creates TaskInfo objects to launch NMs as mesos tasks. */ @@ -81,8 +79,7 @@ public interface TaskFactory { private TaskConstraints constraints; @Inject - public NMTaskFactoryImpl(MyriadConfiguration cfg, TaskUtils taskUtils, - ExecutorCommandLineGenerator clGenerator) { + public NMTaskFactoryImpl(MyriadConfiguration cfg, TaskUtils taskUtils, ExecutorCommandLineGenerator clGenerator) { this.cfg = cfg; this.taskUtils = taskUtils; this.clGenerator = clGenerator; @@ -92,8 +89,8 @@ public interface TaskFactory { //Utility function to get the first NMPorts.expectedNumPorts number of ports of an offer private static NMPorts getPorts(Offer offer) { HashSet<Long> ports = new HashSet<>(); - for (Resource resource : offer.getResourcesList()){ - if (resource.getName().equals("ports")){ + for (Resource resource : offer.getResourcesList()) { + if (resource.getName().equals("ports")) { /* ranges.getRangeList() returns a list of ranges, each range specifies a begin and end only. so must loop though each range until we get all ports needed. We exit each loop as soon as all @@ -114,7 +111,7 @@ public interface TaskFactory { } Preconditions.checkState(ports.size() == NMPorts.expectedNumPorts(), "Not enough ports in offer"); - Long [] portArray = ports.toArray(new Long [ports.size()]); + Long[] portArray = ports.toArray(new Long[ports.size()]); return new NMPorts(portArray); } @@ -127,8 +124,7 @@ public interface TaskFactory { if (myriadExecutorConfiguration.getNodeManagerUri().isPresent()) { //Both FrameworkUser and FrameworkSuperuser to get all of the directory permissions correct. if (!(cfg.getFrameworkUser().isPresent() && cfg.getFrameworkSuperUser().isPresent())) { - throw new RuntimeException("Trying to use remote distribution, but frameworkUser" + - "and/or frameworkSuperUser not set!"); + throw new RuntimeException("Trying to use remote distribution, but frameworkUser" + "and/or frameworkSuperUser not set!"); } String nodeManagerUri = myriadExecutorConfiguration.getNodeManagerUri().get(); cmd = clGenerator.generateCommandLine(profile, ports); @@ -141,8 +137,7 @@ public interface TaskFactory { //get configs directly from resource manager String configUrlString = clGenerator.getConfigurationUrl(); LOGGER.info("Getting config from:" + configUrlString); - URI configUri = URI.newBuilder().setValue(configUrlString) - .build(); + URI configUri = URI.newBuilder().setValue(configUrlString).build(); LOGGER.info("Slave will execute command:" + cmd); commandInfo.addUris(nmUri).addUris(configUri).setValue("echo \"" + cmd + "\";" + cmd); commandInfo.setUser(cfg.getFrameworkSuperUser().get()); @@ -167,86 +162,34 @@ public interface TaskFactory { LOGGER.debug(ports.toString()); ServiceResourceProfile serviceProfile = nodeTask.getProfile(); - Scalar taskMemory = Scalar.newBuilder() - .setValue(serviceProfile.getAggregateMemory()) - .build(); - Scalar taskCpus = Scalar.newBuilder() - .setValue(serviceProfile.getAggregateCpu()) - .build(); + Scalar taskMemory = Scalar.newBuilder().setValue(serviceProfile.getAggregateMemory()).build(); + Scalar taskCpus = Scalar.newBuilder().setValue(serviceProfile.getAggregateCpu()).build(); CommandInfo commandInfo = getCommandInfo(serviceProfile, ports); ExecutorInfo executorInfo = getExecutorInfoForSlave(frameworkId, offer, commandInfo); - TaskInfo.Builder taskBuilder = TaskInfo.newBuilder() - .setName("task-" + taskId.getValue()) - .setTaskId(taskId) - .setSlaveId(offer.getSlaveId()); + TaskInfo.Builder taskBuilder = TaskInfo.newBuilder().setName("task-" + taskId.getValue()).setTaskId(taskId).setSlaveId(offer.getSlaveId()); - return taskBuilder - .addResources( - Resource.newBuilder().setName("cpus") - .setType(Value.Type.SCALAR) - .setScalar(taskCpus) - .build()) - .addResources( - Resource.newBuilder().setName("mem") - .setType(Value.Type.SCALAR) - .setScalar(taskMemory) - .build()) - .addResources( - Resource.newBuilder().setName("ports") - .setType(Value.Type.RANGES) - .setRanges(Value.Ranges.newBuilder() - .addRange(Value.Range.newBuilder() - .setBegin(ports.getRpcPort()) - .setEnd(ports.getRpcPort()) - .build()) - .addRange(Value.Range.newBuilder() - .setBegin(ports.getLocalizerPort()) - .setEnd(ports.getLocalizerPort()) - .build()) - .addRange(Value.Range.newBuilder() - .setBegin(ports.getWebAppHttpPort()) - .setEnd(ports.getWebAppHttpPort()) - .build()) - .addRange(Value.Range.newBuilder() - .setBegin(ports.getShufflePort()) - .setEnd(ports.getShufflePort()) - .build()))) - .setExecutor(executorInfo).build(); + return taskBuilder.addResources(Resource.newBuilder().setName("cpus").setType(Value.Type.SCALAR).setScalar(taskCpus).build()).addResources(Resource.newBuilder().setName("mem").setType(Value.Type.SCALAR).setScalar(taskMemory).build()) + .addResources(Resource.newBuilder().setName("ports").setType(Value.Type.RANGES).setRanges(Value.Ranges.newBuilder().addRange(Value.Range.newBuilder().setBegin(ports.getRpcPort()).setEnd(ports.getRpcPort()).build()).addRange(Value.Range + .newBuilder().setBegin(ports.getLocalizerPort()).setEnd(ports.getLocalizerPort()).build()).addRange(Value.Range.newBuilder().setBegin(ports.getWebAppHttpPort()).setEnd(ports.getWebAppHttpPort()).build()).addRange(Value.Range + .newBuilder().setBegin(ports.getShufflePort()).setEnd(ports.getShufflePort()).build()))).setExecutor(executorInfo).build(); } @Override - public ExecutorInfo getExecutorInfoForSlave(FrameworkID frameworkId, Offer offer, - CommandInfo commandInfo) { - Scalar executorMemory = Scalar.newBuilder() - .setValue(taskUtils.getExecutorMemory()).build(); - Scalar executorCpus = Scalar.newBuilder() - .setValue(taskUtils.getExecutorCpus()).build(); - - ExecutorID executorId = ExecutorID.newBuilder() - .setValue(EXECUTOR_PREFIX + frameworkId.getValue() + - offer.getId().getValue() + offer.getSlaveId().getValue()) - .build(); - return ExecutorInfo - .newBuilder() - .setCommand(commandInfo) - .setName(EXECUTOR_NAME) - .addResources( - Resource.newBuilder().setName("cpus") - .setType(Value.Type.SCALAR) - .setScalar(executorCpus).build()) - .addResources( - Resource.newBuilder().setName("mem") - .setType(Value.Type.SCALAR) - .setScalar(executorMemory).build()) - .setExecutorId(executorId).build(); + public ExecutorInfo getExecutorInfoForSlave(FrameworkID frameworkId, Offer offer, CommandInfo commandInfo) { + Scalar executorMemory = Scalar.newBuilder().setValue(taskUtils.getExecutorMemory()).build(); + Scalar executorCpus = Scalar.newBuilder().setValue(taskUtils.getExecutorCpus()).build(); + + ExecutorID executorId = ExecutorID.newBuilder().setValue(EXECUTOR_PREFIX + frameworkId.getValue() + + offer.getId().getValue() + offer.getSlaveId().getValue()).build(); + return ExecutorInfo.newBuilder().setCommand(commandInfo).setName(EXECUTOR_NAME).addResources(Resource.newBuilder().setName("cpus").setType(Value.Type.SCALAR).setScalar(executorCpus).build()).addResources(Resource.newBuilder().setName("mem") + .setType(Value.Type.SCALAR).setScalar(executorMemory).build()).setExecutorId(executorId).build(); } } - + /** * Implement NM Task Constraints - * */ public static class NMTaskConstraints implements TaskConstraints { http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskTerminator.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskTerminator.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskTerminator.java index a048f30..587d3dc 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskTerminator.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskTerminator.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 @@ -38,54 +38,49 @@ import org.slf4j.LoggerFactory; * {@link TaskTerminator} is responsible for killing tasks. */ public class TaskTerminator implements Runnable { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskTerminator.class); + private static final Logger LOGGER = LoggerFactory.getLogger(TaskTerminator.class); - private final SchedulerState schedulerState; - private final MyriadDriverManager driverManager; - private final OfferLifecycleManager offerLifeCycleManager; + private final SchedulerState schedulerState; + private final MyriadDriverManager driverManager; + private final OfferLifecycleManager offerLifeCycleManager; - @Inject - public TaskTerminator(SchedulerState schedulerState, - MyriadDriverManager driverManager, - OfferLifecycleManager offerLifecycleManager) { - this.schedulerState = schedulerState; - this.driverManager = driverManager; - this.offerLifeCycleManager = offerLifecycleManager; - } + @Inject + public TaskTerminator(SchedulerState schedulerState, MyriadDriverManager driverManager, OfferLifecycleManager offerLifecycleManager) { + this.schedulerState = schedulerState; + this.driverManager = driverManager; + this.offerLifeCycleManager = offerLifecycleManager; + } - @Override - public void run() { - // clone a copy of the killable tasks - Set<TaskID> killableTasks = Sets.newHashSet(schedulerState.getKillableTasks()); + @Override + public void run() { + // clone a copy of the killable tasks + Set<TaskID> killableTasks = Sets.newHashSet(schedulerState.getKillableTasks()); - if (CollectionUtils.isEmpty(killableTasks)) { - return; - } + if (CollectionUtils.isEmpty(killableTasks)) { + return; + } - Status driverStatus = driverManager.getDriverStatus(); - if (Status.DRIVER_RUNNING != driverStatus) { - LOGGER.warn( - "Cannot kill tasks, as driver is not running. Status: {}", - driverStatus); - return; - } + Status driverStatus = driverManager.getDriverStatus(); + if (Status.DRIVER_RUNNING != driverStatus) { + LOGGER.warn("Cannot kill tasks, as driver is not running. Status: {}", driverStatus); + return; + } - for (TaskID taskIdToKill : killableTasks) { - if (this.schedulerState.getPendingTaskIds().contains(taskIdToKill)) { - this.schedulerState.removeTask(taskIdToKill); - } else { - Status status = this.driverManager.kill(taskIdToKill); - NodeTask task = schedulerState.getTask(taskIdToKill); - if (task != null) { - offerLifeCycleManager.declineOutstandingOffers( - task.getHostname()); - this.schedulerState.removeTask(taskIdToKill); - } else { - schedulerState.removeTask(taskIdToKill); - LOGGER.warn("NodeTask with taskId: {} does not exist", taskIdToKill); - } - Preconditions.checkState(status == Status.DRIVER_RUNNING); - } + for (TaskID taskIdToKill : killableTasks) { + if (this.schedulerState.getPendingTaskIds().contains(taskIdToKill)) { + this.schedulerState.removeTask(taskIdToKill); + } else { + Status status = this.driverManager.kill(taskIdToKill); + NodeTask task = schedulerState.getTask(taskIdToKill); + if (task != null) { + offerLifeCycleManager.declineOutstandingOffers(task.getHostname()); + this.schedulerState.removeTask(taskIdToKill); + } else { + schedulerState.removeTask(taskIdToKill); + LOGGER.warn("NodeTask with taskId: {} does not exist", taskIdToKill); } + Preconditions.checkState(status == Status.DRIVER_RUNNING); + } } + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskUtils.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskUtils.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskUtils.java index 3dfeb44..7890d26 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskUtils.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskUtils.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 @@ -59,161 +59,151 @@ import java.io.StringWriter; * utility class for working with tasks and node manager profiles */ public class TaskUtils { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskUtils.class); + private static final Logger LOGGER = LoggerFactory.getLogger(TaskUtils.class); - private static final String YARN_NODEMANAGER_RESOURCE_CPU_VCORES = "yarn.nodemanager.resource.cpu-vcores"; - private static final String YARN_NODEMANAGER_RESOURCE_MEMORY_MB = "yarn.nodemanager.resource.memory-mb"; + private static final String YARN_NODEMANAGER_RESOURCE_CPU_VCORES = "yarn.nodemanager.resource.cpu-vcores"; + private static final String YARN_NODEMANAGER_RESOURCE_MEMORY_MB = "yarn.nodemanager.resource.memory-mb"; - private MyriadConfiguration cfg; + private MyriadConfiguration cfg; - @Inject - public TaskUtils(MyriadConfiguration cfg) { - this.cfg = cfg; - } + @Inject + public TaskUtils(MyriadConfiguration cfg) { + this.cfg = cfg; + } - public static String getRevisedConfig(Double cpu, Double memory) { - String revisedConfig = ""; - try { - - // todo:(kgs) replace with more abstract xml parser - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - DocumentBuilder builder; - Document doc; - - builder = factory.newDocumentBuilder(); - InputStream resourceAsStream = - TaskUtils.class.getClassLoader().getResourceAsStream("yarn-site.xml"); - - doc = builder.parse(new InputSource(resourceAsStream)); - resourceAsStream.close(); - - XPathFactory xFactory = XPathFactory.newInstance(); - - XPath xpath = xFactory.newXPath(); - XPathExpression cpuXpath = xpath.compile("//property/name"); - Object cpuNodeObj = cpuXpath.evaluate(doc, XPathConstants.NODESET); - - NodeList cpuNode = (NodeList) cpuNodeObj; - - for (int i = 0; i < cpuNode.getLength(); i++) { - Node item = cpuNode.item(i); - if (YARN_NODEMANAGER_RESOURCE_CPU_VCORES.equals(item.getTextContent())) { - Node propertyNode = item.getParentNode(); - NodeList childNodes = propertyNode.getChildNodes(); - for (int j = 0; j < childNodes.getLength(); j++) { - Node item2 = childNodes.item(j); - if ("value".equals(item2.getNodeName())) { - item2.setTextContent(cpu.intValue() + ""); - } - } - } else if (YARN_NODEMANAGER_RESOURCE_MEMORY_MB.equals(item.getTextContent())) { - Node propertyNode = item.getParentNode(); - NodeList childNodes = propertyNode.getChildNodes(); - for (int j = 0; j < childNodes.getLength(); j++) { - Node item2 = childNodes.item(j); - if ("value".equals(item2.getNodeName())) { - item2.setTextContent(memory.intValue() + ""); - } - } - } - } + public static String getRevisedConfig(Double cpu, Double memory) { + String revisedConfig = ""; + try { + + // todo:(kgs) replace with more abstract xml parser + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + DocumentBuilder builder; + Document doc; + + builder = factory.newDocumentBuilder(); + InputStream resourceAsStream = TaskUtils.class.getClassLoader().getResourceAsStream("yarn-site.xml"); + + doc = builder.parse(new InputSource(resourceAsStream)); + resourceAsStream.close(); + + XPathFactory xFactory = XPathFactory.newInstance(); + + XPath xpath = xFactory.newXPath(); + XPathExpression cpuXpath = xpath.compile("//property/name"); + Object cpuNodeObj = cpuXpath.evaluate(doc, XPathConstants.NODESET); + + NodeList cpuNode = (NodeList) cpuNodeObj; - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - StringWriter writer = new StringWriter(); - transformer.transform(new DOMSource(doc), new StreamResult(writer)); - - revisedConfig = writer.getBuffer().toString().replaceAll("\n|\r", ""); - } catch (TransformerConfigurationException e) { - e.printStackTrace(); - } catch (TransformerException | SAXException | XPathExpressionException | ParserConfigurationException e) { - LOGGER.error("Error with xml operation", e); - } catch (IOException e) { - LOGGER.error("Error with xml operation", e); + for (int i = 0; i < cpuNode.getLength(); i++) { + Node item = cpuNode.item(i); + if (YARN_NODEMANAGER_RESOURCE_CPU_VCORES.equals(item.getTextContent())) { + Node propertyNode = item.getParentNode(); + NodeList childNodes = propertyNode.getChildNodes(); + for (int j = 0; j < childNodes.getLength(); j++) { + Node item2 = childNodes.item(j); + if ("value".equals(item2.getNodeName())) { + item2.setTextContent(cpu.intValue() + ""); + } + } + } else if (YARN_NODEMANAGER_RESOURCE_MEMORY_MB.equals(item.getTextContent())) { + Node propertyNode = item.getParentNode(); + NodeList childNodes = propertyNode.getChildNodes(); + for (int j = 0; j < childNodes.getLength(); j++) { + Node item2 = childNodes.item(j); + if ("value".equals(item2.getNodeName())) { + item2.setTextContent(memory.intValue() + ""); + } + } } - return revisedConfig; - } + } - public double getAggregateMemory(NMProfile profile) { - double totalTaskMemory; - double executorMemory = getExecutorMemory(); - double nmJvmMaxMemoryMB = getNodeManagerMemory(); - double advertisableMemory = profile.getMemory(); - totalTaskMemory = executorMemory + nmJvmMaxMemoryMB + advertisableMemory; - return totalTaskMemory; + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + StringWriter writer = new StringWriter(); + transformer.transform(new DOMSource(doc), new StreamResult(writer)); + + revisedConfig = writer.getBuffer().toString().replaceAll("\n|\r", ""); + } catch (TransformerConfigurationException e) { + e.printStackTrace(); + } catch (TransformerException | SAXException | XPathExpressionException | ParserConfigurationException e) { + LOGGER.error("Error with xml operation", e); + } catch (IOException e) { + LOGGER.error("Error with xml operation", e); } + return revisedConfig; + } - public double getAggregateCpus(NMProfile profile) { - return getNodeManagerCpus() + MyriadExecutorDefaults.DEFAULT_CPUS + profile.getCpus(); - } + public double getAggregateMemory(NMProfile profile) { + double totalTaskMemory; + double executorMemory = getExecutorMemory(); + double nmJvmMaxMemoryMB = getNodeManagerMemory(); + double advertisableMemory = profile.getMemory(); + totalTaskMemory = executorMemory + nmJvmMaxMemoryMB + advertisableMemory; + return totalTaskMemory; + } - public double getNodeManagerMemory() { - NodeManagerConfiguration nmCfg = this.cfg.getNodeManagerConfiguration(); - return (nmCfg.getJvmMaxMemoryMB().isPresent() ? nmCfg - .getJvmMaxMemoryMB().get() - : NodeManagerConfiguration.DEFAULT_JVM_MAX_MEMORY_MB) - * (1 + NodeManagerConfiguration.JVM_OVERHEAD); - } + public double getAggregateCpus(NMProfile profile) { + return getNodeManagerCpus() + MyriadExecutorDefaults.DEFAULT_CPUS + profile.getCpus(); + } - public double getNodeManagerCpus() { - Optional<Double> cpus = - this.cfg.getNodeManagerConfiguration().getCpus(); - return cpus.isPresent() ? cpus.get() - : NodeManagerConfiguration.DEFAULT_NM_CPUS; - } + public double getNodeManagerMemory() { + NodeManagerConfiguration nmCfg = this.cfg.getNodeManagerConfiguration(); + return (nmCfg.getJvmMaxMemoryMB().isPresent() ? nmCfg.getJvmMaxMemoryMB().get() : NodeManagerConfiguration.DEFAULT_JVM_MAX_MEMORY_MB) * (1 + NodeManagerConfiguration.JVM_OVERHEAD); + } - public double getExecutorCpus() { + public double getNodeManagerCpus() { + Optional<Double> cpus = this.cfg.getNodeManagerConfiguration().getCpus(); + return cpus.isPresent() ? cpus.get() : NodeManagerConfiguration.DEFAULT_NM_CPUS; + } - return MyriadExecutorDefaults.DEFAULT_CPUS; - } + public double getExecutorCpus() { - public double getExecutorMemory() { - MyriadExecutorConfiguration executorCfg = this.cfg - .getMyriadExecutorConfiguration(); - return (executorCfg.getJvmMaxMemoryMB().isPresent() ? executorCfg - .getJvmMaxMemoryMB().get() - : MyriadExecutorDefaults.DEFAULT_JVM_MAX_MEMORY_MB) - * (1 + MyriadExecutorDefaults.JVM_OVERHEAD); - } + return MyriadExecutorDefaults.DEFAULT_CPUS; + } - public double getTaskCpus(NMProfile profile) { + public double getExecutorMemory() { + MyriadExecutorConfiguration executorCfg = this.cfg.getMyriadExecutorConfiguration(); + return (executorCfg.getJvmMaxMemoryMB().isPresent() ? executorCfg.getJvmMaxMemoryMB().get() : MyriadExecutorDefaults.DEFAULT_JVM_MAX_MEMORY_MB) * (1 + MyriadExecutorDefaults.JVM_OVERHEAD); + } - return getAggregateCpus(profile) - getExecutorCpus(); - } + public double getTaskCpus(NMProfile profile) { - public double getTaskMemory(NMProfile profile) { + return getAggregateCpus(profile) - getExecutorCpus(); + } - return getAggregateMemory(profile) - getExecutorMemory(); - } + public double getTaskMemory(NMProfile profile) { - public double getAuxTaskCpus(NMProfile profile, String taskName) throws MyriadBadConfigurationException { - if (taskName.startsWith(NodeManagerConfiguration.NM_TASK_PREFIX)) { - return getAggregateCpus(profile); - } - ServiceConfiguration auxConf = cfg.getServiceConfiguration(taskName); - if (auxConf == null) { - throw new MyriadBadConfigurationException("Can not find profile for task name: " + taskName); - } - if (!auxConf.getCpus().isPresent()) { - throw new MyriadBadConfigurationException("cpu is not defined for task with name: " + taskName); - } - return auxConf.getCpus().get(); + return getAggregateMemory(profile) - getExecutorMemory(); + } + + public double getAuxTaskCpus(NMProfile profile, String taskName) throws MyriadBadConfigurationException { + if (taskName.startsWith(NodeManagerConfiguration.NM_TASK_PREFIX)) { + return getAggregateCpus(profile); } - - public double getAuxTaskMemory(NMProfile profile, String taskName) throws MyriadBadConfigurationException { - if (taskName.startsWith(NodeManagerConfiguration.NM_TASK_PREFIX)) { - return getAggregateMemory(profile); - } - ServiceConfiguration auxConf = cfg.getServiceConfiguration(taskName); - if (auxConf == null) { - throw new MyriadBadConfigurationException("Can not find profile for task name: " + taskName); - } - if (!auxConf.getJvmMaxMemoryMB().isPresent()) { - throw new MyriadBadConfigurationException("memory is not defined for task with name: " + taskName); - } - return auxConf.getJvmMaxMemoryMB().get(); + ServiceConfiguration auxConf = cfg.getServiceConfiguration(taskName); + if (auxConf == null) { + throw new MyriadBadConfigurationException("Can not find profile for task name: " + taskName); + } + if (!auxConf.getCpus().isPresent()) { + throw new MyriadBadConfigurationException("cpu is not defined for task with name: " + taskName); + } + return auxConf.getCpus().get(); + } + public double getAuxTaskMemory(NMProfile profile, String taskName) throws MyriadBadConfigurationException { + if (taskName.startsWith(NodeManagerConfiguration.NM_TASK_PREFIX)) { + return getAggregateMemory(profile); } + ServiceConfiguration auxConf = cfg.getServiceConfiguration(taskName); + if (auxConf == null) { + throw new MyriadBadConfigurationException("Can not find profile for task name: " + taskName); + } + if (!auxConf.getJvmMaxMemoryMB().isPresent()) { + throw new MyriadBadConfigurationException("memory is not defined for task with name: " + taskName); + } + return auxConf.getJvmMaxMemoryMB().get(); + + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/Constraint.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/Constraint.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/Constraint.java index db5cb9e..e880abf 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/Constraint.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/Constraint.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 http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/ConstraintFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/ConstraintFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/ConstraintFactory.java index a9c6ae5..04ed73c 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/ConstraintFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/ConstraintFactory.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 http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/LikeConstraint.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/LikeConstraint.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/LikeConstraint.java index 453dd9b..f5ef9b9 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/LikeConstraint.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/LikeConstraint.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 @@ -62,8 +62,7 @@ public class LikeConstraint implements Constraint { return this.pattern.matcher(String.valueOf(attr.getScalar().getValue())).matches(); default: - LOGGER.warn("LIKE constraint currently doesn't support Mesos slave attributes " + - "of type {}. Attribute Name: {}", attr.getType(), attr.getName()); + LOGGER.warn("LIKE constraint currently doesn't support Mesos slave attributes " + "of type {}. Attribute Name: {}", attr.getType(), attr.getName()); return false; } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEvent.java index b2fc762..4df5b10 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEvent.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEvent.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,14 +24,14 @@ import org.apache.mesos.SchedulerDriver; * Event to disconnect from mesos */ public class DisconnectedEvent { - private SchedulerDriver driver; + private SchedulerDriver driver; - public SchedulerDriver getDriver() { - return driver; - } + public SchedulerDriver getDriver() { + return driver; + } - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } + public void setDriver(SchedulerDriver driver) { + this.driver = driver; + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEventFactory.java index 733948a..394bf45 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEventFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEventFactory.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 @@ -25,9 +25,9 @@ import com.lmax.disruptor.EventFactory; */ public class DisconnectedEventFactory implements EventFactory<DisconnectedEvent> { - @Override - public DisconnectedEvent newInstance() { - return new DisconnectedEvent(); - } + @Override + public DisconnectedEvent newInstance() { + return new DisconnectedEvent(); + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEvent.java index 9e7a333..390aabd 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEvent.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEvent.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,23 +24,23 @@ import org.apache.mesos.SchedulerDriver; * Error event in the system */ public class ErrorEvent { - private SchedulerDriver driver; - private String message; + private SchedulerDriver driver; + private String message; - public SchedulerDriver getDriver() { - return driver; - } + public SchedulerDriver getDriver() { + return driver; + } - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } + public void setDriver(SchedulerDriver driver) { + this.driver = driver; + } - public String getMessage() { - return message; - } + public String getMessage() { + return message; + } - public void setMessage(String message) { - this.message = message; - } + public void setMessage(String message) { + this.message = message; + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEventFactory.java index 230d3b6..65af0a1 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEventFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEventFactory.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 @@ -25,9 +25,9 @@ import com.lmax.disruptor.EventFactory; */ public class ErrorEventFactory implements EventFactory<ErrorEvent> { - @Override - public ErrorEvent newInstance() { - return new ErrorEvent(); - } + @Override + public ErrorEvent newInstance() { + return new ErrorEvent(); + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEvent.java index 90f94c9..469c21e 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEvent.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEvent.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 @@ -25,41 +25,41 @@ import org.apache.mesos.SchedulerDriver; * executor lost event */ public class ExecutorLostEvent { - private SchedulerDriver driver; - private Protos.ExecutorID executorId; - private Protos.SlaveID slaveId; - private int exitStatus; + private SchedulerDriver driver; + private Protos.ExecutorID executorId; + private Protos.SlaveID slaveId; + private int exitStatus; - public SchedulerDriver getDriver() { - return driver; - } + public SchedulerDriver getDriver() { + return driver; + } - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } + public void setDriver(SchedulerDriver driver) { + this.driver = driver; + } - public Protos.ExecutorID getExecutorId() { - return executorId; - } + public Protos.ExecutorID getExecutorId() { + return executorId; + } - public void setExecutorId(Protos.ExecutorID executorId) { - this.executorId = executorId; - } + public void setExecutorId(Protos.ExecutorID executorId) { + this.executorId = executorId; + } - public Protos.SlaveID getSlaveId() { - return slaveId; - } + public Protos.SlaveID getSlaveId() { + return slaveId; + } - public void setSlaveId(Protos.SlaveID slaveId) { - this.slaveId = slaveId; - } + public void setSlaveId(Protos.SlaveID slaveId) { + this.slaveId = slaveId; + } - public int getExitStatus() { - return exitStatus; - } + public int getExitStatus() { + return exitStatus; + } - public void setExitStatus(int exitStatus) { - this.exitStatus = exitStatus; - } + public void setExitStatus(int exitStatus) { + this.exitStatus = exitStatus; + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEventFactory.java index 66f4ee5..74dd9e1 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEventFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEventFactory.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 @@ -23,12 +23,11 @@ import com.lmax.disruptor.EventFactory; /** * executor lost event factory */ -public class ExecutorLostEventFactory implements - EventFactory<ExecutorLostEvent> { +public class ExecutorLostEventFactory implements EventFactory<ExecutorLostEvent> { - @Override - public ExecutorLostEvent newInstance() { - return new ExecutorLostEvent(); - } + @Override + public ExecutorLostEvent newInstance() { + return new ExecutorLostEvent(); + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEvent.java index f1b7ed0..ac73d98 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEvent.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEvent.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 @@ -25,41 +25,41 @@ import org.apache.mesos.SchedulerDriver; * framework message event */ public class FrameworkMessageEvent { - private SchedulerDriver driver; - private Protos.ExecutorID executorId; - private Protos.SlaveID slaveId; - private byte[] bytes; + private SchedulerDriver driver; + private Protos.ExecutorID executorId; + private Protos.SlaveID slaveId; + private byte[] bytes; - public SchedulerDriver getDriver() { - return driver; - } + public SchedulerDriver getDriver() { + return driver; + } - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } + public void setDriver(SchedulerDriver driver) { + this.driver = driver; + } - public Protos.ExecutorID getExecutorId() { - return executorId; - } + public Protos.ExecutorID getExecutorId() { + return executorId; + } - public void setExecutorId(Protos.ExecutorID executorId) { - this.executorId = executorId; - } + public void setExecutorId(Protos.ExecutorID executorId) { + this.executorId = executorId; + } - public Protos.SlaveID getSlaveId() { - return slaveId; - } + public Protos.SlaveID getSlaveId() { + return slaveId; + } - public void setSlaveId(Protos.SlaveID slaveId) { - this.slaveId = slaveId; - } + public void setSlaveId(Protos.SlaveID slaveId) { + this.slaveId = slaveId; + } - public byte[] getBytes() { - return bytes; - } + public byte[] getBytes() { + return bytes; + } - public void setBytes(byte[] bytes) { - this.bytes = bytes; - } + public void setBytes(byte[] bytes) { + this.bytes = bytes; + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEventFactory.java index 78658fc..7dacd2d 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEventFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEventFactory.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 @@ -23,12 +23,11 @@ import com.lmax.disruptor.EventFactory; /** * framework message event factory */ -public class FrameworkMessageEventFactory implements - EventFactory<FrameworkMessageEvent> { +public class FrameworkMessageEventFactory implements EventFactory<FrameworkMessageEvent> { - @Override - public FrameworkMessageEvent newInstance() { - return new FrameworkMessageEvent(); - } + @Override + public FrameworkMessageEvent newInstance() { + return new FrameworkMessageEvent(); + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEvent.java index 5637587..cdc30c3 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEvent.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEvent.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 @@ -22,26 +22,26 @@ import org.apache.mesos.Protos; import org.apache.mesos.SchedulerDriver; /** - * offer rescinded event + * offer rescinded event */ public class OfferRescindedEvent { - private SchedulerDriver driver; - private Protos.OfferID offerId; + private SchedulerDriver driver; + private Protos.OfferID offerId; - public SchedulerDriver getDriver() { - return driver; - } + public SchedulerDriver getDriver() { + return driver; + } - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } + public void setDriver(SchedulerDriver driver) { + this.driver = driver; + } - public Protos.OfferID getOfferId() { - return offerId; - } + public Protos.OfferID getOfferId() { + return offerId; + } - public void setOfferId(Protos.OfferID offerId) { - this.offerId = offerId; - } + public void setOfferId(Protos.OfferID offerId) { + this.offerId = offerId; + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEventFactory.java index bfba0ad..96a0f0d 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEventFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEventFactory.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 @@ -23,11 +23,10 @@ import com.lmax.disruptor.EventFactory; /** * offer rescinded event factory */ -public class OfferRescindedEventFactory implements - EventFactory<OfferRescindedEvent> { +public class OfferRescindedEventFactory implements EventFactory<OfferRescindedEvent> { - @Override - public OfferRescindedEvent newInstance() { - return new OfferRescindedEvent(); - } + @Override + public OfferRescindedEvent newInstance() { + return new OfferRescindedEvent(); + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEvent.java index f160743..b8f66ac 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEvent.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEvent.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 @@ -25,22 +25,22 @@ import org.apache.mesos.SchedulerDriver; * Mesos re-register event */ public class ReRegisteredEvent { - private SchedulerDriver driver; - private Protos.MasterInfo masterInfo; + private SchedulerDriver driver; + private Protos.MasterInfo masterInfo; - public SchedulerDriver getDriver() { - return driver; - } + public SchedulerDriver getDriver() { + return driver; + } - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } + public void setDriver(SchedulerDriver driver) { + this.driver = driver; + } - public Protos.MasterInfo getMasterInfo() { - return masterInfo; - } + public Protos.MasterInfo getMasterInfo() { + return masterInfo; + } - public void setMasterInfo(Protos.MasterInfo masterInfo) { - this.masterInfo = masterInfo; - } + public void setMasterInfo(Protos.MasterInfo masterInfo) { + this.masterInfo = masterInfo; + } } http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/67ecf063/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEventFactory.java index 2a6d62a..6addd67 100644 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEventFactory.java +++ b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEventFactory.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 @@ -23,11 +23,10 @@ import com.lmax.disruptor.EventFactory; /** * Mesos re-register event factory */ -public class ReRegisteredEventFactory implements - EventFactory<ReRegisteredEvent> { +public class ReRegisteredEventFactory implements EventFactory<ReRegisteredEvent> { - @Override - public ReRegisteredEvent newInstance() { - return new ReRegisteredEvent(); - } + @Override + public ReRegisteredEvent newInstance() { + return new ReRegisteredEvent(); + } }