spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uncleGen <...@git.apache.org>
Subject [GitHub] spark pull request #16827: [SPARK-19482][CORE] Fail it if 'spark.master' is ...
Date Tue, 07 Feb 2017 04:19:28 GMT
Github user uncleGen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16827#discussion_r99743099
  
    --- Diff: core/src/main/scala/org/apache/spark/SparkConf.scala ---
    @@ -779,6 +781,30 @@ private[spark] object SparkConf extends Logging {
       }
     
       /**
    +   * check if the given config key-value is valid.
    +   */
    +  def checkValidSetting(key: String, value: String, conf: SparkConf): Unit = {
    +    if (key.equals("spark.master")) {
    +      // First, there is no need to set 'spark.master' multi-times with different values.
    +      // Second, It is possible for users to set the different 'spark.master' in code
with
    +      // `spark-submit` command, and will confuse users.
    +      // So, we should do once check if the 'spark.master' already exists in settings
and if
    +      // the previous value is the same with current value. Throw a IllegalArgumentException
when
    +      // previous value is different with current value.
    +      val previousOne = try {
    +        Some(conf.get(key))
    +      } catch {
    +        case e: NoSuchElementException =>
    +          None
    +      }
    +      if (previousOne.isDefined && !previousOne.get.equals(value)) {
    +        throw new IllegalArgumentException(s"'spark.master' should not be set with different
" +
    +          s"value, previous value is ${previousOne.get} and current value is $value")
    +      }
    --- End diff --
    
    here, we choose to throw IllegalArgumentException to fail job. Besides, we can also choose
to log a warning in a gentle way.


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