Skip to content

Commit

Permalink
#6832 disabling magic kernels on ipython shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Mitusinski committed Feb 13, 2018
1 parent 4a63114 commit eb68224
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions beakerx/beakerx/groovy_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
from IPython import get_ipython
from IPython.core.magic import (Magics, magics_class, cell_magic)
from jupyter_client.manager import KernelManager
import atexit


@magics_class
class GroovyMagics(Magics):
_execution_count = 1

def stop_kernel(self):
self.kc.stop_channels()
self.km.shutdown_kernel(now=True)

def __init__(self, shell):
super(GroovyMagics, self).__init__(shell)
atexit.register(self.stop_kernel)
self.km = KernelManager()
self.km.kernel_name = 'groovy'
self.km.start_kernel()
Expand All @@ -34,10 +40,6 @@ def __init__(self, shell):
except AttributeError:
self._wait_for_ready_backport()

def __del__(self):
self.kc.stop_channels()
self.km.shutdown_kernel(now=True)

def run_cell(self, line, code):
self.kc.execute(code, allow_stdin=True)
reply = self.kc.get_shell_msg()
Expand Down

0 comments on commit eb68224

Please sign in to comment.