-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19740][MESOS]Add support in Spark to pass arbitrary parameters into docker when running on mesos with docker containerizer #17109
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
Conversation
|
ok to test |
|
@yanji84 can you add a test for this? |
|
Test build #73645 has finished for PR 17109 at commit
|
|
@tnachen I will add test |
|
Test build #73937 has finished for PR 17109 at commit
|
|
Test build #73938 has finished for PR 17109 at commit
|
|
@tnachen test ready |
|
Test build #73942 has finished for PR 17109 at commit
|
|
Test build #73944 has finished for PR 17109 at commit
|
|
@tnachen does the PR look good? Thanks! |
|
Hey sorry for the late response, code looks good to me, however we need to add documentation about the new flag. Can you modify the Mesos configuration docs in the docs folder? |
|
Test build #74299 has finished for PR 17109 at commit
|
| <tr> | ||
| <td><code>spark.mesos.executor.docker.params</code></td> | ||
| <td>(none)</td> | ||
| <td> |
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.
s/mesos/Mesos
s/docker containerizer/the docker containerizer
docs/running-on-mesos.md
Outdated
| <td><code>spark.mesos.executor.docker.params</code></td> | ||
| <td>(none)</td> | ||
| <td> | ||
| Set the list of custom parameters which will be passed into the <code>docker run</code> command when launching the Spark executor on mesos using docker containerizer. The format of this property is a comma-separated list of |
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.
s/That is they take the form:/Example:
| By default Mesos agents will not pull images they already have cached. | ||
| </td> | ||
| </tr> | ||
| <tr> |
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.
s/params/parameters
to be consistent with the Mesos protobuf terminology
| * takes the form key=value | ||
| */ | ||
| def parseParamsSpec(params: String): List[Parameter] = { | ||
| params.split(",").map(_.split("=")).flatMap { kv: Array[String] => |
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.
s/kv/parameter for naming consistency
| * Parse a comma-delimited list of arbitrary parameters, each of which | ||
| * takes the form key=value | ||
| */ | ||
| def parseParamsSpec(params: String): List[Parameter] = { |
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.
private
| } | ||
|
|
||
| /** | ||
| * Parse a comma-delimited list of arbitrary parameters, each of which |
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.
"list of docker parameters"
|
|
||
| test("Parse arbitrary parameter to pass into docker containerizer") { | ||
| val parsed = MesosSchedulerBackendUtil.parseParamsSpec("a=1,b=2,c=3") | ||
| parsed(0).getKey shouldBe "a" |
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.
check out the other test suites. We use assert, not Matchers
| parsed(2).getKey shouldBe "c" | ||
| parsed(2).getValue shouldBe "3" | ||
|
|
||
| val invalid = MesosSchedulerBackendUtil.parseParamsSpec("a,b") |
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.
invalid entries should be in a separate test
| class MesosSchedulerBackendUtilSuite extends SparkFunSuite with Matchers with MockitoSugar { | ||
|
|
||
| test("Parse arbitrary parameter to pass into docker containerizer") { | ||
| val parsed = MesosSchedulerBackendUtil.parseParamsSpec("a=1,b=2,c=3") |
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 should be a private method, so let's not test it. Just test containerInfo
|
Test build #74392 has finished for PR 17109 at commit
|
|
@mgummelt comments addressed, please take another look |
| * takes the form key=value | ||
| */ | ||
| private def parseParamsSpec(params: String): List[Parameter] = { | ||
| params.split(",").map(_.split("=")).flatMap { spec: Array[String] => |
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.
s/spec/parameter, for consistency
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.
to be consistent with other methods, i think we should stick with spec.
def parsePortMappingsSpec(portmaps: String): List[DockerInfo.PortMapping] = {
portmaps.split(",").map(_.split(":")).flatMap { spec: Array[String] =>
val portmap: DockerInfo.PortMapping.Builder = DockerInfo.PortMapping
it seems to be better to reserve the name parameter later for builder
val param: Parameter.Builder = Parameter.newBuilder()
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.
ok
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.
I am not very familiar with docker parameters - but wont this method not fail if '=' exists in the value ?
Or is that prohibited by docker ?
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.
hmm if a value contains a '=' we will have a parsing error.
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.
= in values seems valid for env vars: moby/moby#12763
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.
I see, so we should split with a limit instead.
@yanji84 can you fix this?
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.
sorry missed out this comment earlier, Ii set limit to 2, pushed the new pull request
|
|
||
| import org.apache.spark.{SparkConf, SparkFunSuite} | ||
|
|
||
| class MesosSchedulerBackendUtilSuite extends SparkFunSuite with Matchers with MockitoSugar { |
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 Matchers used anymore?
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.
i'll check, if not, will remove it
|
Test build #74488 has finished for PR 17109 at commit
|
|
LGTM @srowen ready to merge |
|
hello, any update on this? |
|
@srowen is there anything else holding this up? why does it take so long? thanks |
|
@yanji84 I have no experience with Mesos and am not, in general, a reviewer for this code, and don't follow Mesos changes. That's why. I pitch in to help merge but would appreciate others stepping up to help. |
|
@srowen We do appreciate your help with Mesos commits, and generally find you responsive. I have a habit of pinging you for merges because you seemed to have stepped in once @andrewor14 stepped away. There are really only two active Spark contributers with knowledge of Mesos code, being myself and @skonto. We would obviously love it if one of us could be made a committer so we could more effectively maintain the Mesos module. It's something @rxin emailed me about previously, but there was some concern about my total code volume. I'll be upstreaming a sizable feature this week (Kerberos support on Mesos). Maybe that, along with my 1.5 year history of responsive code reviews and contributions, would push me over the edge? I'd be more than happy to take this maintenance burden away from you :) |
|
@srowen Appreciate the help you're doing, I think we're doing what we can to help review these patches and making sure Mesos support is still being maintained and improved over time. Long story short, if you can still help in the mean time will be greatly appreciated as we can still make sure improvements around Mesos integration can still happen |
|
Is this one still good to go? I see a late comment above. I can merge it, no problem. |
|
Test build #75828 has finished for PR 17109 at commit
|
|
Merged to master |
…s into docker when running on mesos with docker containerizer ## What changes were proposed in this pull request? Allow passing in arbitrary parameters into docker when launching spark executors on mesos with docker containerizer tnachen ## How was this patch tested? Manually built and tested with passed in parameter Author: Ji Yan <jiyan@Jis-MacBook-Air.local> Closes apache#17109 from yanji84/ji/allow_set_docker_user.
What changes were proposed in this pull request?
Allow passing in arbitrary parameters into docker when launching spark executors on mesos with docker containerizer @tnachen
How was this patch tested?
Manually built and tested with passed in parameter