aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/scala/spark/deploy/client/TestClient.scala
blob: f195082808aab54bd6a30bbd923b58efc89103dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package spark.deploy.client

import spark.util.AkkaUtils
import spark.{Logging, Utils}
import spark.deploy.{Command, ApplicationDescription}

private[spark] object TestClient {

  class TestListener extends ClientListener with Logging {
    def connected(id: String) {
      logInfo("Connected to master, got app ID " + id)
    }

    def disconnected() {
      logInfo("Disconnected from master")
      System.exit(0)
    }

    def executorAdded(id: String, workerId: String, hostPort: String, cores: Int, memory: Int) {}

    def executorRemoved(id: String, message: String, exitStatus: Option[Int]) {}
  }

  def main(args: Array[String]) {
    val url = args(0)
    val (actorSystem, port) = AkkaUtils.createActorSystem("spark", Utils.localIpAddress, 0)
    val desc = new ApplicationDescription(
      "TestClient", 1, 512, Command("spark.deploy.client.TestExecutor", Seq(), Map()), "dummy-spark-home", "ignored")
    val listener = new TestListener
    val client = new Client(actorSystem, url, desc, listener)
    client.start()
    actorSystem.awaitTermination()
  }
}