Skip to content
Snippets Groups Projects
Commit 40eeef95 authored by Marcelo Vanzin's avatar Marcelo Vanzin Committed by Tom Graves
Browse files

[SPARK-15046][YARN] Parse value of token renewal interval correctly.

Use the config variable definition both to set and parse the value,
avoiding issues with code expecting the value in a different format.

Tested by running spark-submit with --principal / --keytab.

Author: Marcelo Vanzin <vanzin@cloudera.com>

Closes #13669 from vanzin/SPARK-15046.
parent 0ee9fd9e
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdenti
import org.apache.spark.{SparkConf, SparkException}
import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.internal.Logging
import org.apache.spark.internal.config._
import org.apache.spark.util.Utils
/**
......@@ -288,8 +289,7 @@ class SparkHadoopUtil extends Logging {
credentials: Credentials): Long = {
val now = System.currentTimeMillis()
val renewalInterval =
sparkConf.getLong("spark.yarn.token.renewal.interval", (24 hours).toMillis)
val renewalInterval = sparkConf.get(TOKEN_RENEWAL_INTERVAL).get
credentials.getAllTokens.asScala
.filter(_.getKind == DelegationTokenIdentifier.HDFS_DELEGATION_KIND)
......
......@@ -17,6 +17,8 @@
package org.apache.spark.internal
import java.util.concurrent.TimeUnit
import org.apache.spark.launcher.SparkLauncher
import org.apache.spark.network.util.ByteUnit
......@@ -80,6 +82,11 @@ package object config {
.doc("Name of the Kerberos principal.")
.stringConf.createOptional
private[spark] val TOKEN_RENEWAL_INTERVAL = ConfigBuilder("spark.yarn.token.renewal.interval")
.internal()
.timeConf(TimeUnit.MILLISECONDS)
.createOptional
private[spark] val EXECUTOR_INSTANCES = ConfigBuilder("spark.executor.instances")
.intConf
.createOptional
......
......@@ -243,11 +243,6 @@ package object config {
.toSequence
.createWithDefault(Nil)
private[spark] val TOKEN_RENEWAL_INTERVAL = ConfigBuilder("spark.yarn.token.renewal.interval")
.internal()
.timeConf(TimeUnit.MILLISECONDS)
.createOptional
/* Private configs. */
private[spark] val CREDENTIALS_FILE_PATH = ConfigBuilder("spark.yarn.credentials.file")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment