瞌睡中的葡萄虎

博客园 首页 新随笔 联系 订阅 管理
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

posted on 2014-07-05 16:20  瞌睡中的葡萄虎  阅读(358)  评论(0编辑  收藏  举报