Skip to content

Commit

Permalink
Fix SessionHandler call to start kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-bates committed Oct 10, 2019
1 parent fa2d6b3 commit 1ab14b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jupyter_server/services/sessions/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ def patch(self, session_id):
changes['kernel_id'] = kernel_id
elif model['kernel'].get('name') is not None:
kernel_name = model['kernel']['name']
kernel_id = sm.start_kernel_for_session(
kernel_id = yield maybe_future(sm.start_kernel_for_session(
session_id, kernel_name=kernel_name, name=before['name'],
path=before['path'], type=before['type'])
path=before['path'], type=before['type']))
changes['kernel_id'] = kernel_id

yield maybe_future(sm.update_session(session_id, **changes))
Expand Down
12 changes: 9 additions & 3 deletions jupyter_server/services/sessions/tests/test_sessions_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,15 @@ def test_create(self):
sid = newsession['id']
got = self.sess_api.get(sid).json()

# Kernel state may have changed from 'starting' to 'idle'
del got['kernel']['execution_state']
del newsession['kernel']['execution_state']
# Kernel state may have changed from 'starting' to 'idle',
# but let's only clean up if that's the case
if got['kernel']['execution_state'] == 'idle' and newsession['kernel']['execution_state'] == 'starting':
del got['kernel']['execution_state']
del newsession['kernel']['execution_state']
# include their last_activity as well
del got['kernel']['last_activity']
del newsession['kernel']['last_activity']

self.assertEqual(got, newsession)

def test_create_file_session(self):
Expand Down

0 comments on commit 1ab14b1

Please sign in to comment.