Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3233#discussion_r24357329
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -28,21 +30,31 @@ import org.apache.spark.util.{AkkaUtils, Utils}
     object DriverWrapper {
       def main(args: Array[String]) {
         args.toList match {
    -      case workerUrl :: mainClass :: extraArgs =>
    +      case workerUrl :: userJar :: mainClass :: extraArgs =>
             val conf = new SparkConf()
             val (actorSystem, _) = AkkaUtils.createActorSystem("Driver",
               Utils.localHostName(), 0, conf, new SecurityManager(conf))
             actorSystem.actorOf(Props(classOf[WorkerWatcher], workerUrl), name 
= "workerWatcher")
     
    +        val currentLoader = Thread.currentThread.getContextClassLoader
    +        val userJarUrl = new File(userJar).toURI().toURL()
    +        val loader =
    +          if (sys.props.getOrElse("spark.driver.userClassPathFirst", 
"false").toBoolean) {
    +            new ChildFirstURLClassLoader(Array(userJarUrl), currentLoader)
    +          } else {
    +            new MutableURLClassLoader(Array(userJarUrl), currentLoader)
    +          }
    +        Thread.currentThread.setContextClassLoader(loader)
    +
             // Delegate to supplied main class
    -        val clazz = Class.forName(args(1))
    +        val clazz = Class.forName(mainClass, true, loader)
             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.err.println("Usage: DriverWrapper <workerUrl> <userJar> 
<driverMainClass> [options]")
    --- End diff --
    
    Is this object supposed to be public in the first place? Seems like it's 
only used through SparkSubmit (much like Yarn's `Client`, although that one is 
public only for backwards compatibility).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to