You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by pwendell <gi...@git.apache.org> on 2014/05/09 02:51:16 UTC

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

GitHub user pwendell opened a pull request:

    https://github.com/apache/spark/pull/704

    SPARK-1565 (Addendum): Replace `run-example` with `spark-submit`.

    Gives a nicely formatted message to the user when `run-example` is run to
    tell them to use `spark-submit`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pwendell/spark examples

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/704.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #704
    
----
commit 247466843eccc7fe8b1342c0d59401da6f3ec9c3
Author: Patrick Wendell <pw...@gmail.com>
Date:   2014-05-08T20:37:48Z

    SPARK-1565 (Addendum): Replace `run-example` with `spark-submit`.
    
    Gives a nicely formatted message to the user when `run-examle` is run to
    tell them to use `spark-submit`.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42635008
  
    Merged build finished. All automated tests passed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42625542
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14832/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12462266
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,31 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +SPARK_EXAMPLES_JAR_REL=${SPARK_EXAMPLES_JAR#$FWDIR/}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    +EXAMPLE_CLASS="<example-class>"
    +EXAMPLE_ARGS="[<example args>]"
    +EXAMPLE_MASTER=${MASTER:-"<master>"}
     
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
     fi
    -export JAVA_OPTS
     
    -if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
    -  echo -n "Spark Command: "
    -  echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    -  echo "========================================"
    -  echo
    +if [ -n "$1" ]; then
    +  EXAMPLE_ARGS="$@"
     fi
     
    -exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    +echo "NOTE: This script has been replaced with ./bin/spark-submit. Please run:" >&2
    +echo
    +echo "./bin/spark-submit \\" >&2
    --- End diff --
    
    I thought about this some more, I think maybe we should just call spark-submit with the supplied master instead of telling the user this stuff. Or we could call spark submit and then print out the user how to run this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42623664
  
     Merged build triggered. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42633954
  
    Merged build finished. All automated tests passed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12462381
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,31 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +SPARK_EXAMPLES_JAR_REL=${SPARK_EXAMPLES_JAR#$FWDIR/}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    +EXAMPLE_CLASS="<example-class>"
    +EXAMPLE_ARGS="[<example args>]"
    +EXAMPLE_MASTER=${MASTER:-"<master>"}
     
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
     fi
    -export JAVA_OPTS
     
    -if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
    -  echo -n "Spark Command: "
    -  echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    -  echo "========================================"
    -  echo
    +if [ -n "$1" ]; then
    +  EXAMPLE_ARGS="$@"
     fi
     
    -exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    +echo "NOTE: This script has been replaced with ./bin/spark-submit. Please run:" >&2
    +echo
    +echo "./bin/spark-submit \\" >&2
    --- End diff --
    
    Great idea!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12463909
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,29 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +EXAMPLE_MASTER=${MASTER:-"local[2]"}
    --- End diff --
    
    This is not a consistent default. Should we use `local[*]` as in spark-submit?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42632124
  
     Merged build triggered. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42625541
  
    Merged build finished. All automated tests passed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12464498
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,29 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +EXAMPLE_MASTER=${MASTER:-"local[*]"}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    -
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
    +else 
    +  echo "usage: ./bin/run-example <example-class> [<example-args>]" 
    --- End diff --
    
    oops sorry there's another one


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12463899
  
    --- Diff: README.md ---
    @@ -39,17 +39,22 @@ And run the following command, which should also return 1000:
     ## Example Programs
     
     Spark also comes with several sample programs in the `examples` directory.
    -To run one of them, use `./bin/run-example <class> <params>`. For example:
    +To run one of them, use `./bin/run-example <class> [<params>]`. For example:
    --- End diff --
    
    nit: What does the notation `[< ... >]` mean? I think it's clearer if it's just `[params]`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42632329
  
    Merged build finished. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42633956
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14839/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42632330
  
    
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14838/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42635009
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14841/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42631960
  
     Merged build triggered. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42631963
  
    Merged build started. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42633734
  
    Merged build started. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42623797
  
    cc/ @andrewor


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42634130
  
    Pending one small change this LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42623671
  
    Merged build started. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42633729
  
     Merged build triggered. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12463219
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,31 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +SPARK_EXAMPLES_JAR_REL=${SPARK_EXAMPLES_JAR#$FWDIR/}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    +EXAMPLE_CLASS="<example-class>"
    +EXAMPLE_ARGS="[<example args>]"
    +EXAMPLE_MASTER=${MASTER:-"<master>"}
     
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
     fi
    -export JAVA_OPTS
     
    -if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
    -  echo -n "Spark Command: "
    -  echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    -  echo "========================================"
    -  echo
    +if [ -n "$1" ]; then
    +  EXAMPLE_ARGS="$@"
     fi
     
    -exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    +echo "NOTE: This script has been replaced with ./bin/spark-submit. Please run:" >&2
    +echo
    +echo "./bin/spark-submit \\" >&2
    --- End diff --
    
    Yea so I think if it starts with `org.apache.spark.examples` we would pass it through. If not, we'll prepend `org.apache.spark.examples`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12462306
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,31 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +SPARK_EXAMPLES_JAR_REL=${SPARK_EXAMPLES_JAR#$FWDIR/}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    +EXAMPLE_CLASS="<example-class>"
    +EXAMPLE_ARGS="[<example args>]"
    +EXAMPLE_MASTER=${MASTER:-"<master>"}
     
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
     fi
    -export JAVA_OPTS
     
    -if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
    -  echo -n "Spark Command: "
    -  echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    -  echo "========================================"
    -  echo
    +if [ -n "$1" ]; then
    +  EXAMPLE_ARGS="$@"
     fi
     
    -exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    +echo "NOTE: This script has been replaced with ./bin/spark-submit. Please run:" >&2
    +echo
    +echo "./bin/spark-submit \\" >&2
    +echo "  --master $EXAMPLE_MASTER \\" >&2
    +echo "  --class $EXAMPLE_CLASS \\" >&2
    +echo "  $SPARK_EXAMPLES_JAR_REL \\" >&2
    +echo "  $EXAMPLE_ARGS" >&2
    --- End diff --
    
    Not to self: if we call this directly we'll need to pass `"$@"`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42632130
  
    Merged build started. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12463962
  
    --- Diff: README.md ---
    @@ -39,17 +39,22 @@ And run the following command, which should also return 1000:
     ## Example Programs
     
     Spark also comes with several sample programs in the `examples` directory.
    -To run one of them, use `./bin/run-example <class> <params>`. For example:
    +To run one of them, use `./bin/run-example <class> [<params>]`. For example:
     
    -    ./bin/run-example org.apache.spark.examples.SparkLR local[2]
    +    ./bin/run-example org.apache.spark.examples.SparkLR
     
    -will run the Logistic Regression example locally on 2 CPUs.
    +will run the Logistic Regression example locally.
     
    -Each of the example programs prints usage help if no params are given.
    +You can set the MASTER environment variable when running examples to submit
    +examples to a cluster. This can be a mesos:// or spark:// URL, 
    +"yarn-cluster" or "yarn-client" to run on YARN, and "local" to run 
    +locally with one thread, or "local[N]" to run locally with N thread. You 
    --- End diff --
    
    N threads


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/704


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:

    https://github.com/apache/spark/pull/704#issuecomment-42634544
  
    Okay cool - I'll pull that change in when I merge it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12463032
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,31 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +SPARK_EXAMPLES_JAR_REL=${SPARK_EXAMPLES_JAR#$FWDIR/}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    +EXAMPLE_CLASS="<example-class>"
    +EXAMPLE_ARGS="[<example args>]"
    +EXAMPLE_MASTER=${MASTER:-"<master>"}
     
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
     fi
    -export JAVA_OPTS
     
    -if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
    -  echo -n "Spark Command: "
    -  echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    -  echo "========================================"
    -  echo
    +if [ -n "$1" ]; then
    +  EXAMPLE_ARGS="$@"
     fi
     
    -exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    +echo "NOTE: This script has been replaced with ./bin/spark-submit. Please run:" >&2
    +echo
    +echo "./bin/spark-submit \\" >&2
    --- End diff --
    
    well but then you have streaming examples and mllib examples. Do we expect the user to type in millib.MovieLensALS then? I actually think the `org.apache.examples.spark.SparkPi` is more consistent with the rest (i.e. SparkPi). Maybe we should accept both.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by tdas <gi...@git.apache.org>.
Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12462341
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,31 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +SPARK_EXAMPLES_JAR_REL=${SPARK_EXAMPLES_JAR#$FWDIR/}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    +EXAMPLE_CLASS="<example-class>"
    +EXAMPLE_ARGS="[<example args>]"
    +EXAMPLE_MASTER=${MASTER:-"<master>"}
     
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
     fi
    -export JAVA_OPTS
     
    -if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
    -  echo -n "Spark Command: "
    -  echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    -  echo "========================================"
    -  echo
    +if [ -n "$1" ]; then
    +  EXAMPLE_ARGS="$@"
     fi
     
    -exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
    +echo "NOTE: This script has been replaced with ./bin/spark-submit. Please run:" >&2
    +echo
    +echo "./bin/spark-submit \\" >&2
    --- End diff --
    
    Yes, I completely agree. We dont want the user to have to type out this more complicated stuff with library path and all. Just 
    bin/run-example <example params>
    
    In fact, now that all the examples are inside spark.examples. package, we can try to make it even simpler. To run SparkPi, one should be able to just say
    
    ./bin/run-example SparkPi 
    
    That would very simple!



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] spark pull request: SPARK-1565 (Addendum): Replace `run-example` w...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/704#discussion_r12463941
  
    --- Diff: bin/run-example ---
    @@ -49,46 +31,29 @@ fi
     
     if [[ -z $SPARK_EXAMPLES_JAR ]]; then
       echo "Failed to find Spark examples assembly in $FWDIR/lib or $FWDIR/examples/target" >&2
    -  echo "You need to build Spark with sbt/sbt assembly before running this program" >&2
    +  echo "You need to build Spark before running this program" >&2
       exit 1
     fi
     
    +EXAMPLE_MASTER=${MASTER:-"local[2]"}
     
    -# Since the examples JAR ideally shouldn't include spark-core (that dependency should be
    -# "provided"), also add our standard Spark classpath, built using compute-classpath.sh.
    -CLASSPATH=`$FWDIR/bin/compute-classpath.sh`
    -CLASSPATH="$SPARK_EXAMPLES_JAR:$CLASSPATH"
    -
    -if $cygwin; then
    -    CLASSPATH=`cygpath -wp $CLASSPATH`
    -    export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
    -fi
    -
    -# Find java binary
    -if [ -n "${JAVA_HOME}" ]; then
    -  RUNNER="${JAVA_HOME}/bin/java"
    -else
    -  if [ `command -v java` ]; then
    -    RUNNER="java"
    -  else
    -    echo "JAVA_HOME is not set" >&2
    -    exit 1
    -  fi
    -fi
    -
    -# Set JAVA_OPTS to be able to load native libraries and to set heap size
    -JAVA_OPTS="$SPARK_JAVA_OPTS"
    -# Load extra JAVA_OPTS from conf/java-opts, if it exists
    -if [ -e "$FWDIR/conf/java-opts" ] ; then
    -  JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
    +if [ -n "$1" ]; then
    +  EXAMPLE_CLASS="$1"
    +  shift
    +else 
    +  echo "usage: ./bin/run-example <example-class> [<example-args>]" 
    +  echo "  - set MASTER=XX to use a specific master"
    +  echo "  - can use abbreviated example class name (e.g. SparkPi)"
    --- End diff --
    
    maybe we should also add an example for say MLlib or Sql examples; people might try to run `MovieLensALS` directly given this message. Perhaps something like `(e.g. SparkPi, mllib.MovieLensALS)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---