AngersZhuuuu commented on code in PR #53539:
URL: https://github.com/apache/spark/pull/53539#discussion_r2650077470
##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1631,6 +1631,38 @@ class SparkSubmitSuite
assertResult(3)(runSparkSubmit(args, expectFailure = true))
}
+ test("SPARK-54774: k8s submit failed should keep same exit code with user
code") {
+ val unusedJar = TestUtils.createJarWithClasses(Seq.empty)
+ val fileSystem = Utils.getHadoopFileSystem("/",
+ SparkHadoopUtil.get.newConfiguration(new SparkConf()))
+ withTempDir { testDir =>
+ val testDirPath = new Path(testDir.getAbsolutePath())
+ val args = Seq(
+ "--class",
K8sExitCodeTestApplication.getClass.getName.stripSuffix("$"),
+ "--name", "testApp",
+ "--master", "k8s://host:port",
+ "--conf", "spark.ui.enabled=false",
+ "--conf", "spark.master.rest.enabled=false",
+ "--conf",
"spark.kubernetes.authenticate.driver.serviceAccountName=default",
+ "--conf", "spark.eventLog.enabled=true",
+ "--conf", "spark.eventLog.rolling.enabled=false",
+ "--conf", "spark.eventLog.testing=true",
+ "--conf", s"spark.eventLog.dir=${testDirPath.toUri.toString}",
+ unusedJar.toString
+ )
+ // The test application throws SparkUserAppException with exit code 42,
+ // so SparkContext.stop(42) should be called in k8s mode
+ runSparkSubmit(args, expectFailure = true)
+ val listStatus = fileSystem.listStatus(testDirPath)
+ val logData = EventLogFileReader.openEventLog(listStatus.last.getPath,
fileSystem)
+ Source.fromInputStream(logData)(Codec.UTF8).getLines().filter { line =>
+ line.contains("SparkListenerApplicationEnd")
Review Comment:
WDYT? @dongjoon-hyun
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]