Github user vanzin commented on a diff in the pull request:
    --- Diff: 
core/src/main/scala/org/apache/spark/util/SparkConfigParseUtils.scala ---
    @@ -0,0 +1,48 @@
    + * 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
    + *
    + *
    + *
    + * 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.
    + */
    +package org.apache.spark.util
    + * Provides logic to parse Spark config properties from cli.
    + * Used by processes creating a SparkConfig from cli args.
    + * Facilitates the use of common error messages when spark conf parsing 
    + *
    + */
    +private[spark] trait SparkConfigParseUtils {
    +  // scalastyle:off println
    +  // Exposed for testing
    +  private[spark] var exitFn: Int => Unit = (exitCode: Int) => 
    +  private[spark] var printStream: PrintStream = System.err
    +  private[spark] def printWarning(str: String): Unit = 
printStream.println("Warning: " + str)
    +  private[spark] def printErrorAndExit(str: String): Unit = {
    +    printStream.println("Error: " + str)
    +    printStream.println("Run with --help for usage help or --verbose for 
debug output")
    +    exitFn(1)
    +  }
    +  private[spark] def parseSparkConfProperty(pair: String, update: (String, 
String) => Unit)
    --- End diff --
    This signature is super awkward. I'd suggest two alternatives:
    - return the parsed (key, value) pair and let the caller decide what to do
    - move all config parsing into this trait and let it handle collecting the 
config values.
    The latter could also include a method for handling `--properties-file`, 
and a way for getting the "final" Spark configuration. This functionality is 
kind of a pre-requisite for SPARK-12344, btw, which basically requires doing 
this for all processes that use "spark-class".

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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to