Skip to content

Commit 7b963dc

Browse files
committed
constructed classpath within a session using both the global jars and the session specific jars
1 parent 0670e4f commit 7b963dc

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

core/src/main/scala/org/apache/spark/executor/Executor.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,15 @@ private[spark] class Executor(
560560
override def run(): Unit = {
561561

562562
// Classloader isolation
563-
val isolatedSession = taskDescription.artifacts.state match {
563+
val (isolatedSession, files, jars, archives) = taskDescription.artifacts.state match {
564564
case Some(jobArtifactState) =>
565-
isolatedSessionCache.get(jobArtifactState.uuid, () => newSessionState(jobArtifactState))
566-
case _ => defaultSessionState
565+
(isolatedSessionCache.get(jobArtifactState.uuid, () => newSessionState(jobArtifactState)),
566+
taskDescription.artifacts.files ++ initialUserFiles,
567+
taskDescription.artifacts.jars ++ initialUserJars,
568+
taskDescription.artifacts.archives ++ initialUserArchives)
569+
case _ =>
570+
(defaultSessionState, taskDescription.artifacts.files, taskDescription.artifacts.jars,
571+
taskDescription.artifacts.archives)
567572
}
568573

569574
setMDCForTask(taskName, mdcProperties)
@@ -589,11 +594,8 @@ private[spark] class Executor(
589594
// requires access to properties contained within (e.g. for access control).
590595
Executor.taskDeserializationProps.set(taskDescription.properties)
591596

592-
updateDependencies(
593-
taskDescription.artifacts.files,
594-
taskDescription.artifacts.jars,
595-
taskDescription.artifacts.archives,
596-
isolatedSession)
597+
updateDependencies(files, jars, archives, isolatedSession)
598+
597599
// Always reset the thread class loader to ensure if any updates, all threads (not only
598600
// the thread that updated the dependencies) can update to the new class loader.
599601
Thread.currentThread.setContextClassLoader(isolatedSession.replClassLoader)

0 commit comments

Comments
 (0)