Driver状态发生改变处理机制
DriverStateChanged( )
/**
* leen
* Driver的状态发生改变
*/
case DriverStateChanged(driverId, state, exception) =>
//如果DriverState的状态是:ERROR、FINISHED、KILLED、FAILED则调用removeDriver的方法,移除Driver
state match {
case DriverState.ERROR | DriverState.FINISHED | DriverState.KILLED | DriverState.FAILED =>
removeDriver(driverId, state, exception)
case _ =>
throw new Exception(s"Received unexpected state update for driver $driverId: $state")
}
removeDriver( )
private def removeDriver(
driverId: String,
finalState: DriverState,
exception: Option[Exception]) {
// leen
// 1.用scala 的高阶函数find() 找到driverid对应