Spark分析之Worker

override def preStart() {
webUi = new WorkerWebUI(this, workDir, Some(webUiPort))
webUi.bind() //创建并绑定UI
registerWithMaster() //注册到Master
} def tryRegisterAllMasters() {
for (masterUrl <- masterUrls) {
logInfo("Connecting to master " + masterUrl + "...")
val actor = context.actorSelection(Master.toAkkaUrl(masterUrl))
actor ! RegisterWorker(workerId, host, port, cores, memory, webUi.boundPort, publicAddress)
}
}

Worker的主要功能:

1、向master注册

2、处理事件

RegisteredWorker/RegisterWorkerFailed
LaunchExecutor/ExecutorStateChanged/KillExecutor
LaunchDriver/KillDriver
WorkDirCleanup/MasterChanged/Heartbeat/DriverStateChanged/RequestWorkerState

上一篇:Javascript模块化开发,使用模块化脚本加载工具RequireJS,提高你代码的速度和质量。


下一篇:convertView