Skip to content
Snippets Groups Projects
Commit 90ec643e authored by Andrew Or's avatar Andrew Or
Browse files

[HOT FIX] [YARN] Check whether `/lib` exists before listing its files

This is caused by a975dc32

Author: Andrew Or <andrew@databricks.com>

Closes #3589 from andrewor14/yarn-hot-fix and squashes the following commits:

a4fad5f [Andrew Or] Check whether lib directory exists before listing its files
parent 692f4937
No related branches found
No related tags found
No related merge requests found
...@@ -243,18 +243,21 @@ private[spark] trait ClientBase extends Logging { ...@@ -243,18 +243,21 @@ private[spark] trait ClientBase extends Logging {
val libsURI = new URI(libsDir) val libsURI = new URI(libsDir)
val jarLinks = ListBuffer.empty[String] val jarLinks = ListBuffer.empty[String]
if (libsURI.getScheme != LOCAL_SCHEME) { if (libsURI.getScheme != LOCAL_SCHEME) {
val localURI = getQualifiedLocalPath(libsURI).toUri() val localPath = getQualifiedLocalPath(libsURI)
val jars = FileSystem.get(localURI, hadoopConf).listFiles(new Path(localURI.getPath), false) val localFs = FileSystem.get(localPath.toUri, hadoopConf)
while (jars.hasNext) { if (localFs.exists(localPath)) {
val jar = jars.next() val jars = localFs.listFiles(localPath, /* recursive */ false)
val name = jar.getPath.getName while (jars.hasNext) {
if (name.startsWith("datanucleus-")) { val jar = jars.next()
// copy to remote and add to classpath val name = jar.getPath.getName
val src = jar.getPath if (name.startsWith("datanucleus-")) {
val destPath = copyFileToRemote(dst, src, replication) // copy to remote and add to classpath
distCacheMgr.addResource(fs, hadoopConf, destPath, val src = jar.getPath
localResources, LocalResourceType.FILE, name, statCache) val destPath = copyFileToRemote(dst, src, replication)
jarLinks += name distCacheMgr.addResource(localFs, hadoopConf, destPath,
localResources, LocalResourceType.FILE, name, statCache)
jarLinks += name
}
} }
} }
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment