Skip to content

Commit

Permalink
Read conf once.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Oct 14, 2019
1 parent 6fffa9d commit 4c9118b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ private[spark] class ReliableCheckpointRDD[T: ClassTag](
locations.headOption.toList.flatMap(_.getHosts).filter(_ != "localhost")
}

private lazy val cachedExpireTime =
SparkEnv.get.conf.get(CACHE_CHECKPOINT_PREFERRED_LOCS_EXPIRE_TIME)

/**
* Return the locations of the checkpoint file associated with the given partition.
*/
protected override def getPreferredLocations(split: Partition): Seq[String] = {
val cachedExpireTime = SparkEnv.get.conf.get(CACHE_CHECKPOINT_PREFERRED_LOCS_EXPIRE_TIME)
if (cachedExpireTime.isDefined && cachedExpireTime.get > 0) {
cachedPreferredLocations.get(split)
} else {
Expand Down

0 comments on commit 4c9118b

Please sign in to comment.