-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[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 1 commit
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") | ||
| // dispactcher constraints | ||
| 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 | ||
|
|
@@ -518,6 +520,20 @@ private[spark] class MesosClusterScheduler( | |
| val tasks = new mutable.HashMap[OfferID, ArrayBuffer[TaskInfo]]() | ||
| val currentTime = new Date() | ||
|
|
||
| stateLock.synchronized { | ||
| var 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. |
||
| } | ||
| } | ||
| } | ||
|
|
||
| stateLock.synchronized { | ||
| // We first schedule all the supervised drivers that are ready to retry. | ||
| // This list will be empty if none of the drivers are marked as supervise. | ||
|
|
||
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.
There's a typo there. I think the comment isn't necessary though, the name of the variable is clear enough.