溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

StandaloneAppClient是什么

發布時間:2021-09-04 14:52:21 來源:億速云 閱讀:172 作者:chen 欄目:云計算

這篇文章主要介紹“StandaloneAppClient是什么”,在日常操作中,相信很多人在StandaloneAppClient是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”StandaloneAppClient是什么”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

StandaloneAppClient是什么?這個很容易搞混淆。其實StandaloneAppClient不是SparkApplication,它主要是用在ScheduleBackend中的。

獨立集群環境中,ScheduleBackend是用的StandaloneScheduleBackend,它繼承了CoarseGrainedSchedulerBackend類。

StandaloneScheduleBackend里面用了一個叫StandaloneAppClient的類,這個StandaloneAppClient很具有迷惑性,其實它的主要功能是替換CoarseGrainedSchedulerBackend的資源申請的方法,改為向Master申請資源,我們看看相關代碼片段就行了。

先看他啟動的時候:

private def tryRegisterAllMasters(): Array[JFuture[_]] = {
      for (masterAddress <- masterRpcAddresses) yield {
        registerMasterThreadPool.submit(new Runnable {
          override def run(): Unit = try {
            if (registered.get) {
              return
            }
            logInfo("Connecting to master " + masterAddress.toSparkURL + "...")
            val masterRef = rpcEnv.setupEndpointRef(masterAddress, Master.ENDPOINT_NAME)
            masterRef.send(RegisterApplication(appDescription, self))
          } catch {
          }
        })
      }
    }

向Master發送RegisterApplication消息,將本appDesc注冊給Master,這個和DriverDescription注冊到Master是有點區別的。

再比如資源申請的代碼:

 def requestTotalExecutors(requestedTotal: Int): Future[Boolean] = {
    if (endpoint.get != null && appId.get != null) {
      endpoint.get.ask[Boolean](RequestExecutors(appId.get, requestedTotal))
    } else {
      logWarning("Attempted to request executors before driver fully initialized.")
      Future.successful(false)
    }
  }

就是向Master發送RequestExecutor消息申請Executor資源。

到此,關于“StandaloneAppClient是什么”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女