http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 5166ee4..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskFactory.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * 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.HashSet; -import java.util.Iterator; -import java.util.Objects; - -import javax.inject.Inject; - -import com.ebay.myriad.configuration.MyriadConfiguration; -import com.ebay.myriad.configuration.MyriadExecutorConfiguration; -import com.ebay.myriad.state.NodeTask; -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; - -import org.apache.mesos.Protos.CommandInfo; -import org.apache.mesos.Protos.CommandInfo.URI; -import org.apache.mesos.Protos.ExecutorID; -import org.apache.mesos.Protos.ExecutorInfo; -import org.apache.mesos.Protos.FrameworkID; -import org.apache.mesos.Protos.Offer; -import org.apache.mesos.Protos.Resource; -import org.apache.mesos.Protos.TaskInfo; -import org.apache.mesos.Protos.TaskID; -import org.apache.mesos.Protos.Value; -import org.apache.mesos.Protos.Value.Scalar; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Creates Tasks based on mesos offers - */ -public interface TaskFactory { - static final String YARN_RESOURCEMANAGER_HOSTNAME = "yarn.resourcemanager.hostname"; - static final String YARN_RESOURCEMANAGER_WEBAPP_ADDRESS = "yarn.resourcemanager.webapp.address"; - static final String YARN_RESOURCEMANAGER_WEBAPP_HTTPS_ADDRESS = "yarn.resourcemanager.webapp.https.address"; - 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); - - // 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); - - /** - * Creates TaskInfo objects to launch NMs as mesos tasks. - */ - class NMTaskFactoryImpl implements TaskFactory { - public static final String EXECUTOR_NAME = "myriad_task"; - public static final String EXECUTOR_PREFIX = "myriad_executor"; - public static final String YARN_NODEMANAGER_OPTS_KEY = "YARN_NODEMANAGER_OPTS"; - - private static final Logger LOGGER = LoggerFactory.getLogger(NMTaskFactoryImpl.class); - private MyriadConfiguration cfg; - private TaskUtils taskUtils; - private ExecutorCommandLineGenerator clGenerator; - private TaskConstraints constraints; - - @Inject - public NMTaskFactoryImpl(MyriadConfiguration cfg, TaskUtils taskUtils, ExecutorCommandLineGenerator clGenerator) { - this.cfg = cfg; - this.taskUtils = taskUtils; - this.clGenerator = clGenerator; - this.constraints = new NMTaskConstraints(); - } - - //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")) { - /* - 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 - ports are found so bounded by NMPorts.expectedNumPorts. - */ - Iterator<Value.Range> itr = resource.getRanges().getRangeList().iterator(); - while (itr.hasNext() && ports.size() < NMPorts.expectedNumPorts()) { - Value.Range range = itr.next(); - if (range.getBegin() <= range.getEnd()) { - long i = range.getBegin(); - while (i <= range.getEnd() && ports.size() < NMPorts.expectedNumPorts()) { - ports.add(i); - i++; - } - } - } - } - } - - Preconditions.checkState(ports.size() == NMPorts.expectedNumPorts(), "Not enough ports in offer"); - Long[] portArray = ports.toArray(new Long[ports.size()]); - return new NMPorts(portArray); - } - - @VisibleForTesting - CommandInfo getCommandInfo(ServiceResourceProfile profile, NMPorts ports) { - MyriadExecutorConfiguration myriadExecutorConfiguration = cfg.getMyriadExecutorConfiguration(); - CommandInfo.Builder commandInfo = CommandInfo.newBuilder(); - String cmd; - - 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!"); - } - String nodeManagerUri = myriadExecutorConfiguration.getNodeManagerUri().get(); - cmd = clGenerator.generateCommandLine(profile, ports); - - //get the nodemanagerURI - //We're going to extract ourselves, so setExtract is false - LOGGER.info("Getting Hadoop distribution from:" + nodeManagerUri); - URI nmUri = URI.newBuilder().setValue(nodeManagerUri).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(); - LOGGER.info("Slave will execute command:" + cmd); - commandInfo.addUris(nmUri).addUris(configUri).setValue("echo \"" + cmd + "\";" + cmd); - commandInfo.setUser(cfg.getFrameworkSuperUser().get()); - - } else { - cmd = clGenerator.generateCommandLine(profile, ports); - commandInfo.setValue("echo \"" + cmd + "\";" + cmd); - - if (cfg.getFrameworkUser().isPresent()) { - commandInfo.setUser(cfg.getFrameworkUser().get()); - } - } - return commandInfo.build(); - } - - @Override - 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"); - - NMPorts ports = getPorts(offer); - LOGGER.debug(ports.toString()); - - ServiceResourceProfile serviceProfile = nodeTask.getProfile(); - 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()); - - 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(); - } - } - - /** - * Implement NM Task Constraints - */ - public static class NMTaskConstraints implements TaskConstraints { - - @Override - public int portsCount() { - return NMPorts.expectedNumPorts(); - } - } -}
http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 587d3dc..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskTerminator.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * 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.scheduler.fgs.OfferLifecycleManager; -import com.ebay.myriad.state.NodeTask; -import com.ebay.myriad.state.SchedulerState; -import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; - -import java.util.Set; - -import javax.inject.Inject; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.mesos.Protos.Status; -import org.apache.mesos.Protos.TaskID; -import org.slf4j.Logger; -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 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; - } - - @Override - public void run() { - // clone a copy of the killable tasks - Set<TaskID> killableTasks = Sets.newHashSet(schedulerState.getKillableTasks()); - - 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; - } - - 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/101bcad3/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 deleted file mode 100644 index 7890d26..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/TaskUtils.java +++ /dev/null @@ -1,209 +0,0 @@ -/** - * 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.ServiceConfiguration; -import com.ebay.myriad.configuration.MyriadBadConfigurationException; -import com.ebay.myriad.configuration.MyriadConfiguration; -import com.ebay.myriad.configuration.MyriadExecutorConfiguration; -import com.ebay.myriad.configuration.NodeManagerConfiguration; -import com.ebay.myriad.executor.MyriadExecutorDefaults; -import com.google.common.base.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import javax.inject.Inject; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import java.io.IOException; -import java.io.InputStream; -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 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; - - @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() + ""); - } - } - } - } - - 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 getAggregateMemory(NMProfile profile) { - double totalTaskMemory; - double executorMemory = getExecutorMemory(); - double nmJvmMaxMemoryMB = getNodeManagerMemory(); - double advertisableMemory = profile.getMemory(); - totalTaskMemory = executorMemory + nmJvmMaxMemoryMB + advertisableMemory; - return totalTaskMemory; - } - - public double getAggregateCpus(NMProfile profile) { - return getNodeManagerCpus() + MyriadExecutorDefaults.DEFAULT_CPUS + profile.getCpus(); - } - - 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 getNodeManagerCpus() { - Optional<Double> cpus = this.cfg.getNodeManagerConfiguration().getCpus(); - return cpus.isPresent() ? cpus.get() : NodeManagerConfiguration.DEFAULT_NM_CPUS; - } - - public double getExecutorCpus() { - - return MyriadExecutorDefaults.DEFAULT_CPUS; - } - - 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); - } - - public double getTaskCpus(NMProfile profile) { - - return getAggregateCpus(profile) - getExecutorCpus(); - } - - public double getTaskMemory(NMProfile profile) { - - return getAggregateMemory(profile) - getExecutorMemory(); - } - - 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(); - } - - 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/101bcad3/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 deleted file mode 100644 index e880abf..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/Constraint.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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.constraints; - -/** - * Interface for Constraint. - */ -public interface Constraint { - /** - * Type of Constraint - */ - enum Type { - NULL, // to help with serialization - LIKE - } - - public Type getType(); - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 04ed73c..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/ConstraintFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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.constraints; - -/** - * Factory to create constraints. - */ -public class ConstraintFactory { - - public static Constraint createConstraint(String constraintStr) { - if (constraintStr != null) { - String[] splits = constraintStr.split(" LIKE "); - if (splits.length == 2) { - return new LikeConstraint(splits[0], splits[1]); - } - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index f5ef9b9..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/constraints/LikeConstraint.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * 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.constraints; - -import com.google.gson.Gson; -import java.util.Collection; -import java.util.regex.Pattern; -import org.apache.mesos.Protos.Attribute; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Constraint for LIKE operator. - * Format: <mesos_slave_attribute|hostname> LIKE <regex_value> - */ -public class LikeConstraint implements Constraint { - private static final Logger LOGGER = LoggerFactory.getLogger(LikeConstraint.class); - - private static final String HOSTNAME = "hostname"; - - private final String lhs; - private final Pattern pattern; - - public LikeConstraint(String lhs, String rhsRegex) { - this.lhs = lhs; - this.pattern = Pattern.compile(rhsRegex); - } - - public boolean isConstraintOnHostName() { - return lhs.equalsIgnoreCase(HOSTNAME); - } - - public boolean matchesHostName(String hostname) { - return lhs.equalsIgnoreCase(HOSTNAME) && hostname != null && pattern.matcher(hostname).matches(); - } - - public boolean matchesSlaveAttributes(Collection<Attribute> attributes) { - if (!lhs.equalsIgnoreCase(HOSTNAME) && attributes != null) { - for (Attribute attr : attributes) { - if (attr.getName().equalsIgnoreCase(lhs)) { - switch (attr.getType()) { - case TEXT: - return this.pattern.matcher(attr.getText().getValue()).matches(); - - case SCALAR: - 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()); - return false; - - } - } - } - } - return false; - } - - @Override - public Type getType() { - return Type.LIKE; - } - - @Override - public String toString() { - Gson gson = new Gson(); - return gson.toJson(this); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof LikeConstraint)) { - return false; - } - - LikeConstraint that = (LikeConstraint) o; - - if (lhs != null ? !lhs.equals(that.lhs) : that.lhs != null) { - return false; - } - if (pattern != null ? !pattern.pattern().equals(that.pattern.pattern()) : that.pattern != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = lhs != null ? lhs.hashCode() : 0; - result = 31 * result + (pattern != null ? pattern.pattern().hashCode() : 0); - return result; - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 4df5b10..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.SchedulerDriver; - -/** - * Event to disconnect from mesos - */ -public class DisconnectedEvent { - private SchedulerDriver driver; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 394bf45..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/DisconnectedEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * Factory for creating the disconnect event - */ -public class DisconnectedEventFactory implements EventFactory<DisconnectedEvent> { - - @Override - public DisconnectedEvent newInstance() { - return new DisconnectedEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 390aabd..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.SchedulerDriver; - -/** - * Error event in the system - */ -public class ErrorEvent { - private SchedulerDriver driver; - private String message; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 65af0a1..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ErrorEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * Factory for error events - */ -public class ErrorEventFactory implements EventFactory<ErrorEvent> { - - @Override - public ErrorEvent newInstance() { - return new ErrorEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 469c21e..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -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; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.ExecutorID getExecutorId() { - return executorId; - } - - public void setExecutorId(Protos.ExecutorID executorId) { - this.executorId = executorId; - } - - public Protos.SlaveID getSlaveId() { - return slaveId; - } - - public void setSlaveId(Protos.SlaveID slaveId) { - this.slaveId = slaveId; - } - - public int getExitStatus() { - return exitStatus; - } - - public void setExitStatus(int exitStatus) { - this.exitStatus = exitStatus; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 74dd9e1..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ExecutorLostEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * executor lost event factory - */ -public class ExecutorLostEventFactory implements EventFactory<ExecutorLostEvent> { - - @Override - public ExecutorLostEvent newInstance() { - return new ExecutorLostEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index ac73d98..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -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; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.ExecutorID getExecutorId() { - return executorId; - } - - public void setExecutorId(Protos.ExecutorID executorId) { - this.executorId = executorId; - } - - public Protos.SlaveID getSlaveId() { - return slaveId; - } - - public void setSlaveId(Protos.SlaveID slaveId) { - this.slaveId = slaveId; - } - - public byte[] getBytes() { - return bytes; - } - - public void setBytes(byte[] bytes) { - this.bytes = bytes; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 7dacd2d..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/FrameworkMessageEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * framework message event factory - */ -public class FrameworkMessageEventFactory implements EventFactory<FrameworkMessageEvent> { - - @Override - public FrameworkMessageEvent newInstance() { - return new FrameworkMessageEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index cdc30c3..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -import org.apache.mesos.SchedulerDriver; - -/** - * offer rescinded event - */ -public class OfferRescindedEvent { - private SchedulerDriver driver; - private Protos.OfferID offerId; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.OfferID getOfferId() { - return offerId; - } - - public void setOfferId(Protos.OfferID offerId) { - this.offerId = offerId; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 96a0f0d..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/OfferRescindedEventFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * offer rescinded event factory - */ -public class OfferRescindedEventFactory implements EventFactory<OfferRescindedEvent> { - - @Override - public OfferRescindedEvent newInstance() { - return new OfferRescindedEvent(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index b8f66ac..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -import org.apache.mesos.SchedulerDriver; - -/** - * Mesos re-register event - */ -public class ReRegisteredEvent { - private SchedulerDriver driver; - private Protos.MasterInfo masterInfo; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.MasterInfo getMasterInfo() { - return masterInfo; - } - - public void setMasterInfo(Protos.MasterInfo masterInfo) { - this.masterInfo = masterInfo; - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/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 deleted file mode 100644 index 6addd67..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ReRegisteredEventFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * Mesos re-register event factory - */ -public class ReRegisteredEventFactory implements EventFactory<ReRegisteredEvent> { - - @Override - public ReRegisteredEvent newInstance() { - return new ReRegisteredEvent(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEvent.java deleted file mode 100644 index a7778dc..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -import org.apache.mesos.SchedulerDriver; - -/** - * mesos register event - */ -public class RegisteredEvent { - private SchedulerDriver driver; - private Protos.FrameworkID frameworkId; - private Protos.MasterInfo masterInfo; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.FrameworkID getFrameworkId() { - return frameworkId; - } - - public void setFrameworkId(Protos.FrameworkID frameworkId) { - this.frameworkId = frameworkId; - } - - public Protos.MasterInfo getMasterInfo() { - return masterInfo; - } - - public void setMasterInfo(Protos.MasterInfo masterInfo) { - this.masterInfo = masterInfo; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEventFactory.java deleted file mode 100644 index 6fd5e05..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/RegisteredEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * mesos register event factory - */ -public class RegisteredEventFactory implements EventFactory<RegisteredEvent> { - - @Override - public RegisteredEvent newInstance() { - return new RegisteredEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEvent.java deleted file mode 100644 index bbe8764..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEvent.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -import org.apache.mesos.SchedulerDriver; - -import java.util.List; - -/** - * resource offer event - */ -public class ResourceOffersEvent { - private SchedulerDriver driver; - private List<Protos.Offer> offers; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public List<Protos.Offer> getOffers() { - return offers; - } - - public void setOffers(List<Protos.Offer> offers) { - this.offers = offers; - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEventFactory.java deleted file mode 100644 index ea259a2..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/ResourceOffersEventFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * resource offer event factory - */ -public class ResourceOffersEventFactory implements EventFactory<ResourceOffersEvent> { - - @Override - public ResourceOffersEvent newInstance() { - return new ResourceOffersEvent(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEvent.java deleted file mode 100644 index dce19e9..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -import org.apache.mesos.SchedulerDriver; - -/** - * mesos slave lost event - */ -public class SlaveLostEvent { - private SchedulerDriver driver; - private Protos.SlaveID slaveId; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.SlaveID getSlaveId() { - return slaveId; - } - - public void setSlaveId(Protos.SlaveID slaveId) { - this.slaveId = slaveId; - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEventFactory.java deleted file mode 100644 index fa17341..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/SlaveLostEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * mesos slave lost event factory - */ -public class SlaveLostEventFactory implements EventFactory<SlaveLostEvent> { - - @Override - public SlaveLostEvent newInstance() { - return new SlaveLostEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEvent.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEvent.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEvent.java deleted file mode 100644 index bc6a790..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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.event; - -import org.apache.mesos.Protos; -import org.apache.mesos.SchedulerDriver; - -/** - * mesos status update event - */ -public class StatusUpdateEvent { - private SchedulerDriver driver; - private Protos.TaskStatus status; - - public SchedulerDriver getDriver() { - return driver; - } - - public void setDriver(SchedulerDriver driver) { - this.driver = driver; - } - - public Protos.TaskStatus getStatus() { - return status; - } - - public void setStatus(Protos.TaskStatus status) { - this.status = status; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEventFactory.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEventFactory.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEventFactory.java deleted file mode 100644 index 6540795..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/StatusUpdateEventFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.event; - -import com.lmax.disruptor.EventFactory; - -/** - * mesos status update event - */ -public class StatusUpdateEventFactory implements EventFactory<StatusUpdateEvent> { - - @Override - public StatusUpdateEvent newInstance() { - return new StatusUpdateEvent(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/DisconnectedEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/DisconnectedEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/DisconnectedEventHandler.java deleted file mode 100644 index 195532d..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/DisconnectedEventHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.event.DisconnectedEvent; -import com.lmax.disruptor.EventHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * handles and logs disconnected events - */ -public class DisconnectedEventHandler implements EventHandler<DisconnectedEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(DisconnectedEventHandler.class); - - @Override - public void onEvent(DisconnectedEvent event, long sequence, boolean endOfBatch) throws Exception { - LOGGER.info("Framework disconnected!"); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ErrorEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ErrorEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ErrorEventHandler.java deleted file mode 100644 index 14ef526..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ErrorEventHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.event.ErrorEvent; -import com.lmax.disruptor.EventHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * handles and logs error events - */ -public class ErrorEventHandler implements EventHandler<ErrorEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(ErrorEventHandler.class); - - @Override - public void onEvent(ErrorEvent event, long sequence, boolean endOfBatch) throws Exception { - String message = event.getMessage(); - LOGGER.error(message); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ExecutorLostEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ExecutorLostEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ExecutorLostEventHandler.java deleted file mode 100644 index 125a953..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ExecutorLostEventHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.event.ExecutorLostEvent; -import com.lmax.disruptor.EventHandler; -import org.apache.mesos.Protos.ExecutorID; -import org.apache.mesos.Protos.SlaveID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * handles and logs executor lost events - */ -public class ExecutorLostEventHandler implements EventHandler<ExecutorLostEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorLostEventHandler.class); - - @Override - public void onEvent(ExecutorLostEvent event, long sequence, boolean endOfBatch) throws Exception { - ExecutorID executorId = event.getExecutorId(); - SlaveID slaveId = event.getSlaveId(); - int exitStatus = event.getExitStatus(); - LOGGER.info("Executor {} of slave {} lost with exit status: {}", executorId, slaveId, exitStatus); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/FrameworkMessageEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/FrameworkMessageEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/FrameworkMessageEventHandler.java deleted file mode 100644 index 4ae2e1b..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/FrameworkMessageEventHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.event.FrameworkMessageEvent; -import com.lmax.disruptor.EventHandler; -import org.apache.mesos.Protos.ExecutorID; -import org.apache.mesos.Protos.SlaveID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * handles and logs mesos framework messages - */ -public class FrameworkMessageEventHandler implements EventHandler<FrameworkMessageEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(FrameworkMessageEventHandler.class); - - @Override - public void onEvent(FrameworkMessageEvent event, long sequence, boolean endOfBatch) throws Exception { - ExecutorID executorId = event.getExecutorId(); - SlaveID slaveId = event.getSlaveId(); - LOGGER.info("Received framework message from executor {} of slave {}", executorId, slaveId); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/OfferRescindedEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/OfferRescindedEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/OfferRescindedEventHandler.java deleted file mode 100644 index fc95a9c..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/OfferRescindedEventHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.event.OfferRescindedEvent; -import com.lmax.disruptor.EventHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * handles and logs offer rescinded events - */ -public class OfferRescindedEventHandler implements EventHandler<OfferRescindedEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(OfferRescindedEventHandler.class); - - @Override - public void onEvent(OfferRescindedEvent event, long sequence, boolean endOfBatch) throws Exception { - LOGGER.info("OfferRescinded event: {}", event); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ReRegisteredEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ReRegisteredEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ReRegisteredEventHandler.java deleted file mode 100644 index 34c3f7f..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/ReRegisteredEventHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.ReconcileService; -import com.ebay.myriad.scheduler.event.ReRegisteredEvent; -import com.ebay.myriad.state.SchedulerState; -import com.google.inject.Inject; -import com.lmax.disruptor.EventHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * handles and logs mesos re-register events - */ -public class ReRegisteredEventHandler implements EventHandler<ReRegisteredEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(ReRegisteredEventHandler.class); - - @Inject - private SchedulerState state; - - @Inject - private ReconcileService reconcileService; - - @Override - public void onEvent(ReRegisteredEvent event, long sequence, boolean endOfBatch) throws Exception { - LOGGER.info("Framework re-registered: {}", event); - reconcileService.reconcile(event.getDriver()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/101bcad3/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/RegisteredEventHandler.java ---------------------------------------------------------------------- diff --git a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/RegisteredEventHandler.java b/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/RegisteredEventHandler.java deleted file mode 100644 index 594d7d4..0000000 --- a/myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/event/handlers/RegisteredEventHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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.event.handlers; - -import com.ebay.myriad.scheduler.ReconcileService; -import com.ebay.myriad.scheduler.event.RegisteredEvent; -import com.ebay.myriad.state.SchedulerState; -import com.lmax.disruptor.EventHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; - -/** - * handles and logs mesos registered events - */ -public class RegisteredEventHandler implements EventHandler<RegisteredEvent> { - private static final Logger LOGGER = LoggerFactory.getLogger(RegisteredEventHandler.class); - - @Inject - private SchedulerState schedulerState; - - @Inject - private ReconcileService reconcileService; - - @Override - public void onEvent(RegisteredEvent event, long sequence, boolean endOfBatch) throws Exception { - LOGGER.info("Received event: {} with frameworkId: {}", event, event.getFrameworkId()); - schedulerState.setFrameworkId(event.getFrameworkId()); - reconcileService.reconcile(event.getDriver()); - } - -}