Skip to content

Commit

Permalink
fix DriverLogServer address
Browse files Browse the repository at this point in the history
  • Loading branch information
allwefantasy committed Apr 14, 2020
1 parent 313dc03 commit e4ee6d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.apache.spark.{MLSQLSparkUtils, SparkEnv}
import tech.mlsql.common.utils.base.TryTool
import tech.mlsql.common.utils.distribute.socket.server.{Request, Response, SocketServerInExecutor, SocketServerSerDer}
import tech.mlsql.common.utils.log.Logging
import tech.mlsql.common.utils.net.NetTool
import tech.mlsql.common.utils.network.NetUtils

/**
Expand Down Expand Up @@ -53,14 +54,8 @@ class DriverLogServer[T](taskContextRef: AtomicReference[T]) extends SocketServe
}

override def host: String = {
if (SparkEnv.get == null) {
//When SparkEnv.get is null, the program may run in a test
//So return local address would be ok.
"127.0.0.1"
} else {
if (MLSQLSparkUtils.rpcEnv().address == null) NetUtils.getHost
else MLSQLSparkUtils.rpcEnv().address.host
}
if (SparkEnv.get == null || MLSQLSparkUtils.rpcEnv().address == null) NetTool.localHostName()
else MLSQLSparkUtils.rpcEnv().address.host
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class WriteLog(conf: Map[String, String]) extends Logging {
val host = conf("spark.mlsql.log.driver.host")
val port = conf("spark.mlsql.log.driver.port")
val token = conf("spark.mlsql.log.driver.token")
val socket = new Socket(host, port.toInt)

logInfo(s"Init WriteLog in executor. The target DriverLogServer is ${host}:${port} with token ${token}")
val socket = new Socket(host, port.toInt)

def write(in: Iterator[String], params: Map[String, String]) = {
val dOut = new DataOutputStream(socket.getOutputStream)
Expand Down

0 comments on commit e4ee6d3

Please sign in to comment.