Uh oh!
There was an error while loading. Please reload this page.
[SPARK-2894] spark-shell doesn't accept flags - #1825
Conversation
rxin
commented
Aug 7, 2014
Jenkins, add to whitelist. |
SparkQA
commented
Aug 7, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
sryza
commented
Aug 7, 2014
This will allow spark-shell to take spark-submit options, but will remove its ability to take spark-shell-specific options (currently there's only one, "file"). I'm unclear on the best way to support both of these. |
pwendell
commented
Aug 7, 2014
does the shell actually take flags? I didn't realize this when I OK'd #1801. If there are specific flags, we should trap them and pass them after |
andrewor14
commented
Aug 7, 2014
AFAIK I don't believe spark-shell takes in any application-specific arguments, at least not documented ones. @sryza What file are you referring to? |
sryza
commented
Aug 7, 2014
org.apache.spark.repl.SparkRunnerSettings |
andrewor14
commented
Aug 7, 2014
ah... looks like we need some special logic to filter that one out here |
SparkQA
commented
Aug 7, 2014
QA results for PR 1825: |
SparkQA
commented
Aug 7, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
SparkQA
commented
Aug 7, 2014
QA results for PR 1825: |
andrewor14
commented
Aug 7, 2014
It would be good to verify whether pyspark is affected too (see java_gateway.py) |
JoshRosen
commented
Aug 7, 2014
There seems to be a similar PySpark issue, too (I just ran into it during testing): |
There was a problem hiding this comment.
For consistency, could you use the same approach that we use in spark-sql script?
liancheng
commented
Aug 7, 2014
Maybe instead of filtering out all I'll try to write a utility script to filter out |
andrewor14
commented
Aug 8, 2014
@liancheng However that means every time we want to change a spark-submit config, we need to change it in multiple places, which might make things harder to maintain. For spark-shell, aren't we only expecting one type of argument? I'm not super familiar with this functionality of passing a settings file to spark-shell, but I don't think this file path matches |
liancheng
commented
Aug 8, 2014
@andrewor14 Ah OK, I only had a glance at @sarutak Thanks for help fixing this. I'd also suggest what @pwendell suggested, i.e. using a similar while/case structure in |
There was a problem hiding this comment.
We should move this call before the if statement to cover the Cygwin branch. And please use 4-space indentation here :)
liancheng
commented
Aug 8, 2014
@JoshRosen I'm checking |
JoshRosen
commented
Aug 8, 2014
@liancheng |
SparkQA
commented
Aug 8, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
SparkQA
commented
Aug 8, 2014
QA results for PR 1825: |
SparkQA
commented
Aug 8, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
SparkQA
commented
Aug 8, 2014
QA results for PR 1825: |
andrewor14
commented
Aug 8, 2014
This failed a flaky test. Retest this please |
SparkQA
commented
Aug 8, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
liancheng
commented
Aug 8, 2014
@JoshRosen Thanks, then I think gathering all |
SparkQA
commented
Aug 9, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
There was a problem hiding this comment.
The following case fails because this line doesn't handle quoted string with spaces properly:
./bin/pyspark app.py --master spark://lian-laptop.local:7077 --name "awesome name"
A possible fix is to replace this line with the trick bin/pyspark uses:
whitespace="[[:space:]]"
i=$1if [[ $1=~\" ]];then i=$(echo $1| sed 's/\"/\\\"/g');fiif [[ $1=~$whitespace ]];then i=\"$1\";fi
SUBMISSION_OPTS+=($i);shiftThere was a problem hiding this comment.
Thanks for pointing that. Newer PR is modified that.
I think the main reason is $1 is not double-quoted in utils.sh.
There was a problem hiding this comment.
Hmm, I'm afraid only adding double quotes doesn't help, the case I mentioned above still fails, and the pyspark trick can be helpful. And we only need to deal with the argument part of those options that need an argument.
There was a problem hiding this comment.
Actually double quotes should be sufficient here, since it preserves whitespaces by default. The only reason why we needed the special handling for pyspark is that we need to pass the string literal in as an environment variable, otherwise python won't know how to split our arguments. We don't need to do the same here because this is already split by bash.
liancheng
commented
Aug 9, 2014
Hey @sarutak, thanks for fixing this :) Did some tests locally and the only issue I found is the quoted string case I just commented. Otherwise LGTM. |
There was a problem hiding this comment.
We should add a note here that says something like All changes here must be reflected in SparkSubmitArguments.scala
There was a problem hiding this comment.
and add a similar comment in SparkSubmitArguments.scala too. It would be bad if these two go out of sync
andrewor14
commented
Aug 9, 2014
I have tested this locally and I was able to get both spark shell and pyspark working as before. I also tried it with quoted arguments and backslashes and the arguments are still propagated properly. I haven't tried the settings file for spark-shell, however. Pending a few comments this LGTM, and we should get this in quickly if possible. |
Added comments in utils.py and SparkSubmitArguments.scala to notice someone that both of the files should be modified simultaneously
SparkQA
commented
Aug 9, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
Added comments in utils.py and SparkSubmitArguments.scala to notice someone that both of the files should be modified simultaneously
SparkQA
commented
Aug 9, 2014
QA tests have started for PR 1825. This patch merges cleanly. |
andrewor14
commented
Aug 9, 2014
LGTM, thanks @sarutak and @liancheng. |
pwendell
commented
Aug 9, 2014
Okay cool - we can merge this once the tests pass. |
pwendell
commented
Aug 10, 2014
Tests passed so I'm going to merge it |
As sryza reported, spark-shell doesn't accept any flags. The root cause is wrong usage of spark-submit in spark-shell and it come to the surface by #1801 Author: Kousuke Saruta <sarutak@oss.nttdata.co.jp> Author: Cheng Lian <lian.cs.zju@gmail.com> Closes#1715, Closes#1864, and Closes#1861Closes#1825 from sarutak/SPARK-2894 and squashes the following commits: 47f3510 [Kousuke Saruta] Merge branch 'master' of git://git.apache.org/spark into SPARK-28942c899ed [Kousuke Saruta] Removed useless code from java_gateway.py 98287ed [Kousuke Saruta] Removed useless code from java_gateway.py 513ad2e [Kousuke Saruta] Modified util.sh to enable to use option including white spaces 28a374e [Kousuke Saruta] Modified java_gateway.py to recognize arguments 5afc584 [Cheng Lian] Filter out spark-submit options when starting Python gateway e630d19 [Cheng Lian] Fixing pyspark and spark-shell CLI options
JoshRosen
commented
Aug 15, 2014
Does this work with Python? I ask because doesn't seem to respect my ipython flags. Am I using this right? |
andrewor14
commented
Aug 15, 2014
You need to set them through |
JoshRosen
commented
Aug 15, 2014
Doh, I forgot about that. I tried a bunch of other Python configurations and in every case the behavior seems to match 1.0.2, which is great. Thanks! |
As sryza reported, spark-shell doesn't accept any flags. The root cause is wrong usage of spark-submit in spark-shell and it come to the surface by apache#1801 Author: Kousuke Saruta <sarutak@oss.nttdata.co.jp> Author: Cheng Lian <lian.cs.zju@gmail.com> Closesapache#1715, Closesapache#1864, and Closesapache#1861Closesapache#1825 from sarutak/SPARK-2894 and squashes the following commits: 47f3510 [Kousuke Saruta] Merge branch 'master' of git://git.apache.org/spark into SPARK-2894 2c899ed [Kousuke Saruta] Removed useless code from java_gateway.py 98287ed [Kousuke Saruta] Removed useless code from java_gateway.py 513ad2e [Kousuke Saruta] Modified util.sh to enable to use option including white spaces 28a374e [Kousuke Saruta] Modified java_gateway.py to recognize arguments 5afc584 [Cheng Lian] Filter out spark-submit options when starting Python gateway e630d19 [Cheng Lian] Fixing pyspark and spark-shell CLI options
As @sryza reported, spark-shell doesn't accept any flags.
The root cause is wrong usage of spark-submit in spark-shell and it come to the surface by #1801