Skip to content

Commit

Permalink
Merge pull request alteryx#174 from ahirreddy/master
Browse files Browse the repository at this point in the history
Write Spark UI url to driver file on HDFS

This makes the SIMR code path simpler

(cherry picked from commit ed25105)
Signed-off-by: Reynold Xin <rxin@apache.org>
  • Loading branch information
mateiz authored and rxin committed Nov 18, 2013
1 parent 8823057 commit 37126e8
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ private[spark] class SimrSchedulerBackend(
val tmpPath = new Path(driverFilePath + "_tmp")
val filePath = new Path(driverFilePath)

val uiFilePath = driverFilePath + "_ui"
val tmpUiPath = new Path(uiFilePath + "_tmp")
val uiPath = new Path(uiFilePath)

val maxCores = System.getProperty("spark.simr.executor.cores", "1").toInt

override def start() {
Expand All @@ -49,23 +45,17 @@ private[spark] class SimrSchedulerBackend(

logInfo("Writing to HDFS file: " + driverFilePath)
logInfo("Writing Akka address: " + driverUrl)
logInfo("Writing to HDFS file: " + uiFilePath)
logInfo("Writing Spark UI Address: " + sc.ui.appUIAddress)

// Create temporary file to prevent race condition where executors get empty driverUrl file
val temp = fs.create(tmpPath, true)
temp.writeUTF(driverUrl)
temp.writeInt(maxCores)
temp.writeUTF(sc.ui.appUIAddress)
temp.close()

// "Atomic" rename
fs.rename(tmpPath, filePath)

// Write Spark UI Address to file
val uiTemp = fs.create(tmpUiPath, true)
uiTemp.writeUTF(sc.ui.appUIAddress)
uiTemp.close()
fs.rename(tmpUiPath, uiPath)
}

override def stop() {
Expand Down

0 comments on commit 37126e8

Please sign in to comment.