File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
core/src/main/scala/org/apache/spark/scheduler Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1717
1818package org .apache .spark .scheduler
1919
20- import scala .util .Try
20+ import scala .util .{ Failure , Success , Try }
2121
2222import org .apache .spark .Logging
2323
@@ -38,8 +38,8 @@ private[spark] class JobWaiter[T](
3838 @ volatile
3939 private var _originalHandler : SignalHandler = null
4040
41- def attachSigintHandler (): SignalHandler = {
42- Signal .handle(sigint, new SignalHandler with Logging {
41+ def attachSigintHandler (): Unit = {
42+ _originalHandler = Signal .handle(sigint, new SignalHandler with Logging {
4343 override def handle (signal : Signal ): Unit = {
4444 logInfo(" Cancelling running job.. This might take some time, so be patient. " +
4545 " Press Ctrl-C again to kill JVM." )
@@ -97,11 +97,14 @@ private[spark] class JobWaiter[T](
9797 }
9898
9999 def awaitResult (): JobResult = synchronized {
100- Try (_originalHandler = attachSigintHandler())
100+ val attachTry = Try ( attachSigintHandler())
101101 while (! _jobFinished) {
102102 this .wait()
103103 }
104- Try (detachSigintHandler())
104+ attachTry match {
105+ case _ : Success [_] => detachSigintHandler()
106+ case _ : Failure [_] => // Ignore error. Signal handler is on a best effort basis.
107+ }
105108 return jobResult
106109 }
107110}
You can’t perform that action at this time.
0 commit comments