Skip to content

Commit

Permalink
SPARK-1174 Add port configuration for HttpFileServer
Browse files Browse the repository at this point in the history
Uses spark.fileserver.port
  • Loading branch information
ash211 committed Jul 25, 2014
1 parent 1c0981a commit 49ee29b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/src/main/scala/org/apache/spark/HttpFileServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ private[spark] class HttpFileServer(securityManager: SecurityManager) extends Lo
var httpServer : HttpServer = null
var serverUri : String = null

def initialize() {
def initialize(port: Option[Int]) {
baseDir = Utils.createTempDir()
fileDir = new File(baseDir, "files")
jarDir = new File(baseDir, "jars")
fileDir.mkdir()
jarDir.mkdir()
logInfo("HTTP File server directory is " + baseDir)
httpServer = new HttpServer(baseDir, securityManager)
httpServer = if (port.isEmpty) {
new HttpServer(baseDir, securityManager)
} else {
new HttpServer(baseDir, securityManager, port.get)
}
httpServer.start()
serverUri = httpServer.uri
logDebug("HTTP file server started at: " + serverUri)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/SparkEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ object SparkEnv extends Logging {
val httpFileServer =
if (isDriver) {
val server = new HttpFileServer(securityManager)
server.initialize()
server.initialize(conf.getOption("spark.fileserver.port").map(_.toInt))
conf.set("spark.fileserver.uri", server.serverUri)
server
} else {
Expand Down

0 comments on commit 49ee29b

Please sign in to comment.