Skip to content

Commit

Permalink
Merge pull request #127 from hustfeiwang/KYUUBI-125
Browse files Browse the repository at this point in the history
KYUUBI-125 fix the error when create session in SparkSessionWithUGI fix #125
  • Loading branch information
yaooqinn committed Dec 6, 2018
2 parents 989068b + 1e204ba commit df1abd4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ class SparkSessionWithUGI(
conf.setAppName(appName)
configureSparkConf(sessionConf)
val totalWaitTime: Long = conf.getTimeAsSeconds(BACKEND_SESSTION_INIT_TIMEOUT)
val newContextThread = newContext()
try {
KyuubiHadoopUtil.doAs(user) {
newContext().start()
newContextThread.start()
val context =
Await.result(promisedSparkContext.future, Duration(totalWaitTime, TimeUnit.SECONDS))
_sparkSession = ReflectUtils.newInstance(
Expand All @@ -181,7 +182,9 @@ class SparkSessionWithUGI(
throw ke
} finally {
SparkSessionWithUGI.setFullyConstructed(userName)
newContext().join()
if (newContextThread.isAlive) {
newContextThread.join()
}
}

KyuubiServerMonitor.setListener(userName, new KyuubiServerListener(conf))
Expand Down

0 comments on commit df1abd4

Please sign in to comment.