Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fix jar path and add missing ones for spark jobs #14020

Merged
merged 4 commits into from
Feb 15, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,15 @@ trait SharedSparkContext extends FunSuite with BeforeAndAfterEach with BeforeAnd
}

private def getJarFilePath(root: String): String = {
for (platform <- List("linux-x86_64-cpu", "linux-x86_64-gpu", "osx-x86_64-cpu")) {
ashutosh-dwivedi-e3502 marked this conversation as resolved.
Show resolved Hide resolved
val jarFiles = new File(s"$root/$platform/target/").listFiles(new FileFilter {
override def accept(pathname: File) = {
pathname.getAbsolutePath.endsWith(".jar") &&
!pathname.getAbsolutePath.contains("javadoc") &&
!pathname.getAbsolutePath.contains("sources")
}
})
if (jarFiles != null && jarFiles.nonEmpty) {
return jarFiles.head.getAbsolutePath
val jarFiles = new File(s"$root/target/").listFiles(new FileFilter {
override def accept(pathname: File) = {
pathname.getAbsolutePath.endsWith(".jar") &&
!pathname.getAbsolutePath.contains("bundle") &&
ashutosh-dwivedi-e3502 marked this conversation as resolved.
Show resolved Hide resolved
!pathname.getAbsolutePath.contains("src")
}
})
if (jarFiles != null && jarFiles.nonEmpty) {
return jarFiles.head.getAbsolutePath
}
null
}
Expand All @@ -111,6 +109,8 @@ trait SharedSparkContext extends FunSuite with BeforeAndAfterEach with BeforeAnd
}
}

private def getNativeJars(root:String): String = new File(root).listFiles().map(_.toPath).mkString(",")

protected def buildLeNet(): MXNet = {
val workingDir = composeWorkingDirPath
val assemblyRoot = s"$workingDir/../assembly"
Expand All @@ -130,6 +130,8 @@ trait SharedSparkContext extends FunSuite with BeforeAndAfterEach with BeforeAnd
protected def buildMlp(): MXNet = {
val workingDir = composeWorkingDirPath
val assemblyRoot = s"$workingDir/../assembly"
val nativeRoot =s"$workingDir/../native/target/lib"

new MXNet()
.setBatchSize(128)
.setLabelName("softmax_label")
Expand All @@ -139,7 +141,7 @@ trait SharedSparkContext extends FunSuite with BeforeAndAfterEach with BeforeAnd
.setNumEpoch(10)
.setNumServer(1)
.setNumWorker(numWorkers)
.setExecutorJars(s"${getJarFilePath(assemblyRoot)},$getSparkJar")
.setExecutorJars(s"${getJarFilePath(assemblyRoot)},$getSparkJar,${getNativeJars(nativeRoot)}")
.setJava("java")
.setTimeout(0)
}
Expand Down