File tree Expand file tree Collapse file tree
main/scala/org/apache/kyuubi/session
test/scala/org/apache/kyuubi/server/api/v1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import scala.collection.JavaConverters._
2323
2424import org .apache .kyuubi .client .util .BatchUtils ._
2525import org .apache .kyuubi .config .{KyuubiConf , KyuubiReservedKeys }
26- import org .apache .kyuubi .config .KyuubiReservedKeys .KYUUBI_BATCH_PRIORITY
26+ import org .apache .kyuubi .config .KyuubiReservedKeys .{ KYUUBI_BATCH_PRIORITY , KYUUBI_SESSION_CONNECTION_URL_KEY }
2727import org .apache .kyuubi .engine .KyuubiApplicationManager
2828import org .apache .kyuubi .engine .spark .SparkProcessBuilder
2929import org .apache .kyuubi .events .{EventBus , KyuubiSessionEvent }
@@ -54,6 +54,8 @@ class KyuubiBatchSession(
5454 conf,
5555 sessionManager) {
5656 override val sessionType : SessionType = SessionType .BATCH
57+ override val connectionUrl : String =
58+ metadata.map(_.kyuubiInstance).getOrElse(conf.getOrElse(KYUUBI_SESSION_CONNECTION_URL_KEY , " " ))
5759
5860 override val handle : SessionHandle = {
5961 val batchId = metadata.map(_.identifier).getOrElse(conf(KYUUBI_BATCH_ID_KEY ))
Original file line number Diff line number Diff line change @@ -312,18 +312,7 @@ class KyuubiSessionManager private (name: String) extends SessionManager(name) {
312312 kyuubiInstance,
313313 0 ,
314314 Int .MaxValue ).map { metadata =>
315- createBatchSession(
316- metadata.username,
317- " anonymous" ,
318- metadata.ipAddress,
319- metadata.requestConf,
320- metadata.engineType,
321- Option (metadata.requestName),
322- metadata.resource,
323- metadata.className,
324- metadata.requestArgs,
325- Some (metadata),
326- fromRecovery = true )
315+ createBatchSessionFromRecovery(metadata)
327316 }).getOrElse(Seq .empty)
328317 }
329318 }
@@ -341,25 +330,26 @@ class KyuubiSessionManager private (name: String) extends SessionManager(name) {
341330 getBatchMetadata(batchId)
342331 .filter(m =>
343332 m.kyuubiInstance == kyuubiInstance && batchStatesToRecovery.contains(m.opState))
344- .flatMap { metadata =>
345- Some (
346- createBatchSession(
347- metadata.username,
348- " anonymous" ,
349- metadata.ipAddress,
350- metadata.requestConf,
351- metadata.engineType,
352- Option (metadata.requestName),
353- metadata.resource,
354- metadata.className,
355- metadata.requestArgs,
356- Some (metadata),
357- fromRecovery = true ))
358- }
333+ .flatMap { metadata => Some (createBatchSessionFromRecovery(metadata)) }
359334 }
360335 }
361336 }
362337
338+ private def createBatchSessionFromRecovery (metadata : Metadata ): KyuubiBatchSession = {
339+ createBatchSession(
340+ metadata.username,
341+ " anonymous" ,
342+ metadata.ipAddress,
343+ metadata.requestConf,
344+ metadata.engineType,
345+ Option (metadata.requestName),
346+ metadata.resource,
347+ metadata.className,
348+ metadata.requestArgs,
349+ Some (metadata),
350+ fromRecovery = true )
351+ }
352+
363353 def reassignBatchSessions (
364354 kyuubiInstance : String ,
365355 newKyuubiInstance : String ): Seq [String ] = {
Original file line number Diff line number Diff line change @@ -714,12 +714,12 @@ abstract class BatchesResourceSuiteBase extends KyuubiFunSuite
714714 assert(session2.createTime === batchMetadata2.createTime)
715715
716716 eventually(timeout(10 .seconds)) {
717- assert( session1.batchJobSubmissionOp.getStatus.state === OperationState . RUNNING ||
718- session1.batchJobSubmissionOp.getStatus.state === OperationState .FINISHED )
717+ val batch1State = session1.batchJobSubmissionOp.getStatus.state
718+ assert(batch1State === OperationState .RUNNING || OperationState .isTerminal(batch1State) )
719719 assert(session1.batchJobSubmissionOp.builder.processLaunched)
720720
721- assert( session2.batchJobSubmissionOp.getStatus.state === OperationState . RUNNING ||
722- session2.batchJobSubmissionOp.getStatus.state === OperationState .FINISHED )
721+ val batch2State = session2.batchJobSubmissionOp.getStatus.state
722+ assert(batch2State === OperationState .RUNNING || OperationState .isTerminal(batch2State) )
723723 assert(! session2.batchJobSubmissionOp.builder.processLaunched)
724724 }
725725
You can’t perform that action at this time.
0 commit comments