You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by vanzin <gi...@git.apache.org> on 2014/09/20 01:46:03 UTC

[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

GitHub user vanzin opened a pull request:

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

    [SPARK-3606] [yarn] Correctly configure AmIpFilter for Yarn HA.

    The existing code only considered one of the RMs when running in
    Yarn HA mode, so it was possible to get errors if the active RM
    was not registered in the filter.
    
    The change makes use of a new API added to Yarn that returns all
    proxy addresses, and falls back to the old behavior if the API
    is not present. While there, I also made a change to look for the
    scheme (http or https) being used by Yarn when building the proxy
    URIs.
    
    Since, in the case of multiple RMs, Yarn uses commas as a separator,
    it was not possible anymore to use spark.filter.params to propagate
    this information (which used commas to delimit different config params).
    Instead, I added a new param (spark.filter.jsonParams) which expects
    a JSON string containing a map with the config data. I chose not to
    add it to the documentation at this point since I don't believe users
    will use it directly.

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

    $ git pull https://github.com/vanzin/spark SPARK-3606

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

    https://github.com/apache/spark/pull/2469.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 #2469
    
----
commit 4d4d6b983adca92315ac28de56ee517cf3b327b4
Author: Marcelo Vanzin <va...@cloudera.com>
Date:   2014-09-19T23:40:43Z

    [SPARK-3606] [yarn] Correctly configure AmIpFilter for Yarn HA.
    
    The existing code only considered one of the RMs when running in
    Yarn HA mode, so it was possible to get errors if the active RM
    was not registered in the filter.
    
    The change makes use of a new API added to Yarn that returns all
    proxy addresses, and falls back to the old behavior if the API
    is not present. While there, I also made a change to look for the
    scheme (http or https) being used by Yarn when building the proxy
    URIs.
    
    Since, in the case of multiple RMs, Yarn uses commas as a separator,
    it was not possible anymore to use spark.filter.params to propagate
    this information (which used commas to delimit different config params).
    Instead, I added a new param (spark.filter.jsonParams) which expects
    a JSON string containing a map with the config data. I chose not to
    add it to the documentation at this point since I don't believe users
    will use it directly.

----


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57839533
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21263/consoleFull) for   PR 2469 at commit [`aeb458a`](https://github.com/apache/spark/commit/aeb458ab0552174f5fb3b72c0a6607fc93d3bd44).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18174171
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    --- End diff --
    
    I see. Can you add the return type still? It's OK if the docs live in the parent 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 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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18121650
  
    --- Diff: yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -76,8 +76,12 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         resourceManager.finishApplicationMaster(finishReq)
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) =
    -    YarnConfiguration.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    val proxy = YarnConfiguration.getProxyHostAndPort(conf)
    +    val parts = proxy.split(":")
    +    val uriBase = "http://" + proxy + proxyBase
    --- End diff --
    
    Given the old code (L341 in ApplicationMaster.scala), no, you don't need a `/`.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18122014
  
    --- Diff: yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -76,8 +76,12 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         resourceManager.finishApplicationMaster(finishReq)
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) =
    -    YarnConfiguration.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    val proxy = YarnConfiguration.getProxyHostAndPort(conf)
    +    val parts = proxy.split(":")
    +    val uriBase = "http://" + proxy + proxyBase
    --- End diff --
    
    Oh I see you moved 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18175255
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    --- End diff --
    
    Mind if I skip this one? That would make this method not consistent with the others, it would make the line go over 100 chars, and well, it just feels a little redundant.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18409649
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -34,7 +34,7 @@ import org.json4s.JValue
     import org.json4s.jackson.JsonMethods.{pretty, render}
     
     import org.apache.spark.{Logging, SecurityManager, SparkConf}
    -import org.apache.spark.util.Utils
    +import org.apache.spark.util.{JsonProtocol, Utils}
    --- End diff --
    
    import not used


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57714569
  
    Hey @vanzin did you consider my proposal of using a common prefix `spark.$filterName.param.*` instead of putting JSON blob into the value? One advantage there is that the user can set things themselves if they wish, whereas now it's pretty much impossible for them to do that because they'll have to generate the JSON blob themselves.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57221669
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/20987/consoleFull) for   PR 2469 at commit [`04bc156`](https://github.com/apache/spark/commit/04bc156e4878862c0df903bb110d6ddd761d05d7).
     * This patch **passes** unit tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `  case class AddWebUIFilter(filterName:String, filterParams: Map[String, String], proxyBase :String)`



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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18172473
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    +    // so not all stable releases have it.
    +    val prefix = Try(classOf[WebAppUtils].getMethod("getHttpSchemePrefix", classOf[Configuration])
    +        .invoke(null, conf).asInstanceOf[String]).getOrElse("http://")
    +
    +    // If running a new enough Yarn, use the HA-aware API for retrieving the RM addresses.
    +    val method = Try(classOf[WebAppUtils].getMethod("getProxyHostsAndPortsForAmFilter",
    +      classOf[Configuration]))
    +    method match {
    +      case Success(proxiesMethod) =>
    +        val proxies = proxiesMethod.invoke(null, conf).asInstanceOf[JList[String]]
    +        val hosts = proxies.map { proxy => proxy.split(":")(0) }
    +        val uriBases = proxies.map { proxy => prefix + proxy + proxyBase }
    +        Map("PROXY_HOSTS" -> hosts.mkString(","), "PROXY_URI_BASES" -> uriBases.mkString(","))
    +
    +      case Failure(e: NoSuchMethodException) =>
    +        val proxy = WebAppUtils.getProxyHostAndPort(conf)
    +        val parts = proxy.split(":")
    +        val uriBase = prefix + proxy + proxyBase
    +        Map("PROXY_HOST" -> parts(0), "PROXY_URI_BASE" -> uriBase)
    --- End diff --
    
    They're slightly different, though (alpha API is a little bit different here).


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56249462
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/20598/consoleFull) for   PR 2469 at commit [`4d4d6b9`](https://github.com/apache/spark/commit/4d4d6b983adca92315ac28de56ee517cf3b327b4).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18172425
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    --- End diff --
    
    Those are in the parent class (YarnRMClient).


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57852801
  
    Ok, this should be good to go. Thanks @vanzin. Merging into master only since you have another patch for 1.1.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18174233
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala ---
    @@ -283,15 +284,17 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
       }
     
       // Add filters to the SparkUI
    -  def addWebUIFilter(filterName: String, filterParams: String, proxyBase: String) {
    +  def addWebUIFilter(filterName: String, filterParams: Map[String, String], proxyBase: String) {
         if (proxyBase != null && proxyBase.nonEmpty) {
           System.setProperty("spark.ui.proxyBase", proxyBase)
         }
     
    -    if (Seq(filterName, filterParams).forall(t => t != null && t.nonEmpty)) {
    +    val hasFilter = (filterName != null && filterName.nonEmpty &&
    +      filterParams != null && filterParams.nonEmpty)
    +    if (hasFilter) {
           logInfo(s"Add WebUI Filter. $filterName, $filterParams, $proxyBase")
           conf.set("spark.ui.filters", filterName)
    -      conf.set(s"spark.$filterName.params", filterParams)
    --- End diff --
    
    Ah I didn't realize that. In that case unfortunately we need to continue to support it, but maybe deprecate 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56251585
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/20598/consoleFull) for   PR 2469 at commit [`4d4d6b9`](https://github.com/apache/spark/commit/4d4d6b983adca92315ac28de56ee517cf3b327b4).
     * This patch **fails** unit tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57851261
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21263/consoleFull) for   PR 2469 at commit [`aeb458a`](https://github.com/apache/spark/commit/aeb458ab0552174f5fb3b72c0a6607fc93d3bd44).
     * This patch **passes** unit tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `  case class AddWebUIFilter(filterName:String, filterParams: Map[String, String], proxyBase :String)`
      * `  protected case class Keyword(str: String)`



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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56252034
  
    Test failure looks unrelated?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57221677
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/20987/


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57211446
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/20987/consoleFull) for   PR 2469 at commit [`04bc156`](https://github.com/apache/spark/commit/04bc156e4878862c0df903bb110d6ddd761d05d7).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18122022
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala ---
    @@ -283,15 +284,17 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
       }
     
       // Add filters to the SparkUI
    -  def addWebUIFilter(filterName: String, filterParams: String, proxyBase: String) {
    +  def addWebUIFilter(filterName: String, filterParams: Map[String, String], proxyBase: String) {
         if (proxyBase != null && proxyBase.nonEmpty) {
           System.setProperty("spark.ui.proxyBase", proxyBase)
         }
     
    -    if (Seq(filterName, filterParams).forall(t => t != null && t.nonEmpty)) {
    +    val hasFilter = (filterName != null && filterName.nonEmpty &&
    +      filterParams != null && filterParams.nonEmpty)
    +    if (hasFilter) {
           logInfo(s"Add WebUI Filter. $filterName, $filterParams, $proxyBase")
           conf.set("spark.ui.filters", filterName)
    -      conf.set(s"spark.$filterName.params", filterParams)
    --- End diff --
    
    So do we set `spark.$filterName.params` anywhere now? There's still code to process 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56468138
  
    Thanks for fixing this @vanzin. I will look at it shortly.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18410539
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,28 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    --- End diff --
    
    Yeah I pointed this out because the comment is technically incorrect (the code doesn't need to change because of 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18172284
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -148,14 +148,21 @@ private[spark] object JettyUtils extends Logging {
               holder.setClassName(filter)
               // Get any parameters for each filter
               val paramName = "spark." + filter + ".params"
    -          val params = conf.get(paramName, "").split(',').map(_.trim()).toSet
    -          params.foreach {
    +          val params = conf.get(paramName, "").split(',').map(_.trim()).foreach {
    --- End diff --
    
    Hmm, I don't remember changing this but looks like I did. Anyway, it can be cleaned up further.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18122029
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    +    // so not all stable releases have it.
    +    val prefix = Try(classOf[WebAppUtils].getMethod("getHttpSchemePrefix", classOf[Configuration])
    +        .invoke(null, conf).asInstanceOf[String]).getOrElse("http://")
    +
    +    // If running a new enough Yarn, use the HA-aware API for retrieving the RM addresses.
    +    val method = Try(classOf[WebAppUtils].getMethod("getProxyHostsAndPortsForAmFilter",
    +      classOf[Configuration]))
    +    method match {
    +      case Success(proxiesMethod) =>
    +        val proxies = proxiesMethod.invoke(null, conf).asInstanceOf[JList[String]]
    +        val hosts = proxies.map { proxy => proxy.split(":")(0) }
    +        val uriBases = proxies.map { proxy => prefix + proxy + proxyBase }
    +        Map("PROXY_HOSTS" -> hosts.mkString(","), "PROXY_URI_BASES" -> uriBases.mkString(","))
    +
    +      case Failure(e: NoSuchMethodException) =>
    +        val proxy = WebAppUtils.getProxyHostAndPort(conf)
    +        val parts = proxy.split(":")
    +        val uriBase = prefix + proxy + proxyBase
    +        Map("PROXY_HOST" -> parts(0), "PROXY_URI_BASE" -> uriBase)
    --- End diff --
    
    These few lines look a lot like `YarnRMClientImpl#getAmIpFilterParams`. Maybe put them in a function?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56413627
  
    Jenkins, test this please.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18410060
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,28 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    --- End diff --
    
    Looks like this wasn't in 2.3.0 either


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56425129
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/20657/consoleFull) for   PR 2469 at commit [`4d4d6b9`](https://github.com/apache/spark/commit/4d4d6b983adca92315ac28de56ee517cf3b327b4).
     * This patch **passes** unit tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `  case class AddWebUIFilter(filterName:String, filterParams: Map[String, String], proxyBase :String)`



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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57838651
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21262/Test FAILed.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18410729
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,28 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    +    // so not all stable releases have it.
    +    val prefix = Try(classOf[WebAppUtils].getMethod("getHttpSchemePrefix", classOf[Configuration])
    +        .invoke(null, conf).asInstanceOf[String]).getOrElse("http://")
    +
    +    // If running a new enough Yarn, use the HA-aware API for retrieving the RM addresses.
    +    try {
    +      val method = classOf[WebAppUtils].getMethod("getProxyHostsAndPortsForAmFilter",
    +        classOf[Configuration])
    +      val proxies = method.invoke(null, conf).asInstanceOf[JList[String]]
    +      val hosts = proxies.map { proxy => proxy.split(":")(0) }
    +      val uriBases = proxies.map { proxy => prefix + proxy + proxyBase }
    +      Map("PROXY_HOSTS" -> hosts.mkString(","), "PROXY_URI_BASES" -> uriBases.mkString(","))
    +    } catch {
    +      case e: NoSuchMethodException =>
    --- End diff --
    
    Oh never mind this is in the stable module


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56417990
  
    BTW it would be nice to backport this to 1.1 or 1.0, but this patch won't merge cleanly. I'll work on that when this PR is merged.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57732513
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21233/consoleFull) for   PR 2469 at commit [`d121883`](https://github.com/apache/spark/commit/d121883b367f090de7e33ac78c2bc90c3ae6d401).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18122026
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    --- End diff --
    
    Can you add return type here and a short javadoc on what this does?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57022734
  
    Ping, anyone?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18410712
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,28 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    --- End diff --
    
    2.4 is still after 2.2. 2.2 is the key version here (oldest version we need to support).


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57838988
  
    Jenkins, retest this please.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56414730
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/20657/consoleFull) for   PR 2469 at commit [`4d4d6b9`](https://github.com/apache/spark/commit/4d4d6b983adca92315ac28de56ee517cf3b327b4).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18122011
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -148,14 +148,21 @@ private[spark] object JettyUtils extends Logging {
               holder.setClassName(filter)
               // Get any parameters for each filter
               val paramName = "spark." + filter + ".params"
    --- End diff --
    
    Maybe define `val jsonParamName` here so it looks more organized?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57834604
  
    Cool LGTM pending tests.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18121959
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -148,14 +148,21 @@ private[spark] object JettyUtils extends Logging {
               holder.setClassName(filter)
               // Get any parameters for each filter
               val paramName = "spark." + filter + ".params"
    -          val params = conf.get(paramName, "").split(',').map(_.trim()).toSet
    -          params.foreach {
    +          val params = conf.get(paramName, "").split(',').map(_.trim()).foreach {
    --- End diff --
    
    I think the `toSet` was there to deal with duplicates. Do we need 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18121355
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    +    // so not all stable releases have it.
    --- End diff --
    
    How did this even compile before for say hadoop 2.1?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57738768
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21233/consoleFull) for   PR 2469 at commit [`d121883`](https://github.com/apache/spark/commit/d121883b367f090de7e33ac78c2bc90c3ae6d401).
     * This patch **passes** unit tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `  case class AddWebUIFilter(filterName:String, filterParams: Map[String, String], proxyBase :String)`



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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18410472
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,28 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    +    // so not all stable releases have it.
    +    val prefix = Try(classOf[WebAppUtils].getMethod("getHttpSchemePrefix", classOf[Configuration])
    +        .invoke(null, conf).asInstanceOf[String]).getOrElse("http://")
    +
    +    // If running a new enough Yarn, use the HA-aware API for retrieving the RM addresses.
    +    try {
    +      val method = classOf[WebAppUtils].getMethod("getProxyHostsAndPortsForAmFilter",
    +        classOf[Configuration])
    +      val proxies = method.invoke(null, conf).asInstanceOf[JList[String]]
    +      val hosts = proxies.map { proxy => proxy.split(":")(0) }
    +      val uriBases = proxies.map { proxy => prefix + proxy + proxyBase }
    +      Map("PROXY_HOSTS" -> hosts.mkString(","), "PROXY_URI_BASES" -> uriBases.mkString(","))
    +    } catch {
    +      case e: NoSuchMethodException =>
    --- End diff --
    
    I think `WebAppUtils` doesn't actually exist in alpha (at least not in 0.23.3). We might need to catch a more general exception here.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57738773
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21233/


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18121320
  
    --- Diff: yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -334,18 +335,14 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments,
     
       /** Add the Yarn IP filter that is required for properly securing the UI. */
       private def addAmIpFilter() = {
    -    val amFilter = "org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter"
    -    val proxy = client.getProxyHostAndPort(yarnConf)
    -    val parts = proxy.split(":")
         val proxyBase = System.getenv(ApplicationConstants.APPLICATION_WEB_PROXY_BASE_ENV)
    -    val uriBase = "http://" + proxy + proxyBase
    -    val params = "PROXY_HOST=" + parts(0) + "," + "PROXY_URI_BASE=" + uriBase
    -
    +    val amFilter = "org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter"
    +    val params = client.getAmIpFilterParams(yarnConf, proxyBase)
         if (isDriver) {
           System.setProperty("spark.ui.filters", amFilter)
    -      System.setProperty(s"spark.$amFilter.params", params)
    +      System.setProperty(s"spark.$amFilter.jsonParams", compact(JsonProtocol.mapToJson(params)))
    --- End diff --
    
    I think we need to keep the old param for backward compatibility


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57835431
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21259/Test FAILed.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

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


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18122033
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    +    // so not all stable releases have it.
    +    val prefix = Try(classOf[WebAppUtils].getMethod("getHttpSchemePrefix", classOf[Configuration])
    +        .invoke(null, conf).asInstanceOf[String]).getOrElse("http://")
    +
    +    // If running a new enough Yarn, use the HA-aware API for retrieving the RM addresses.
    +    val method = Try(classOf[WebAppUtils].getMethod("getProxyHostsAndPortsForAmFilter",
    +      classOf[Configuration]))
    +    method match {
    +      case Success(proxiesMethod) =>
    +        val proxies = proxiesMethod.invoke(null, conf).asInstanceOf[JList[String]]
    +        val hosts = proxies.map { proxy => proxy.split(":")(0) }
    +        val uriBases = proxies.map { proxy => prefix + proxy + proxyBase }
    +        Map("PROXY_HOSTS" -> hosts.mkString(","), "PROXY_URI_BASES" -> uriBases.mkString(","))
    +
    +      case Failure(e: NoSuchMethodException) =>
    +        val proxy = WebAppUtils.getProxyHostAndPort(conf)
    +        val parts = proxy.split(":")
    +        val uriBase = prefix + proxy + proxyBase
    +        Map("PROXY_HOST" -> parts(0), "PROXY_URI_BASE" -> uriBase)
    +
    +      case Failure(e) =>
    +        throw e
    +    }
    +  }
    --- End diff --
    
    I actually think this whole block is clearer with Java's plain old try catch, particular because the things you are `Try`ing are pretty long.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18172384
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala ---
    @@ -283,15 +284,17 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
       }
     
       // Add filters to the SparkUI
    -  def addWebUIFilter(filterName: String, filterParams: String, proxyBase: String) {
    +  def addWebUIFilter(filterName: String, filterParams: Map[String, String], proxyBase: String) {
         if (proxyBase != null && proxyBase.nonEmpty) {
           System.setProperty("spark.ui.proxyBase", proxyBase)
         }
     
    -    if (Seq(filterName, filterParams).forall(t => t != null && t.nonEmpty)) {
    +    val hasFilter = (filterName != null && filterName.nonEmpty &&
    +      filterParams != null && filterParams.nonEmpty)
    +    if (hasFilter) {
           logInfo(s"Add WebUI Filter. $filterName, $filterParams, $proxyBase")
           conf.set("spark.ui.filters", filterName)
    -      conf.set(s"spark.$filterName.params", filterParams)
    --- End diff --
    
    I don't think the code does, but this is a public config option (see configuration.md).


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18121316
  
    --- Diff: yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -76,8 +76,12 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         resourceManager.finishApplicationMaster(finishReq)
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) =
    -    YarnConfiguration.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    val proxy = YarnConfiguration.getProxyHostAndPort(conf)
    +    val parts = proxy.split(":")
    +    val uriBase = "http://" + proxy + proxyBase
    --- End diff --
    
    What do `proxy` and `proxyBase` look like? Do we need a `/` in between?


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57851275
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21263/Test 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18410229
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,28 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    +    // Figure out which scheme Yarn is using. Note the method seems to have been added after 2.2,
    --- End diff --
    
    When exactly doesn't matter; what matters is that 2.2 is the first release in what Spark considers "stable", so if 2.2 doesn't have it, then the hack is necessary.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-56249340
  
    What I tested:
    - compiled for yarn-alpha but didn't test
    - ran job with yarn-cluster and yarn-client on single RM yarn
    - ran job with yarn-cluster and yarn-client on Yarn HA, with both RMs service as master (at different times, obviously)
    - did not test with SSL enabled



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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57042685
  
    Hey @vanzin I left relatively minor comments. I see in this patch we make an attempt to make the filter params a little more type safe, which is very welcome. I'm not super fond of putting a json blob into a config, but I don't really have great suggestions for alternatives either. One thing we could do is to break the map down into multiple configs that share the prefix `spark.$filterName.param.*`. Maybe that's a little cleaner, but I don't feel super strongly about 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.
---

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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#discussion_r18177601
  
    --- Diff: yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/YarnRMClientImpl.scala ---
    @@ -69,7 +74,32 @@ private class YarnRMClientImpl(args: ApplicationMasterArguments) extends YarnRMC
         appAttemptId
       }
     
    -  override def getProxyHostAndPort(conf: YarnConfiguration) = WebAppUtils.getProxyHostAndPort(conf)
    +  override def getAmIpFilterParams(conf: YarnConfiguration, proxyBase: String) = {
    --- End diff --
    
    Ok, though in general it really helps someone who's not familiar with the code to understand it. We can add it in later in a general clean up patch.


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


[GitHub] spark pull request: [SPARK-3606] [yarn] Correctly configure AmIpFi...

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

    https://github.com/apache/spark/pull/2469#issuecomment-57695398
  
    Hello guys, any more feedback on this PR? Thanks!


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