blob: 1640d5fee0f77404fc93c884bd2c8ecd8212d54b (
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
|
package org.apache.spark.deploy.worker
import akka.actor._
import org.apache.spark.SparkConf
import org.apache.spark.util.{AkkaUtils, Utils}
/**
* Utility object for launching driver programs such that they share fate with the Worker process.
*/
object DriverWrapper {
def main(args: Array[String]) {
args.toList match {
case workerUrl :: mainClass :: extraArgs =>
val (actorSystem, _) = AkkaUtils.createActorSystem("Driver",
Utils.localHostName(), 0, false, new SparkConf())
actorSystem.actorOf(Props(classOf[WorkerWatcher], workerUrl), name = "workerWatcher")
// Delegate to supplied main class
val clazz = Class.forName(args(1))
val mainMethod = clazz.getMethod("main", classOf[Array[String]])
mainMethod.invoke(null, extraArgs.toArray[String])
actorSystem.shutdown()
case _ =>
System.err.println("Usage: DriverWrapper <workerUrl> <driverMainClass> [options]")
System.exit(-1)
}
}
}
|