Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ class Checkpoint(@transient ssc: StreamingContext, val checkpointTime: Time)
val sparkConfPairs = ssc.conf.getAll

def createSparkConf(): SparkConf = {
val reloadConfs = List(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you call this propertiesToReload? It's confusing to have reloadConfs here and newReloadConf down there when they're not describing the same thing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, please add a short comment here to explain why this is necessary.

"spark.master",
"spark.yarn.keytab",
"spark.yarn.principal")

val newSparkConf = new SparkConf(loadDefaults = false).setAll(sparkConfPairs)
.remove("spark.driver.host")
.remove("spark.driver.port")
val newMasterOption = new SparkConf(loadDefaults = true).getOption("spark.master")
newMasterOption.foreach { newMaster => newSparkConf.setMaster(newMaster) }
val newReloadConf = new SparkConf(loadDefaults = true)
reloadConfs.foreach { conf =>
newReloadConf.getOption(conf)
.foreach(confValue => newSparkConf.set(conf, confValue))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style

propertiesToReload.foreach { prop =>
  newReloadConf.getOption(prop).foreach { value =>
    newSparkConf.set(prop, value)
  }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the code style

}
newSparkConf
}

Expand Down