-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-20085] [MESOS] Configurable mesos labels for executors #17413
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 2 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 |
|---|---|---|
|
|
@@ -67,6 +67,8 @@ private[spark] class MesosCoarseGrainedSchedulerBackend( | |
|
|
||
| private val maxGpus = conf.getInt("spark.mesos.gpus.max", 0) | ||
|
|
||
| private val taskLabels = conf.get("spark.mesos.task.labels", "").toString | ||
|
|
||
| private[this] val shutdownTimeoutMS = | ||
| conf.getTimeAsMs("spark.mesos.coarse.shutdownTimeout", "10s") | ||
| .ensuring(_ >= 0, "spark.mesos.coarse.shutdownTimeout must be >= 0") | ||
|
|
@@ -408,6 +410,13 @@ private[spark] class MesosCoarseGrainedSchedulerBackend( | |
| taskBuilder.addAllResources(resourcesToUse.asJava) | ||
| taskBuilder.setContainer(MesosSchedulerBackendUtil.containerInfo(sc.conf)) | ||
|
|
||
| val labelsBuilder = taskBuilder.getLabelsBuilder | ||
| val labels = buildMesosLabels().asJava | ||
|
|
||
| labelsBuilder.addAllLabels(labels) | ||
|
|
||
| taskBuilder.setLabels(labelsBuilder) | ||
|
|
||
| tasks(offer.getId) ::= taskBuilder.build() | ||
| remainingResources(offerId) = resourcesLeft.asJava | ||
| totalCoresAcquired += taskCPUs | ||
|
|
@@ -422,6 +431,21 @@ private[spark] class MesosCoarseGrainedSchedulerBackend( | |
| tasks.toMap | ||
| } | ||
|
|
||
| private def buildMesosLabels() : List[Label] = { | ||
|
Member
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. Nit: no space before colon I think in our code style. Does it need to be a List for ScalaConverters to convert to a Java List or would it work with whatever the flatMap returns already (Seq?) No big deal.
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. Removed the space |
||
| taskLabels.split(",").flatMap(label => { | ||
|
Member
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. Nit: the braces are redundant here? or else use
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. removed the redundant braces here |
||
| label.split(":") match { | ||
| case Array(key, value) => | ||
| Some(Label.newBuilder() | ||
| .setKey(key) | ||
| .setValue(value) | ||
| .build()) | ||
| case _ => | ||
| logWarning(s"Unable to parse $label into a key:value label for the task.") | ||
| None | ||
| } | ||
| }).toList | ||
| } | ||
|
|
||
| /** Extracts task needed resources from a list of available resources. */ | ||
| private def partitionTaskResources( | ||
| resources: JList[Resource], | ||
|
|
||
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.
Is
toStringredundant here or I miss something?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.
whoops, that is redundant, i'll drop that
toString