Skip to content

Commit 814dc52

Browse files
authored
Merge pull request #648 from mmigdiso/master
#647 non supported session kinds should not break jupyter startup
2 parents 0d63858 + 5e574de commit 814dc52

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Fix ContextualVersionConflict in Dockerfile.spark. Thanks Linan Zheng, @LinanZheng
66
* Fix Info Subcommand in RemoteSparkMagic. Thanks Linan Zheng, @LinanZheng
7+
* Fix to ignore unsupported spark session types whilst fetching the session list. Thanks, Murat Burak Migdisoglu, @mmigdiso
78

89
## 0.15.0
910

sparkmagic/sparkmagic/livyclientlib/sparkcontroller.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ def run_sqlquery(self, sqlquery, client_name=None):
4646
def get_all_sessions_endpoint(self, endpoint):
4747
http_client = self._http_client(endpoint)
4848
sessions = http_client.get_sessions()[u"sessions"]
49+
supported_sessions = filter(lambda s: (s[constants.LIVY_KIND_PARAM] in constants.SESSION_KINDS_SUPPORTED), sessions)
4950
session_list = [self._livy_session(http_client, {constants.LIVY_KIND_PARAM: s[constants.LIVY_KIND_PARAM]},
5051
self.ipython_display, s[u"id"])
51-
for s in sessions]
52+
for s in supported_sessions]
5253
for s in session_list:
5354
s.refresh_status_and_info()
5455
return session_list

sparkmagic/sparkmagic/tests/test_sparkcontroller.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ def test_get_client_keys():
132132
@with_setup(_setup, _teardown)
133133
def test_get_all_sessions():
134134
http_client = MagicMock()
135-
http_client.get_sessions.return_value = json.loads('{"from":0,"total":2,"sessions":[{"id":0,"state":"idle","kind":'
135+
http_client.get_sessions.return_value = json.loads('{"from":0,"total":3,"sessions":[{"id":0,"state":"idle","kind":'
136136
'"spark","log":[""]}, {"id":1,"state":"busy","kind":"spark","log"'
137+
':[""]},{"id":2,"state":"busy","kind":"sql","log"'
137138
':[""]}]}')
138139
controller._http_client = MagicMock(return_value=http_client)
139140
controller._livy_session = MagicMock()

0 commit comments

Comments
 (0)