-
Notifications
You must be signed in to change notification settings - Fork 624
[LIVY-41] Let users access sessions by session name #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8487bbb
3f28b61
dc644c7
967e896
0a0e1cf
c16685a
c34eca8
5cbef17
c995ab2
9f3915d
ecde1fd
57ec81a
2065619
962e82e
3527ef7
9c64c81
516a880
334b165
ef56dea
41ff9aa
d673baf
a43a968
35c34d7
518bfdf
f61c3d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ import org.apache.livy.utils.{AppInfo, SparkApp, SparkAppListener, SparkProcessB | |
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| case class BatchRecoveryMetadata( | ||
| id: Int, | ||
| name: Option[String], | ||
| appId: Option[String], | ||
| appTag: String, | ||
| owner: String, | ||
|
|
@@ -53,6 +54,7 @@ object BatchSession extends Logging { | |
|
|
||
| def create( | ||
| id: Int, | ||
| name: Option[String], | ||
| request: CreateBatchRequest, | ||
| livyConf: LivyConf, | ||
| accessManager: AccessManager, | ||
|
|
@@ -110,6 +112,7 @@ object BatchSession extends Logging { | |
|
|
||
| new BatchSession( | ||
| id, | ||
| name, | ||
| appTag, | ||
| SessionState.Starting, | ||
| livyConf, | ||
|
|
@@ -126,6 +129,7 @@ object BatchSession extends Logging { | |
| mockApp: Option[SparkApp] = None): BatchSession = { | ||
| new BatchSession( | ||
| m.id, | ||
| m.name, | ||
| m.appTag, | ||
| SessionState.Recovering, | ||
| livyConf, | ||
|
|
@@ -140,27 +144,33 @@ object BatchSession extends Logging { | |
|
|
||
| class BatchSession( | ||
| id: Int, | ||
| name: Option[String], | ||
| appTag: String, | ||
| initialState: SessionState, | ||
| livyConf: LivyConf, | ||
| owner: String, | ||
| override val proxyUser: Option[String], | ||
| sessionStore: SessionStore, | ||
| sparkApp: BatchSession => SparkApp) | ||
| extends Session(id, owner, livyConf) with SparkAppListener { | ||
| extends Session(id, name, owner, livyConf) with SparkAppListener { | ||
| import BatchSession._ | ||
|
|
||
| protected implicit def executor: ExecutionContextExecutor = ExecutionContext.global | ||
|
|
||
| private[this] var _state: SessionState = initialState | ||
| private val app = sparkApp(this) | ||
|
|
||
| private var app: Option[SparkApp] = None | ||
|
|
||
| override def state: SessionState = _state | ||
|
|
||
| override def logLines(): IndexedSeq[String] = app.log() | ||
| override def logLines(): IndexedSeq[String] = app.map(_.log()).getOrElse(IndexedSeq.empty[String]) | ||
|
|
||
| override def start(): Unit = { | ||
| app = Option(sparkApp(this)) | ||
| } | ||
|
|
||
| override def stopSession(): Unit = { | ||
| app.kill() | ||
| app.foreach(_.kill()) | ||
| } | ||
|
|
||
| override def appIdKnown(appId: String): Unit = { | ||
|
|
@@ -187,5 +197,5 @@ class BatchSession( | |
| override def infoChanged(appInfo: AppInfo): Unit = { this.appInfo = appInfo } | ||
|
|
||
| override def recoveryMetadata: RecoveryMetadata = | ||
| BatchRecoveryMetadata(id, appId, appTag, owner, proxyUser) | ||
| BatchRecoveryMetadata(id, name, appId, appTag, owner, proxyUser) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @meisam what if old recovery metadata which doesn't have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you suggest? Should we assign such sessions auto-generated names on recovery? Or should we leave them without a name?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm saying with your changes, if new Livy server tries to recover from old data, what will be happened? Will it be failed? Since the old recovery data doesn't have a session name field, so we could offer an auto-generated name, but we should not fail such scenario.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add test cases to confirm that Livy can recover from old data. |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're assuming that a string with all digits is an ID and not a name. I don't see that enforced when creating a session?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to force session names to have at least one non-digit character.