Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Style fixes
  • Loading branch information
pwendell committed Mar 12, 2014
commit 9637d2110b4566e6f5db1ee67feb8c8ce3837e7a
9 changes: 5 additions & 4 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -782,17 +782,18 @@ class SparkContext(
path
}

// Add jar to driver class loader so it is available for driver, even if it is not on the classpath
// Add jar to driver class loader so it is available for driver,
// even if it is not on the classpath
uri.getScheme match {
case null | "file" | "local" =>
// Assume file exists on current (driver) node as well. Unlike executors, driver doesn't need to
// download the jar since it's local.
// Assume file exists on current (driver) node as well. Unlike executors, driver
// doesn't need to download the jar since it's local.
addUrlToDriverLoader(new URL("file:" + uri.getPath))
case "http" | "https" | "ftp" =>
// Should be handled by the URLClassLoader, pass along entire URL
addUrlToDriverLoader(new URL(path))
case other =>
logWarning("This URI scheme for URI " + path + " is not supported by the driver class loader")
logWarning(s"This URI scheme for URI $path is not supported by the driver class loader")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a poor way to handle this case. Why don't we create a ClassLoader from HDFS or whatever the other URI scheme is? In general if some URI scheme is supported on the workers, it should also be supported on the driver.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option BTW would be to throw an exception, since the user explicitly enabled loading JARs in the driver. In general logging a warning and hoping the user will notice it is not great.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes true. At the minimum will replace with an exception.

}
}
if (key != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private[spark] class TaskResultGetter(sparkEnv: SparkEnv, scheduler: TaskSchedul
} catch {
case cnf: ClassNotFoundException =>
val loader = Thread.currentThread.getContextClassLoader
taskSetManager.abort("ClassNotFound [" + cnf.getMessage + "] with classloader: " + loader)
taskSetManager.abort(s"ClassNotFound [${cnf.getMessage}] with classloader: " + loader)
case ex: Throwable =>
taskSetManager.abort("Exception while deserializing and fetching task: %s".format(ex))
}
Expand Down