-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-2894][Core] Fixes spark-shell and pyspark CLI options #1864
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 all 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 |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| # Gather all all spark-submit options into SUBMISSION_OPTS | ||
| function gatherSparkSubmitOpts() { | ||
| SUBMISSION_OPTS=() | ||
| APPLICATION_OPTS=() | ||
|
Contributor
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.
Contributor
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. I also used |
||
| while (($#)); do | ||
| case $1 in | ||
| --master | --deploy-mode | --class | --name | --jars | --py-files | --files) | ||
| ;& | ||
|
|
||
| --conf | --properties-file | --driver-memory | --driver-java-options) | ||
| ;& | ||
|
|
||
| --driver-library-path | --driver-class-path | --executor-memory | --driver-cores) | ||
| ;& | ||
|
|
||
| --total-executor-cores | --executor-cores | --queue | --num-executors | --archives) | ||
|
Contributor
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. Any reason to spread this out over 4 cases? Why not just group them in 1? (You could use backslash to escape new line)
Contributor
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. Just to prevent too long a line. I tried escaping newline with backslash, at least it doesn't work in Bash 4.3.8 :(
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. This code didn't work in bash 4.3.0 and 4.1.2 in CentOS6 and 3.2.51 in Mac OS X Maverics. I guess you use BSD right? I think, this is BSD specific issue. @liancheng can you check whether that works or not in 4.3.8?
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.
Contributor
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. I'm using Maverics with an brew installed bash 4.3.8. And yes #1825 works, thanks. |
||
| if [[ $# -lt 2 ]]; then | ||
| usage | ||
|
Contributor
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. Maybe I'm missing something, but where does
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. utils.sh expects scripts which use utils.sh implements usage() but it's implicit.
Contributor
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. My fault, forgot to the usage function at first... |
||
| exit 1; | ||
| fi | ||
| SUBMISSION_OPTS+=($1); shift | ||
| SUBMISSION_OPTS+=($1); shift | ||
| ;; | ||
|
|
||
| --verbose | -v | --supervise) | ||
| SUBMISSION_OPTS+=($1); shift | ||
| ;; | ||
|
|
||
| *) | ||
| APPLICATION_OPTS+=($1); shift | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| export SUBMISSION_OPTS | ||
| export APPLICATION_OPTS | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ def launch_gateway(): | |
| submit_args = os.environ.get("PYSPARK_SUBMIT_ARGS") | ||
| submit_args = submit_args if submit_args is not None else "" | ||
| submit_args = shlex.split(submit_args) | ||
| command = [os.path.join(SPARK_HOME, script), "pyspark-shell"] + submit_args | ||
| command = [os.path.join(SPARK_HOME, script)] + submit_args + ["pyspark-shell"] | ||
|
Contributor
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. I don't see how application args for the pyspark shell are handled here. Is this still WIP?
Contributor
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. You could probably get them through
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. I also modified this in #1825 .
Contributor
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. Currently if we call something like
Contributor
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. @liancheng Ah yes, you're right, this doesn't actually do anything because the main class for the pyspark-shell is the |
||
| if not on_windows: | ||
| # Don't send ctrl-c / SIGINT to the Java gateway: | ||
| def preexec_func(): | ||
|
|
||
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.
Does this handle quoted strings, e.g.
--name "awesome app"? You may need to put double quotes around the argument lists.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.
Confirmed it doesn't, need to add similar logic as the
forloop inpysparkto handle quoted arguments.