如何创建自定义的 apache Spark 调度程序?

How to create a custom apache Spark scheduler?

我有一个 p2p 网状节点网络。它有自己的平衡,给定一个任务 T 可以可靠地执行它(如果一个节点失败另一个将继续)。我的网状网络有 Java 和 Python api。我想知道让 Spark 调用我的 API 午餐任务需要哪些步骤?

  1. 看看现有的调度器(YARN 和 Mesos)是如何实现的。
  2. 为您的系统实施调度程序。
  3. 将您的更改贡献给 Apache Spark 项目。

天哪,这是一个非常宽泛的问题,但我同意丹尼尔的观点。如果您真的想要这样做,您可以先从:

开始
  1. Scheduler Backends,表示如下内容:

    Being a scheduler backend in Spark assumes a Apache Mesos-like model in which "an application" gets resource offers as machines become available and can launch tasks on them. Once a scheduler backend obtains the resource allocation, it can start executors.

  2. TaskScheduler,因为您需要了解任务的含义 被安排来构建一个调度器,其中提到了诸如 这个:

    A TaskScheduler gets sets of tasks (as TaskSets) submitted to it from the DAGScheduler for each stage, and is responsible for sending the tasks to the cluster, running them, retrying if there are failures, and mitigating stragglers.

    这里的一个重要概念是依赖非循环图(GDA), 在那里你可以看看它的 GitHub page.

    您还可以阅读 获得直觉。

  3. Spark Listeners — Intercepting Events from Spark 也可以来 在手:

    Spark Listeners intercept events from the Spark scheduler that are emitted over the course of execution of Spark applications.

    您可以先学习 练习:开发自定义 SparkListener 在 Scala 中监控 DAGScheduler 以检查您的理解情况。

总的来说,Mastering Apache Spark 2.0资源好像挺多的,这里就不一一列举了。


然后,你就得去见识一下这款游戏的最终boss,Spark的Scheduler GitHub page,感受一下。希望所有这些足以让您入门! :)