-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-21694][MESOS] Support Mesos CNI network labels #18910
Changes from 3 commits
255e519
d261593
dc09312
38e3b4d
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ import org.apache.mesos.Protos.{ContainerInfo, Image, NetworkInfo, Parameter, Vo | |
import org.apache.mesos.Protos.ContainerInfo.{DockerInfo, MesosInfo} | ||
|
||
import org.apache.spark.{SparkConf, SparkException} | ||
import org.apache.spark.deploy.mesos.config.{NETWORK_LABELS, NETWORK_NAME} | ||
import org.apache.spark.internal.Logging | ||
|
||
/** | ||
|
@@ -161,8 +162,12 @@ private[mesos] object MesosSchedulerBackendUtil extends Logging { | |
volumes.foreach(_.foreach(containerInfo.addVolumes(_))) | ||
} | ||
|
||
conf.getOption("spark.mesos.network.name").map { name => | ||
val info = NetworkInfo.newBuilder().setName(name).build() | ||
conf.get(NETWORK_NAME).map { name => | ||
val networkLabels = MesosProtoUtils.mesosLabels(conf.get(NETWORK_LABELS).getOrElse("")) | ||
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. Not part of this PR but...shouldn't 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. +1 for making the |
||
val info = NetworkInfo.newBuilder() | ||
.setName(name) | ||
.setLabels(networkLabels) | ||
.build() | ||
containerInfo.addNetworkInfos(info) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -568,9 +568,10 @@ class MesosCoarseGrainedSchedulerBackendSuite extends SparkFunSuite | |
assert(launchedTasks.head.getLabels.equals(taskLabels)) | ||
} | ||
|
||
test("mesos supports spark.mesos.network.name") { | ||
test("mesos supports spark.mesos.network.name and spark.mesos.network.labels") { | ||
setBackend(Map( | ||
"spark.mesos.network.name" -> "test-network-name" | ||
"spark.mesos.network.name" -> "test-network-name", | ||
"spark.mesos.network.labels" -> "key1:val1,key2:val2" | ||
)) | ||
|
||
val (mem, cpu) = (backend.executorMemory(sc), 4) | ||
|
@@ -582,6 +583,10 @@ class MesosCoarseGrainedSchedulerBackendSuite extends SparkFunSuite | |
val networkInfos = launchedTasks.head.getContainer.getNetworkInfosList | ||
assert(networkInfos.size == 1) | ||
assert(networkInfos.get(0).getName == "test-network-name") | ||
assert(networkInfos.get(0).getLabels.getLabels(0).getKey == "key1") | ||
assert(networkInfos.get(0).getLabels.getLabels(0).getValue == "val1") | ||
assert(networkInfos.get(0).getLabels.getLabels(1).getKey == "key2") | ||
assert(networkInfos.get(0).getLabels.getLabels(1).getValue == "val2") | ||
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. Is there a way to test that the driver's worker tasks also get the labels? It's important that all of the 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. @ArtRand I believe this is testing the worker tasks: (L.572) the |
||
} | ||
|
||
test("supports spark.scheduler.minRegisteredResourcesRatio") { | ||
|
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.
Tiny nit, could you remove the space after
private
? that would make it consistent with the rest of the code.I trust your judgment as to whether this is the right functional change for Mesos and the details and style look OK to me otherwise.