【问题标题】:Get number of active spark executors with sparklyr and R使用 sparklyr 和 R 获取活动火花执行器的数量
【发布时间】:2018-12-19 16:16:42
【问题描述】:

当通过 sparklyr 启动 spark 集群时,我注意到所有执行程序可能需要 10-60 秒才能上线。

现在我使用Sys.sleep(60) 让他们有时间上线,但有时需要更长的时间,有时更短。我想要一种编程方式来调整这个时间差异,类似于关于 Python 的this question。所以我想我想通过sparklyr 传递getExecutorMemoryStatus,但我不知道该怎么做。

要查看我看到的内容,请运行以下代码以启动 yarn-client spark 连接,并检查 Yarn UI。在Event Timeline中我们可以看到每个executor上线的时间。

spark_config <- spark_config()
spark_config$spark.executor.memory <- "11G"
spark_config$`sparklyr.shell.driver-memory` <- "11G"
spark_config$spark.dynamicAllocation.enabled <- FALSE
spark_config$`spark.yarn.executor.memoryOverhead` <- "1G"
spark_config$spark.executor.instances <- 32

sc <- spark_connect(master = "yarn-client", config = spark_config)

【问题讨论】:

    标签: r apache-spark sparklyr


    【解决方案1】:

    所以我想我想通过 sparklyr 传递 getExecutorMemoryStatus,但我不知道该怎么做。

    你必须检索SparkContext对象:

    sc <- spark_connect(...)
    
    spark_context(sc) %>%
      ...
    

    然后invoke方法:

     ... %>% invoke("getExecutorMemoryStatus")
    

    一起:

    spark_context(sc) %>% 
      invoke("getExecutorMemoryStatus") %>% 
      names()
    

    应该给你一个活跃的执行者列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-15
      • 1970-01-01
      • 2021-01-08
      • 1970-01-01
      • 1970-01-01
      • 2016-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多