当 YARN 上 运行 时,Spark 调度程序池如何工作?

How do Spark scheduler pools work when running on YARN?

我有混合的 Spark 版本(1.6、2.0、2.1),全部部署在 YARN (Hadoop 2.6.0 / CDH 5.5) 上。我试图保证某个应用程序永远不会缺少我们 YARN 集群上的资源,无论那里还有什么 运行ning。

我已经启用随机播放服务并设置了一些 Fair Scheduler Pools,如 Spark 文档中所述。我为我希望永远不会资源匮乏的高优先级应用程序创建了一个单独的池,并给了它 minShare 的资源:

<?xml version="1.0"?>
<allocations>
  <pool name="default">
    <schedulingMode>FAIR</schedulingMode>
    <weight>1</weight>
    <minShare>0</minShare>
  </pool>
  <pool name="high_priority">
    <schedulingMode>FAIR</schedulingMode>
    <weight>1</weight>
    <minShare>24</minShare>
  </pool>
</allocations>

当我在我们的 YARN 集群上 运行 一个 Spark 应用程序时,我可以看到我配置的池被识别:

17/04/04 11:38:20 INFO scheduler.FairSchedulableBuilder: Created pool default, schedulingMode: FAIR, minShare: 0, weight: 1
17/04/04 11:38:20 INFO scheduler.FairSchedulableBuilder: Created pool high_priority, schedulingMode: FAIR, minShare: 24, weight: 1

但是,我没有看到我的应用程序正在使用新的 high_priority 池,即使我在对 spark-submit 的调用中设置了 spark.scheduler.pool。所以这意味着当集群被常规 activity 固定时,我的高优先级应用程序没有获得它需要的资源:

17/04/04 11:39:49 INFO cluster.YarnScheduler: Adding task set 0.0 with 1 tasks
17/04/04 11:39:50 INFO scheduler.FairSchedulableBuilder: Added task set TaskSet_0 tasks to pool default
17/04/04 11:39:50 INFO spark.ExecutorAllocationManager: Requesting 1 new executor because tasks are backlogged (new desired total will be 1)
17/04/04 11:40:05 WARN cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources

我在这里错过了什么?我和我的同事尝试在 YARN 中启用抢占,但这并没有起到任何作用。然后我们意识到 YARN 中有一个与 Spark 调度程序池非常相似的概念,称为 YARN queues。所以现在我们不确定这两个概念是否有冲突。

我们怎样才能让我们的高优先级池按预期工作? Spark 调度程序池和 YARN 队列之间是否存在某种冲突?

有人 over on the spark-users list 澄清了一些事情,解释了为什么我没有得到我期望的结果:Spark 调度程序池用于管理 应用程序中的资源,而 YARN 队列是用于管理 个应用程序的资源。我需要后者,却错误地使用了前者。

Job Scheduling 下的 Spark 文档对此进行了解释。我只是被粗心的阅读和对 Spark 技术意义上的 "job"(即 Spark 应用程序中的操作)和 "job" 作为我的同事的混淆所困扰,我通常用它来表示应用程序提交到集群。