Skip to content

[SPARK-20085] [MESOS] Configurable mesos labels for executors#17413

Closed
kalvinnchau wants to merge 3 commits intoapache:masterfrom
kalvinnchau:mesos-labels
Closed

[SPARK-20085] [MESOS] Configurable mesos labels for executors#17413
kalvinnchau wants to merge 3 commits intoapache:masterfrom
kalvinnchau:mesos-labels

Conversation

@kalvinnchau
Copy link
Copy Markdown

What changes were proposed in this pull request?

Add spark.mesos.task.labels configuration option to add mesos key:value labels to the executor.

"k1:v1,k2:v2" as the format, colons separating key-value and commas to list out more than one.

Discussion of labels with @mgummelt at #17404

How was this patch tested?

Added unit tests to verify labels were added correctly, with incorrect labels being ignored and added a test to test the name of the executor.

Tested with: ./build/sbt -Pmesos mesos/test

Please review http://spark.apache.org/contributing.html before opening a pull request.

@SparkQA
Copy link
Copy Markdown

SparkQA commented Mar 25, 2017

Test build #3610 has finished for PR 17413 at commit c57afed.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kalvinnchau
Copy link
Copy Markdown
Author

@mgummelt bumping this, can we get this looked at please?

Comment thread docs/running-on-mesos.md
<tr>
<td><code>spark.mesos.task.labels</code></td>
<td>(none)</td>
<td>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalize Mesos.


val labelsBuilder = taskBuilder.getLabelsBuilder

taskLabels.split(",").foreach(label => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a separate method for this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@mgummelt
Copy link
Copy Markdown

mgummelt commented Apr 5, 2017

LGTM.

@srowen Can we please get a merge? Thanks.

Copy link
Copy Markdown
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK, just some minor suggestions on the code itself

}

private def buildMesosLabels() : List[Label] = {
taskLabels.split(",").flatMap(label => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the braces are redundant here? or else use .flatMap { label => syntax

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the redundant braces here

tasks.toMap
}

private def buildMesosLabels() : List[Label] = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the space
The flatMap returns an Array, which doesn't work the with ScalaConverters, and the addAlllabels didn't take that Array.


private val maxGpus = conf.getInt("spark.mesos.gpus.max", 0)

private val taskLabels = conf.get("spark.mesos.task.labels", "").toString
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is toString redundant here or I miss something?

Copy link
Copy Markdown
Author

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

@SparkQA
Copy link
Copy Markdown

SparkQA commented Apr 6, 2017

Test build #3641 has finished for PR 17413 at commit e24b93a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Copy Markdown
Member

srowen commented Apr 6, 2017

Merged to master

@asfgit asfgit closed this in c8fc1f3 Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants