Skip to content

Commit 6963bbc

Browse files
Schedule renewal in AM before starting user class. Else, a restarted AM cannot access HDFS if the user class tries to.
1 parent 072659e commit 6963bbc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ private[spark] class ApplicationMaster(
131131
// a new AMDelegationTokenRenewer
132132
if (sparkConf.contains("spark.yarn.credentials.file")) {
133133
delegationTokenRenewerOption = Some(new AMDelegationTokenRenewer(sparkConf, yarnConf))
134+
// If a principal and keytab have been set, use that to create new credentials for executors
135+
// periodically
136+
delegationTokenRenewerOption.foreach(_.scheduleLoginFromKeytab())
134137
}
135138

136139
if (isClusterMode) {
@@ -272,9 +275,6 @@ private[spark] class ApplicationMaster(
272275
sc.getConf.get("spark.driver.port"),
273276
isClusterMode = true)
274277
registerAM(sc.ui.map(_.appUIAddress).getOrElse(""), securityMgr)
275-
// If a principal and keytab have been set, use that to create new credentials for executors
276-
// periodically
277-
delegationTokenRenewerOption.foreach(_.scheduleLoginFromKeytab())
278278
userClassThread.join()
279279
}
280280
}

0 commit comments

Comments
 (0)