spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vanzin <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-15360][Spark-Submit]Should print spark-...
Date Wed, 18 May 2016 17:21:38 GMT
Github user vanzin commented on the pull request:

    https://github.com/apache/spark/pull/13163#issuecomment-220097877
  
    Sorry, this was me. But as others said, this is not the right fix. Here's a patch that
does it:
    
    ```
    diff --git a/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java
b/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java
    index 76897c4..a7c4179 100644
    --- a/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java
    +++ b/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java
    @@ -107,28 +107,37 @@ class SparkSubmitCommandBuilder extends AbstractCommandBuilder {
     
       SparkSubmitCommandBuilder(List<String> args) {
         this.allowsMixedArguments = false;
    +    this.sparkArgs = new ArrayList<>();
     
         boolean isExample = false;
         List<String> submitArgs = args;
    -    if (args.size() > 0 && args.get(0).equals(PYSPARK_SHELL)) {
    -      this.allowsMixedArguments = true;
    -      appResource = PYSPARK_SHELL;
    -      submitArgs = args.subList(1, args.size());
    -    } else if (args.size() > 0 && args.get(0).equals(SPARKR_SHELL)) {
    -      this.allowsMixedArguments = true;
    -      appResource = SPARKR_SHELL;
    -      submitArgs = args.subList(1, args.size());
    -    } else if (args.size() > 0 && args.get(0).equals(RUN_EXAMPLE)) {
    -      isExample = true;
    -      submitArgs = args.subList(1, args.size());
    +    if (args.size() > 0) {
    +      switch (args.get(0)) {
    +        case PYSPARK_SHELL:
    +          this.allowsMixedArguments = true;
    +          appResource = PYSPARK_SHELL;
    +          submitArgs = args.subList(1, args.size());
    +          break;
    +
    +        case SPARKR_SHELL:
    +          this.allowsMixedArguments = true;
    +          appResource = SPARKR_SHELL;
    +          submitArgs = args.subList(1, args.size());
    +          break;
    +
    +        case RUN_EXAMPLE:
    +          isExample = true;
    +          submitArgs = args.subList(1, args.size());
    +      }
    +
    +      OptionParser parser = new OptionParser();
    +      parser.parse(submitArgs);
    +      this.printInfo = parser.infoRequested;
    +    }  else {
    +      this.printInfo = true;
         }
     
    -    this.sparkArgs = new ArrayList<>();
         this.isExample = isExample;
    -
    -    OptionParser parser = new OptionParser();
    -    parser.parse(submitArgs);
    -    this.printInfo = parser.infoRequested;
       }
     
       @Override
    @@ -147,7 +156,7 @@ class SparkSubmitCommandBuilder extends AbstractCommandBuilder {
         List<String> args = new ArrayList<>();
         SparkSubmitOptionParser parser = new SparkSubmitOptionParser();
     
    -    if (!allowsMixedArguments) {
    +    if (!allowsMixedArguments && !printInfo) {
           checkArgument(appResource != null, "Missing application resource.");
         }
     
    ```


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message