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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to