Show More
@@ -15,6 +15,7 b'' | |||||
15 | from __future__ import absolute_import |
|
15 | from __future__ import absolute_import | |
16 |
|
16 | |||
17 | # Standard library imports |
|
17 | # Standard library imports | |
|
18 | import re | |||
18 | import signal |
|
19 | import signal | |
19 | import sys |
|
20 | import sys | |
20 | import time |
|
21 | import time | |
@@ -141,7 +142,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||||
141 | #-------------------------------------------------------------------------- |
|
142 | #-------------------------------------------------------------------------- | |
142 |
|
143 | |||
143 | def format_kernel_cmd(self, **kw): |
|
144 | def format_kernel_cmd(self, **kw): | |
144 |
""" |
|
145 | """replace templated args (e.g. {connection_file})""" | |
145 | if self.kernel_cmd: |
|
146 | if self.kernel_cmd: | |
146 | cmd = self.kernel_cmd |
|
147 | cmd = self.kernel_cmd | |
147 | else: |
|
148 | else: | |
@@ -151,7 +152,13 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||||
151 | ) |
|
152 | ) | |
152 | ns = dict(connection_file=self.connection_file) |
|
153 | ns = dict(connection_file=self.connection_file) | |
153 | ns.update(self._launch_args) |
|
154 | ns.update(self._launch_args) | |
154 | return [ c.format(**ns) for c in cmd ] |
|
155 | ||
|
156 | pat = re.compile(r'\{([A-Za-z0-9_]+)\}') | |||
|
157 | def from_ns(match): | |||
|
158 | """Get the key out of ns if it's there, otherwise no change.""" | |||
|
159 | return ns.get(match.group(1), match.group()) | |||
|
160 | ||||
|
161 | return [ pat.sub(from_ns, arg) for arg in cmd ] | |||
155 |
|
162 | |||
156 | def _launch_kernel(self, kernel_cmd, **kw): |
|
163 | def _launch_kernel(self, kernel_cmd, **kw): | |
157 | """actually launch the kernel |
|
164 | """actually launch the kernel |
General Comments 0
You need to be logged in to leave comments.
Login now