Github user renozhang commented on a diff in the pull request:
https://github.com/apache/spark/pull/13962#discussion_r68878989
--- Diff:
yarn/src/test/scala/org/apache/spark/deploy/yarn/YarnClusterSuite.scala ---
@@ -259,6 +264,43 @@ private[spark] class SaveExecutorInfo extends
SparkListener {
}
}
+private object YarnClusterDriverWithFailure extends Logging with Matchers {
+
+ val WAIT_TIMEOUT_MILLIS = 10000
+
+ def main(args: Array[String]): Unit = {
+ if (args.length != 1) {
+ // scalastyle:off println
+ System.err.println(
+ s"""
+ |Invalid command line: ${args.mkString(" ")}
+ |
+ |Usage: YarnClusterDriver [result file]
+ """.stripMargin)
+ // scalastyle:on println
+ System.exit(1)
+ }
+
+ val sc = new SparkContext(new SparkConf()
+ .set("spark.extraListeners", classOf[SaveExecutorInfo].getName)
+ .setAppName("yarn \"test app\" 'with quotes' and \\back\\slashes and
$dollarSigns"))
+ val conf = sc.getConf
+ val status = new File(args(0))
+ var result = "failure"
+ try {
+ val data = sc.parallelize(1 to 4, 4).collect().toSet
+ sc.listenerBus.waitUntilEmpty(WAIT_TIMEOUT_MILLIS)
+ data should be(Set(1, 2, 3, 4))
+ result = "success"
+ } finally {
+ Files.write(result, status, StandardCharsets.UTF_8)
+ sc.stop()
+ }
+
+ assert(false)
+ }
+}
+
private object YarnClusterDriver extends Logging with Matchers {
--- End diff --
In current YarnClusterDriver, it already has failures but not failed the
test.
On line 340: calling sc.parallelize() after sc.stop() will fail app with
error
```
ApplicationMaster: Final app status: FAILED, exitCode: 15, (reason: User
class threw exception: java.lang.IllegalStateException: Cannot call methods on
a stopped SparkContext.
```
---
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]