CoarseGrainedExecutorBackend在运行中出现异常,将调用exitExecutor方法进行处理,处理以后系统退出。exitExecutor这个函数可以由其他子类重载来处理,executor执行的退出方式不同。例如:当executor挂掉了,后台程序可能不会让父进程也挂掉。如果需通知Driver,Driver将清理挂掉的executor的数据。
CoarseGrainedExecutorBackend的exitExecutor方法源码:
1. protected def exitExecutor(code: Int,
2. reason: String,
3. throwable:Throwable = null,
4. notifyDriver:Boolean = true) = {
5. val message = "Executorself-exiting due to : " + reason
6. if (throwable != null) {
7. logError(message, throwable)
8. } else {
9. logError(message)
10. }
11.
12. if (notify