Skip to content
This repository was archived by the owner on Nov 10, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
before_install:
- sudo add-apt-repository -y ppa:ubuntu-cloud-archive/icehouse-staging

install: bin/build
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<version>${elasticsearch.version}-${mesos.version}-${elasticsearch-mesos.version}</version>

<properties>
<mesos-utils.version>0.19.0-1</mesos-utils.version>
<mesos-utils.version>0.20.1-1</mesos-utils.version>

<!-- Elasticsearch Mesos version. Looks like a build number from Maven's perspective-->
<elasticsearch-mesos.version>1</elasticsearch-mesos.version>

<!-- language & dependency versions -->
<java.abi>1.7</java.abi>
<scala.version>2.10.4</scala.version>
<elasticsearch.version>1.2.1</elasticsearch.version>
<mesos.version>0.19.0</mesos.version>
<elasticsearch.version>1.4.1</elasticsearch.version>
<mesos.version>0.20.1</mesos.version>
<logback.version>1.0.9</logback.version>

</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ElasticSearchScheduler(masterUrl: String,
confServerHostName: String,
confServerPort: Int,
resources: mutable.Map[String, Float],
numberOfHwNodes: Int)
numberOfHwNodes: Int,
requestedAttributes: mutable.Map[String, String])
extends Scheduler with Runnable with Logger {

val initialized = new CountDownLatch(1)
Expand Down Expand Up @@ -89,7 +90,7 @@ class ElasticSearchScheduler(masterUrl: String,
s"&& rm logging.yml " +
s"&& curl -sSfLO http://${confServerHostName}:${confServerPort}/logging.yml " +
s"&& cd .. " +
s"&& bin/elasticsearch -f")
s"&& bin/elasticsearch")



Expand Down Expand Up @@ -141,6 +142,22 @@ class ElasticSearchScheduler(masterUrl: String,
// Check if offer is reasonable
def isOfferGood(offer: Offer) = {

// First of all check if we have all the requested
// attributes in the offer.
// To do so we make sure the intersection of the
// offered and required attributes is actually
// equal to the required attributes themselves.
val offeredAttributes = offer.getAttributesList.asScala.toList.map {
k => (k.getName, k.getText.getValue)
}.toSet

val requiredAttrs = requestedAttributes.toSet
val hasAllAttributes = offeredAttributes.intersect(requiredAttrs) == requiredAttrs

debug("attributes offered: " + offeredAttributes)
debug("attributes required: " + requiredAttrs)


// Make a list of offered resources
val offeredRes = offer.getResourcesList.asScala.toList.map {
k => (k.getName, k.getScalar.getValue)
Expand Down Expand Up @@ -170,8 +187,8 @@ class ElasticSearchScheduler(masterUrl: String,
}.size

// don't start the same framework multiple times on the same host and
// make sure we got all resources we asked for
taskSet.forall(_.hostname != offer.getHostname) && offersTooSmall == 0
// make sure we got all resources and attributes we asked for
taskSet.forall(_.hostname != offer.getHostname) && offersTooSmall == 0 && hasAllAttributes
}

def reregistered(driver: SchedulerDriver, masterInfo: MasterInfo) {
Expand Down
9 changes: 8 additions & 1 deletion src/main/scala/mesosphere/elasticsearch/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ object Main extends App with Logger {
case (k, v) => k.replaceAllLiterally("resource.", "") -> v.toString.toFloat
}

val requestedAttributes = mesosConf.filter {
_._1.startsWith("attribute.")
}.map {
case (k, v) => k.replaceAllLiterally("attribute.", "") -> v.toString
}

//TODO load the ElasticSearch log-properties file
BasicConfigurator.configure()
getRootLogger.setLevel(Level.INFO)
Expand All @@ -55,7 +61,8 @@ object Main extends App with Logger {
confServerHostName,
confServerPort,
resources,
numberOfHwNodes)
numberOfHwNodes,
requestedAttributes)

val schedThred = new Thread(scheduler)
schedThred.start()
Expand Down