##// END OF EJS Templates
Start threads for %%script as daemon thread
Takafumi Arakaki -
Show More
@@ -205,7 +205,7 b' class ScriptMagics(Magics, Configurable):'
205 self.shell.user_ns[args.out] = p.stdout
205 self.shell.user_ns[args.out] = p.stdout
206 if args.err:
206 if args.err:
207 self.shell.user_ns[args.err] = p.stderr
207 self.shell.user_ns[args.err] = p.stderr
208 self.job_manager.new(self._run_script, p, cell)
208 self.job_manager.new(self._run_script, p, cell, daemon=True)
209 if args.proc:
209 if args.proc:
210 self.shell.user_ns[args.proc] = p
210 self.shell.user_ns[args.proc] = p
211 return
211 return
@@ -140,6 +140,8 b' class BackgroundJobManager(object):'
140 In both cases, the result is stored in the job.result field of the
140 In both cases, the result is stored in the job.result field of the
141 background job object.
141 background job object.
142
142
143 You can set `daemon` attribute of the thread by giving the keyword
144 argument `daemon`.
143
145
144 Notes and caveats:
146 Notes and caveats:
145
147
@@ -182,6 +184,8 b' class BackgroundJobManager(object):'
182 else:
184 else:
183 raise TypeError('invalid args for new job')
185 raise TypeError('invalid args for new job')
184
186
187 if kwargs.get('daemon', False):
188 job.daemon = True
185 job.num = len(self.all)+1 if self.all else 0
189 job.num = len(self.all)+1 if self.all else 0
186 self.running.append(job)
190 self.running.append(job)
187 self.all[job.num] = job
191 self.all[job.num] = job
General Comments 0
You need to be logged in to leave comments. Login now