スカーラ(プログラム的な方法):
getExecutorStorageStatus
とgetExecutorMemoryStatus
の両方がドライバを含むエグゼキュータの数を返します。 以下のようなスニペットです。
/** Method that just returns the current active/registered executors
* excluding the driver.
* @param sc The spark context to retrieve registered executors.
* @return a list of executors each in the form of host:port.
*/
def currentActiveExecutors(sc: SparkContext): Seq[String] = {
val allExecutors = sc.getExecutorMemoryStatus.map(_._1)
val driverHost: String = sc.getConf.get("spark.driver.host")
allExecutors.filter(! _.split(":")(0).equals(driverHost)).toList
}
sc.getConf.getInt("spark.executor.instances", 1)
同様にあなたが同様にコア情報を得ることができます。.. spark.driver.cores
ドライバがこの値を持っている必要があり執行のための
sc.getConf.getAll.mkString("\n")
OR
sc.getConf.toDebugString
ほとんどspark.executor.cores
をすべてのプロパティを取得し、以下のように印刷します。
のPython:
Above methods getExecutorStorageStatus and getExecutorMemoryStatus, In python api were not implemented
EDIT しかしSparkSessionから露出Py4Jバインディングを使用してアクセスすることができます。
sc._jsc.sc().getExecutorMemoryStatus()
あなたは、SparkのUIに見ることができます。 http://:4040に行き、 "Executors"タブを押してください。これはクラスタ管理者によって異なります。 –
クリシュナ、あなたは手に入れられましたか?お気軽に質問してください –
テストできましたか? –