Github user vanzin commented on a diff in the pull request: https://github.com/apache/spark/pull/6752#discussion_r32436071 --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala --- @@ -1183,6 +1187,29 @@ object Client extends Logging { YarnSparkHadoopUtil.addPathToEnvironment(env, Environment.CLASSPATH.name, path) /** + * Returns the path to be sent to the NM for a local path string. + * + * This method uses two configuration values: + * + * - spark.yarn.config.localPath: a string that identifies a portion of the input path that may + * only be valid in the local process. + * - spark.yarn.config.clusterPath: a string with which to replace the local path. This may + * contain, for example, env variable references, which will be expanded by the NMs when + * starting containers. + * + * If either config is not available, the input path is returned. + */ + def getClusterPath(conf: SparkConf, path: String): String = { + val localPath = conf.get("spark.yarn.config.localPath", null) + val clusterPath = conf.get("spark.yarn.config.clusterPath", null) + if (localPath != null && clusterPath != null) { + path.replace(localPath, clusterPath) --- End diff -- The problem is that configs such as `SPARK_DIST_CLASSPATH` may contain multiple instances of the path. So either you have to do this (which is simpler but in some really rare cases might cause an issue) or you have to parse classpaths (i.e. break them down into individual entries) and perform a prefix replacement on each entry.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org