Github user witgo commented on a diff in the pull request:
https://github.com/apache/spark/pull/2711#discussion_r19258226
--- Diff:
core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala ---
@@ -38,6 +40,19 @@ object CommandUtils extends Logging {
command.arguments
}
+ def buildEnvironment(command: Command,
+ env: Map[String, String] = sys.env): Map[String, String] = {
+ val libraryPathEntries = command.libraryPathEntries
+ if (libraryPathEntries.nonEmpty) {
+ val libraryPathName = Utils.libraryPathName
+ val cmdLibraryPath = command.environment.get(libraryPathName)
+ val libraryPaths = libraryPathEntries ++ cmdLibraryPath ++
env.get(libraryPathName)
+ command.environment + ((libraryPathName,
libraryPaths.mkString(File.pathSeparator)))
+ } else {
+ command.environment
+ }
+ }
+
--- End diff --
The command instance is created on different machines. Environment variable
cannot be used directly.
We can try to build a local Command instances:
```
def buildLocalCommand(
command: Command,
substituteArguments: String => String,
classPath: Seq[String] = Seq[String](),
env: Map[String, String] = sys.env): Command = {
val libraryPathEntries = command.libraryPathEntries
val newEnvironment = if (libraryPathEntries.nonEmpty) {
val libraryPathName = Utils.libraryPathName
val cmdLibraryPath = command.environment.get(libraryPathName)
val libraryPaths = libraryPathEntries ++ cmdLibraryPath ++
env.get(libraryPathName)
command.environment + ((libraryPathName,
libraryPaths.mkString(File.pathSeparator)))
} else {
command.environment
}
Command(
command.mainClass,
command.arguments.map(substituteArguments),
newEnvironment,
command.classPathEntries ++ classPath,
Seq[String](),
command.javaOpts)
}
```
---
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]