diff options
author | Charles Allen <charles@allen-net.com> | 2016-04-13 16:02:49 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-04-13 16:02:49 +0100 |
commit | dd11e401e45563b4bdc9829f5d23b68dacac8caf (patch) | |
tree | a51d9caa13719e666f0a8ac4ba05b602275dea4d | |
parent | 23f93f559cbe5436df3bad75f4ffa1219b0d6968 (diff) | |
download | spark-dd11e401e45563b4bdc9829f5d23b68dacac8caf.tar.gz spark-dd11e401e45563b4bdc9829f5d23b68dacac8caf.tar.bz2 spark-dd11e401e45563b4bdc9829f5d23b68dacac8caf.zip |
[SPARK-14537][CORE] Make TaskSchedulerImpl waiting fail if context is shut down
This patch makes the postStartHook throw an IllegalStateException if the SparkContext is shutdown while it is waiting for the backend to be ready
Author: Charles Allen <charles@allen-net.com>
Closes #12301 from drcrallen/SPARK-14537.
-rw-r--r-- | core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala b/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala index daed2ff50e..c3159188d9 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala @@ -571,6 +571,11 @@ private[spark] class TaskSchedulerImpl( return } while (!backend.isReady) { + // Might take a while for backend to be ready if it is waiting on resources. + if (sc.stopped.get) { + // For example: the master removes the application for some reason + throw new IllegalStateException("Spark context stopped while waiting for backend") + } synchronized { this.wait(100) } |