meisam commented on a change in pull request #48: [LIVY-41] Let users access 
sessions by session name
URL: https://github.com/apache/incubator-livy/pull/48#discussion_r140117359
 
 

 ##########
 File path: server/src/main/scala/org/apache/livy/sessions/SessionManager.scala
 ##########
 @@ -92,13 +94,29 @@ class SessionManager[S <: Session, R <: RecoveryMetadata : 
ClassTag](
   def register(session: S): S = {
     info(s"Registering new session ${session.id}")
     synchronized {
-      sessions.put(session.id, session)
+      // in InteractiveSessionServlet.createSession() and 
BatchSessionServlet.createSession(),
+      // Livy checks to make sure another session with the same name does not 
exist already.
+      // This case should not happen rarely.
+      // already exists. But looking up a session name and adding it to the 
set of existing sessions
+      // should happen atomically.
+      if (sessionsByName.contains(session.name)) {
+        val msg = s"Session ${session.name} already exists!"
+        error(msg)
+        delete(session)
 
 Review comment:
   This is an example use case we have here. I'll ask Prabhu to provide more.
   
   Team AAA has an ETL pipeline everyday at 1pm. The pipeline is a chain of 
jobs that work on the same dataset. They want to create a session on Livy and 
use it to run the pipeline. They also want to push the metrics and stats of 
their pipeline to alerting and monitoring services.
   This PR allows them to access the session, manage it, and monitor it with a 
human readable name like team_aaa_daily_etl.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to