-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-12832][MESOS] Fix dispatcher does not have a constraints config #10768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,8 @@ private[spark] class MesosClusterScheduler( | |
| private val queuedDriversState = engineFactory.createEngine("driverQueue") | ||
| private val launchedDriversState = engineFactory.createEngine("launchedDrivers") | ||
| private val pendingRetryDriversState = engineFactory.createEngine("retryList") | ||
| private val driverOfferConstraints = | ||
| parseConstraintString(conf.get("spark.mesos.constraints", "")) | ||
| // Flag to mark if the scheduler is ready to be called, which is until the scheduler | ||
| // is registered with Mesos master. | ||
| @volatile protected var ready = false | ||
|
|
@@ -510,6 +512,22 @@ private[spark] class MesosClusterScheduler( | |
| } | ||
|
|
||
| override def resourceOffers(driver: SchedulerDriver, offers: JList[Offer]): Unit = { | ||
|
|
||
| // Filter by mesos constraints | ||
| stateLock.synchronized { | ||
| val it = offers.iterator() | ||
| while (it.hasNext) { | ||
| val offer = it.next() | ||
| val offerAttributes = toAttributeMap(offer.getAttributesList) | ||
| val meetsConstraints = matchesAttributeRequirements(driverOfferConstraints, offerAttributes) | ||
|
|
||
| if (!meetsConstraints) { | ||
| driver.declineOffer(offer.getId) | ||
| it.remove() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not mutate the underlying collection. Anyhow, this has no effect because the code below is using
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, it's true. I modify code base in 1.5.2 previously, and test ok in practice. in 1.6.0 version the code is change. I will revise it soon.thanks for your review. |
||
| } | ||
| } | ||
| } | ||
|
|
||
| val currentOffers = offers.asScala.map(o => | ||
| new ResourceOffer( | ||
| o, getResource(o.getResourcesList, "cpus"), getResource(o.getResourcesList, "mem")) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the problem: This setting is read only once, when the dispatcher is started. What you want is to pick up the constraints set on the submitted job. Have a look at how other job-specific settings are treated in the code (there's a submitProperties variable, or something similar).