xkrogen commented on a change in pull request #30450:
URL: https://github.com/apache/spark/pull/30450#discussion_r532730280
##########
File path:
resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/YarnClusterSuite.scala
##########
@@ -230,6 +230,37 @@ class YarnClusterSuite extends BaseYarnClusterSuite {
}
}
+ test("running Spark in yarn-cluster mode displays driver log links") {
+ val log4jConf = new File(tempDir, "log4j.properties")
+ val logOutFile = new File(tempDir, "logs")
+ Files.write(
+ s"""log4j.rootCategory=DEBUG,file
+ |log4j.appender.file=org.apache.log4j.FileAppender
+ |log4j.appender.file.file=$logOutFile
+ |log4j.appender.file.layout=org.apache.log4j.PatternLayout
+ |""".stripMargin,
+ log4jConf, StandardCharsets.UTF_8)
+ // Since this test is trying to extract log output from the SparkSubmit
process itself,
+ // standard options to the Spark process don't take effect. Leverage the
java-opts file which
+ // will get picked up for the SparkSubmit process.
+ val confDir = new File(tempDir, "conf")
+ confDir.mkdir()
+ val javaOptsFile = new File(confDir, "java-opts")
+ Files.write(s"-Dlog4j.configuration=file://$log4jConf\n", javaOptsFile,
StandardCharsets.UTF_8)
+
+ val result = File.createTempFile("result", null, tempDir)
+ val finalState = runSpark(clientMode = false,
+ mainClassName(YarnClusterDriver.getClass),
+ appArgs = Seq(result.getAbsolutePath),
+ extraEnv = Map("SPARK_CONF_DIR" -> confDir.getAbsolutePath),
+ extraConf = Map("spark.yarn.includeDriverLogsLink" -> true.toString))
+ checkResult(finalState, result)
+ val logOutput = Files.toString(logOutFile, StandardCharsets.UTF_8)
+ val logFilePattern = raw"""(?s).+\sDriver Logs \(<NAME>\):
http://.+/<NAME>\?start=-4096\s.+"""
Review comment:
Great call, yes. I have fixed this to match any number for the start
parameter, and match whether or not `?start=NNNN` is present. I just re-read
your comment @HeartSaVioR and maybe it does make more sense to ignore the
parameters altogether. Will update again.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]