##// END OF EJS Templates
Fix broken create/shutdown code
Julia Evans -
Show More
@@ -31,21 +31,25 b' class ExecutePreprocessor(Preprocessor):'
31 31 super(ExecutePreprocessor, self).__init__(**kwargs)
32 32 self.extra_arguments = []
33 33
34 def preprocess(self, nb, resources):
34 def _create_client(self):
35 35 self.km = KernelManager()
36 36 self.km.start_kernel(extra_arguments=self.extra_arguments, stderr=open(os.devnull, 'w'))
37 37 self.kc = self.km.client()
38 38 self.kc.start_channels()
39 39 self.iopub = self.kc.iopub_channel
40 40 self.shell = self.kc.shell_channel
41
42 41 self.shell.execute("pass")
43 42 self.shell.get_msg()
44 43
44 def _shutdown_client(self):
45 self.kc.stop_channels()
46 self.km.shutdown_kernel()
47 del self.km
45 48
46 create_client()
49 def preprocess(self, nb, resources):
50 self._create_client()
47 51 nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
48 shutdown_client()
52 self._shutdown_client()
49 53 return nb, resources
50 54
51 55 def preprocess_cell(self, cell, resources, cell_index):
@@ -109,8 +113,3 b' class ExecutePreprocessor(Preprocessor):'
109 113 outs.append(out)
110 114 return outs
111 115
112
113 def __del__(self):
114 self.kc.stop_channels()
115 self.km.shutdown_kernel()
116 del self.km
General Comments 0
You need to be logged in to leave comments. Login now