Skip to content

Commit 8885fff

Browse files
committed
Add spark.yarn.access.all.hadoopFileSystems
1 parent e2c7e09 commit 8885fff

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnSparkHadoopUtil.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,12 @@ object YarnSparkHadoopUtil {
200200
.map(new Path(_).getFileSystem(hadoopConf))
201201
.getOrElse(FileSystem.get(hadoopConf))
202202

203+
val accessAllFileSystem = sparkConf.get(FILESYSTEMS_TO_ACCESS_ALL)
204+
203205
// Add the list of available namenodes for all namespaces in HDFS federation.
204206
// If ViewFS is enabled, this is skipped as ViewFS already handles delegation tokens for its
205207
// namespaces.
206-
val hadoopFilesystems = if (stagingFS.getScheme == "viewfs") {
208+
val hadoopFilesystems = if (accessAllFileSystem || stagingFS.getScheme == "viewfs") {
207209
Set.empty
208210
} else {
209211
val nameservices = hadoopConf.getTrimmedStrings("dfs.nameservices")

resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/config.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ package object config {
243243
"that hosts fs.defaultFS does not need to be listed here.")
244244
.fallbackConf(NAMENODES_TO_ACCESS)
245245

246+
private[spark] val FILESYSTEMS_TO_ACCESS_ALL =
247+
ConfigBuilder("spark.yarn.access.all.hadoopFileSystems")
248+
.doc("Whether to get tokens of all filesystem configured in hdfs-site.xml. " +
249+
"The default value is false. " +
250+
"If true, a filesystem failed to get token may cause the entire job failed.")
251+
.booleanConf
252+
.createWithDefault(false)
253+
246254
/* Rolled log aggregation configuration. */
247255

248256
private[spark] val ROLLED_LOG_INCLUDE_PATTERN =

0 commit comments

Comments
 (0)