Github user harishreedharan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6166#discussion_r30535298
  
    --- Diff: 
yarn/src/main/scala/org/apache/spark/scheduler/cluster/YarnClusterSchedulerBackend.scala
 ---
    @@ -53,4 +62,53 @@ private[spark] class YarnClusterSchedulerBackend(
           logError("Application attempt ID is not set.")
           super.applicationAttemptId
         }
    +
    +  override def getDriverLogUrls: Option[Map[String, String]] = {
    +    var yarnClientOpt: Option[YarnClient] = None
    +    var driverLogs: Option[Map[String, String]] = None
    +    try {
    +      val yarnConf = new YarnConfiguration(sc.hadoopConfiguration)
    +      val containerId = YarnSparkHadoopUtil.get.getContainerId
    +      yarnClientOpt = Some(YarnClient.createYarnClient())
    +      yarnClientOpt.foreach { yarnClient =>
    +        yarnClient.init(yarnConf)
    +        yarnClient.start()
    +        val addresses =
    +          NetworkInterface.getNetworkInterfaces.asScala
    +            .flatMap(_.getInetAddresses.asScala)
    +            .toSeq
    +
    +        val nodeReport =
    +          yarnClient.getNodeReports(NodeState.RUNNING).asScala.find { x =>
    +            val host = x.getNodeId.getHost
    +            addresses.exists { address =>
    +              address.getHostAddress == host ||
    +                address.getHostName == host ||
    +                address.getCanonicalHostName == host
    +            }
    +          }
    +        nodeReport.foreach { report =>
    +          val httpAddress = report.getHttpAddress
    +          // lookup appropriate http scheme for container log urls
    +          val yarnHttpPolicy = yarnConf.get(
    +            YarnConfiguration.YARN_HTTP_POLICY_KEY,
    +            YarnConfiguration.YARN_HTTP_POLICY_DEFAULT
    +          )
    +          val user = Utils.getCurrentUserName()
    +          val httpScheme = if (yarnHttpPolicy == "HTTPS_ONLY") "https://"; 
else "http://";
    +          val baseUrl = 
s"$httpScheme$httpAddress/node/containerlogs/$containerId/$user"
    +          logInfo(s"Base URL for logs: $baseUrl")
    --- End diff --
    
    Will do.


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

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

Reply via email to