Skip to content

Commit

Permalink
Support SessionManager coroutine methods
Browse files Browse the repository at this point in the history
  • Loading branch information
caleblf authored and oschuett committed Sep 18, 2019
1 parent c6171b2 commit 052e9a0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions appmode/server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler, FilesRedirectHandler, path_regex
import notebook.notebook.handlers as orig_handler
from tornado import web
from tornado import web, gen
from traitlets.config import LoggingConfigurable
from traitlets import Bool, Unicode

Expand Down Expand Up @@ -87,14 +87,21 @@ def get(self, path):

#===========================================================================
@web.authenticated
@gen.coroutine
def delete(self, path):
path = path.strip('/')
self.log.info('Appmode deleting: %s', path)

# delete session, including the kernel
sm = self.session_manager
s = sm.get_session(path=path)
sm.delete_session(session_id=s['id'])
if gen.is_coroutine_function(sm.get_session):
s = yield sm.get_session(path=path)
else:
s = sm.get_session(path=path)
if gen.is_coroutine_function(sm.delete_session):
yield sm.delete_session(session_id=s['id'])
else:
sm.delete_session(session_id=s['id'])

# delete tmp copy
cm = self.contents_manager
Expand Down

0 comments on commit 052e9a0

Please sign in to comment.