##// END OF EJS Templates
Beginning to transition all paths, files, dirs over to unicode....
Brian Granger -
Show More
@@ -93,12 +93,12 b' c = get_config()'
93 93 # c.WinHPCTask.is_rerunnable = True
94 94
95 95 # c.IPControllerTask.task_name = 'IPController'
96 # c.IPControllerTask.controller_cmd = ['ipcontroller.exe']
96 # c.IPControllerTask.controller_cmd = [u'ipcontroller.exe']
97 97 # c.IPControllerTask.controller_args = ['--log-to-file', '--log-level', '40']
98 98 # c.IPControllerTask.environment_variables = {}
99 99
100 100 # c.IPEngineTask.task_name = 'IPController'
101 # c.IPEngineTask.engine_cmd = ['ipengine.exe']
101 # c.IPEngineTask.engine_cmd = [u'ipengine.exe']
102 102 # c.IPEngineTask.engine_args = ['--log-to-file', '--log-level', '40']
103 103 # c.IPEngineTask.environment_variables = {}
104 104
@@ -101,7 +101,7 b' c = get_config()'
101 101 # are more for developers who want to change the behavior of the controller
102 102 # at a fundamental level.
103 103
104 # c.FCClientServiceFactory.cert_file = 'ipcontroller-client.pem'
104 # c.FCClientServiceFactory.cert_file = u'ipcontroller-client.pem'
105 105
106 106 # default_client_interfaces = Config()
107 107 # default_client_interfaces.Task.interface_chain = [
@@ -109,24 +109,24 b' c = get_config()'
109 109 # 'IPython.kernel.taskfc.IFCTaskController'
110 110 # ]
111 111 #
112 # default_client_interfaces.Task.furl_file = 'ipcontroller-tc.furl'
112 # default_client_interfaces.Task.furl_file = u'ipcontroller-tc.furl'
113 113 #
114 114 # default_client_interfaces.MultiEngine.interface_chain = [
115 115 # 'IPython.kernel.multiengine.IMultiEngine',
116 116 # 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine'
117 117 # ]
118 118 #
119 # default_client_interfaces.MultiEngine.furl_file = 'ipcontroller-mec.furl'
119 # default_client_interfaces.MultiEngine.furl_file = u'ipcontroller-mec.furl'
120 120 #
121 121 # c.FCEngineServiceFactory.interfaces = default_client_interfaces
122 122
123 # c.FCEngineServiceFactory.cert_file = 'ipcontroller-engine.pem'
123 # c.FCEngineServiceFactory.cert_file = u'ipcontroller-engine.pem'
124 124
125 125 # default_engine_interfaces = Config()
126 126 # default_engine_interfaces.Default.interface_chain = [
127 127 # 'IPython.kernel.enginefc.IFCControllerBase'
128 128 # ]
129 129 #
130 # default_engine_interfaces.Default.furl_file = 'ipcontroller-engine.furl'
130 # default_engine_interfaces.Default.furl_file = u'ipcontroller-engine.furl'
131 131 #
132 132 # c.FCEngineServiceFactory.interfaces = default_engine_interfaces
@@ -32,7 +32,7 b' c = get_config()'
32 32 # By default, the engine will look for the controller's FURL file in its own
33 33 # cluster directory. Sometimes, the FURL file will be elsewhere and this
34 34 # attribute can be set to the full path of the FURL file.
35 # c.Global.furl_file = ''
35 # c.Global.furl_file = u''
36 36
37 37 #-----------------------------------------------------------------------------
38 38 # MPI configuration
@@ -76,7 +76,7 b' c = get_config()'
76 76
77 77 # c.Global.shell_class = 'IPython.kernel.core.interpreter.Interpreter'
78 78
79 # c.Global.furl_file_name = 'ipcontroller-engine.furl'
79 # c.Global.furl_file_name = u'ipcontroller-engine.furl'
80 80
81 81
82 82
@@ -71,9 +71,9 b' c = get_config()'
71 71
72 72 # c.InteractiveShell.logstart = True
73 73
74 # c.InteractiveShell.logfile = 'ipython_log.py'
74 # c.InteractiveShell.logfile = u'ipython_log.py'
75 75
76 # c.InteractiveShell.logappend = 'mylog.py'
76 # c.InteractiveShell.logappend = u'mylog.py'
77 77
78 78 # c.InteractiveShell.object_info_string_level = 0
79 79
@@ -52,12 +52,12 b' class BaseAppArgParseConfigLoader(ArgParseConfigLoader):'
52 52
53 53 def _add_other_arguments(self):
54 54 self.parser.add_argument('--ipython-dir',
55 dest='Global.ipython_dir',type=str,
55 dest='Global.ipython_dir',type=unicode,
56 56 help='Set to override default location of Global.ipython_dir.',
57 57 default=NoConfigDefault,
58 58 metavar='Global.ipython_dir')
59 59 self.parser.add_argument('-p', '--profile',
60 dest='Global.profile',type=str,
60 dest='Global.profile',type=unicode,
61 61 help='The string name of the ipython profile to be used.',
62 62 default=NoConfigDefault,
63 63 metavar='Global.profile')
@@ -67,7 +67,7 b' class BaseAppArgParseConfigLoader(ArgParseConfigLoader):'
67 67 default=NoConfigDefault,
68 68 metavar='Global.log_level')
69 69 self.parser.add_argument('--config-file',
70 dest='Global.config_file',type=str,
70 dest='Global.config_file',type=unicode,
71 71 help='Set the config file name to override default.',
72 72 default=NoConfigDefault,
73 73 metavar='Global.config_file')
@@ -80,9 +80,9 b' class ApplicationError(Exception):'
80 80 class Application(object):
81 81 """Load a config, construct components and set them running."""
82 82
83 name = 'ipython'
83 name = u'ipython'
84 84 description = 'IPython: an enhanced interactive Python shell.'
85 config_file_name = 'ipython_config.py'
85 config_file_name = u'ipython_config.py'
86 86 default_log_level = logging.WARN
87 87
88 88 def __init__(self):
@@ -242,7 +242,7 b' class Application(object):'
242 242 try:
243 243 self.profile_name = self.command_line_config.Global.profile
244 244 name_parts = self.config_file_name.split('.')
245 name_parts.insert(1, '_' + self.profile_name + '.')
245 name_parts.insert(1, u'_' + self.profile_name + u'.')
246 246 self.config_file_name = ''.join(name_parts)
247 247 except AttributeError:
248 248 pass
@@ -280,7 +280,7 b' class Application(object):'
280 280 self.file_config = Config()
281 281 except:
282 282 self.log.warn("Error loading config file: %s" % \
283 self.config_file_name, exc_info=True)
283 self.config_file_name, exc_info=True)
284 284 self.file_config = Config()
285 285
286 286 def set_file_config_log_level(self):
@@ -164,20 +164,20 b' cl_args = ('
164 164 help="Start logging to the default file (./ipython_log.py).")
165 165 ),
166 166 (('--logfile','-lf'), dict(
167 type=str, dest='InteractiveShell.logfile', default=NoConfigDefault,
167 type=unicode, dest='InteractiveShell.logfile', default=NoConfigDefault,
168 168 help="Start logging to logfile.",
169 169 metavar='InteractiveShell.logfile')
170 170 ),
171 171 (('--log-append','-la'), dict(
172 type=str, dest='InteractiveShell.logappend', default=NoConfigDefault,
173 help="Start logging to logappend in append mode.",
172 type=unicode, dest='InteractiveShell.logappend', default=NoConfigDefault,
173 help="Start logging to the give file in append mode.",
174 174 metavar='InteractiveShell.logfile')
175 175 ),
176 176 (('--pdb',), dict(
177 177 action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault,
178 178 help="Enable auto calling the pdb debugger after every exception.")
179 179 ),
180 (('--nopdb',), dict(
180 (('--no-pdb',), dict(
181 181 action='store_false', dest='InteractiveShell.pdb', default=NoConfigDefault,
182 182 help="Disable auto calling the pdb debugger after every exception.")
183 183 ),
@@ -293,11 +293,11 b' class IPythonAppCLConfigLoader(BaseAppArgParseConfigLoader):'
293 293 arguments = cl_args
294 294
295 295
296 default_config_file_name = 'ipython_config.py'
296 default_config_file_name = u'ipython_config.py'
297 297
298 298
299 299 class IPythonApp(Application):
300 name = 'ipython'
300 name = u'ipython'
301 301 description = 'IPython: an enhanced interactive Python shell.'
302 302 config_file_name = default_config_file_name
303 303
@@ -475,9 +475,9 b' class IPythonApp(Application):'
475 475 self.shell.showtraceback()
476 476
477 477 def _exec_file(self, fname):
478 full_filename = filefind(fname, ['.', self.ipython_dir])
478 full_filename = filefind(fname, [u'.', self.ipython_dir])
479 479 if os.path.isfile(full_filename):
480 if full_filename.endswith('.py'):
480 if full_filename.endswith(u'.py'):
481 481 self.log.info("Running file in user namespace: %s" % full_filename)
482 482 self.shell.safe_execfile(full_filename, self.shell.user_ns)
483 483 elif full_filename.endswith('.ipy'):
@@ -139,8 +139,8 b' class ClusterDir(Component):'
139 139
140 140 def copy_all_config_files(self, path=None, overwrite=False):
141 141 """Copy all config files into the active cluster directory."""
142 for f in ['ipcontroller_config.py', 'ipengine_config.py',
143 'ipcluster_config.py']:
142 for f in [u'ipcontroller_config.py', u'ipengine_config.py',
143 u'ipcluster_config.py']:
144 144 self.copy_config_file(f, path=path, overwrite=overwrite)
145 145
146 146 @classmethod
@@ -156,7 +156,7 b' class ClusterDir(Component):'
156 156 return ClusterDir(cluster_dir)
157 157
158 158 @classmethod
159 def create_cluster_dir_by_profile(cls, path, profile='default'):
159 def create_cluster_dir_by_profile(cls, path, profile=u'default'):
160 160 """Create a cluster dir by profile name and path.
161 161
162 162 Parameters
@@ -169,11 +169,11 b' class ClusterDir(Component):'
169 169 """
170 170 if not os.path.isdir(path):
171 171 raise ClusterDirError('Directory not found: %s' % path)
172 cluster_dir = os.path.join(path, 'cluster_' + profile)
172 cluster_dir = os.path.join(path, u'cluster_' + profile)
173 173 return ClusterDir(cluster_dir)
174 174
175 175 @classmethod
176 def find_cluster_dir_by_profile(cls, ipython_dir, profile='default'):
176 def find_cluster_dir_by_profile(cls, ipython_dir, profile=u'default'):
177 177 """Find an existing cluster dir by profile name, return its ClusterDir.
178 178
179 179 This searches through a sequence of paths for a cluster dir. If it
@@ -193,7 +193,7 b' class ClusterDir(Component):'
193 193 The name of the profile. The name of the cluster directory
194 194 will be "cluster_<profile>".
195 195 """
196 dirname = 'cluster_' + profile
196 dirname = u'cluster_' + profile
197 197 cluster_dir_paths = os.environ.get('IPCLUSTER_DIR_PATH','')
198 198 if cluster_dir_paths:
199 199 cluster_dir_paths = cluster_dir_paths.split(':')
@@ -230,13 +230,13 b' class AppWithClusterDirArgParseConfigLoader(ArgParseConfigLoader):'
230 230
231 231 def _add_other_arguments(self):
232 232 self.parser.add_argument('--ipython-dir',
233 dest='Global.ipython_dir',type=str,
233 dest='Global.ipython_dir',type=unicode,
234 234 help='Set to override default location of Global.ipython_dir.',
235 235 default=NoConfigDefault,
236 236 metavar='Global.ipython_dir'
237 237 )
238 238 self.parser.add_argument('-p', '--profile',
239 dest='Global.profile',type=str,
239 dest='Global.profile',type=unicode,
240 240 help='The string name of the profile to be used. This determines '
241 241 'the name of the cluster dir as: cluster_<profile>. The default profile '
242 242 'is named "default". The cluster directory is resolve this way '
@@ -251,7 +251,7 b' class AppWithClusterDirArgParseConfigLoader(ArgParseConfigLoader):'
251 251 metavar="Global.log_level"
252 252 )
253 253 self.parser.add_argument('--cluster-dir',
254 dest='Global.cluster_dir',type=str,
254 dest='Global.cluster_dir',type=unicode,
255 255 help='Set the cluster dir. This overrides the logic used by the '
256 256 '--profile option.',
257 257 default=NoConfigDefault,
@@ -291,8 +291,8 b' class ApplicationWithClusterDir(Application):'
291 291
292 292 def create_default_config(self):
293 293 super(ApplicationWithClusterDir, self).create_default_config()
294 self.default_config.Global.profile = 'default'
295 self.default_config.Global.cluster_dir = ''
294 self.default_config.Global.profile = u'default'
295 self.default_config.Global.cluster_dir = u''
296 296 self.default_config.Global.log_to_file = False
297 297 self.default_config.Global.clean_logs = False
298 298
@@ -404,11 +404,11 b' class ApplicationWithClusterDir(Application):'
404 404 if self.master_config.Global.clean_logs:
405 405 log_dir = self.master_config.Global.log_dir
406 406 for f in os.listdir(log_dir):
407 if f.startswith(self.name + '-') and f.endswith('.log'):
407 if f.startswith(self.name + u'-') and f.endswith('.log'):
408 408 os.remove(os.path.join(log_dir, f))
409 409 # Start logging to the new log file
410 410 if self.master_config.Global.log_to_file:
411 log_filename = self.name + '-' + str(os.getpid()) + '.log'
411 log_filename = self.name + u'-' + str(os.getpid()) + u'.log'
412 412 logfile = os.path.join(self.log_dir, log_filename)
413 413 open_log_file = open(logfile, 'w')
414 414 else:
@@ -421,7 +421,7 b' class ApplicationWithClusterDir(Application):'
421 421 This must be called after pre_construct, which sets `self.pid_dir`.
422 422 This raises :exc:`PIDFileError` if the pid file exists already.
423 423 """
424 pid_file = os.path.join(self.pid_dir, self.name + '.pid')
424 pid_file = os.path.join(self.pid_dir, self.name + u'.pid')
425 425 if os.path.isfile(pid_file):
426 426 pid = self.get_pid_from_file()
427 427 if not overwrite:
@@ -439,7 +439,7 b' class ApplicationWithClusterDir(Application):'
439 439 This should be called at shutdown by registering a callback with
440 440 :func:`reactor.addSystemEventTrigger`.
441 441 """
442 pid_file = os.path.join(self.pid_dir, self.name + '.pid')
442 pid_file = os.path.join(self.pid_dir, self.name + u'.pid')
443 443 if os.path.isfile(pid_file):
444 444 try:
445 445 self.log.info("Removing pid file: %s" % pid_file)
@@ -453,7 +453,7 b' class ApplicationWithClusterDir(Application):'
453 453
454 454 If the pid file doesn't exist a :exc:`PIDFileError` is raised.
455 455 """
456 pid_file = os.path.join(self.pid_dir, self.name + '.pid')
456 pid_file = os.path.join(self.pid_dir, self.name + u'.pid')
457 457 if os.path.isfile(pid_file):
458 458 with open(pid_file, 'r') as f:
459 459 pid = int(f.read().strip())
@@ -58,7 +58,7 b' class IPClusterCLLoader(ArgParseConfigLoader):'
58 58 # This has all the common options that all subcommands use
59 59 parent_parser1 = argparse.ArgumentParser(add_help=False)
60 60 parent_parser1.add_argument('--ipython-dir',
61 dest='Global.ipython_dir',type=str,
61 dest='Global.ipython_dir',type=unicode,
62 62 help='Set to override default location of Global.ipython_dir.',
63 63 default=NoConfigDefault,
64 64 metavar='Global.ipython_dir')
@@ -71,7 +71,7 b' class IPClusterCLLoader(ArgParseConfigLoader):'
71 71 # This has all the common options that other subcommands use
72 72 parent_parser2 = argparse.ArgumentParser(add_help=False)
73 73 parent_parser2.add_argument('-p','--profile',
74 dest='Global.profile',type=str,
74 dest='Global.profile',type=unicode,
75 75 default=NoConfigDefault,
76 76 help='The string name of the profile to be used. This determines '
77 77 'the name of the cluster dir as: cluster_<profile>. The default profile '
@@ -80,7 +80,7 b' class IPClusterCLLoader(ArgParseConfigLoader):'
80 80 default=NoConfigDefault,
81 81 metavar='Global.profile')
82 82 parent_parser2.add_argument('--cluster-dir',
83 dest='Global.cluster_dir',type=str,
83 dest='Global.cluster_dir',type=unicode,
84 84 default=NoConfigDefault,
85 85 help='Set the cluster dir. This overrides the logic used by the '
86 86 '--profile option.',
@@ -165,12 +165,12 b' class IPClusterCLLoader(ArgParseConfigLoader):'
165 165 )
166 166
167 167
168 default_config_file_name = 'ipcluster_config.py'
168 default_config_file_name = u'ipcluster_config.py'
169 169
170 170
171 171 class IPClusterApp(ApplicationWithClusterDir):
172 172
173 name = 'ipcluster'
173 name = u'ipcluster'
174 174 description = 'Start an IPython cluster (controller and engines).'
175 175 config_file_name = default_config_file_name
176 176 default_log_level = logging.INFO
@@ -278,7 +278,6 b' class IPClusterApp(ApplicationWithClusterDir):'
278 278
279 279 # Setup signals
280 280 signal.signal(signal.SIGINT, self.stop_launchers)
281 # signal.signal(signal.SIGKILL, self.stop_launchers)
282 281
283 282 # Setup the observing of stopping
284 283 d1 = self.controller_launcher.observe_stop()
@@ -59,7 +59,7 b' default_client_interfaces.MultiEngine.interface_chain = ['
59 59 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine'
60 60 ]
61 61
62 default_client_interfaces.MultiEngine.furl_file = 'ipcontroller-mec.furl'
62 default_client_interfaces.MultiEngine.furl_file = u'ipcontroller-mec.furl'
63 63
64 64 # Make this a dict we can pass to Config.__init__ for the default
65 65 default_client_interfaces = dict(copy.deepcopy(default_client_interfaces.items()))
@@ -72,7 +72,7 b' default_engine_interfaces.Default.interface_chain = ['
72 72 'IPython.kernel.enginefc.IFCControllerBase'
73 73 ]
74 74
75 default_engine_interfaces.Default.furl_file = 'ipcontroller-engine.furl'
75 default_engine_interfaces.Default.furl_file = u'ipcontroller-engine.furl'
76 76
77 77 # Make this a dict we can pass to Config.__init__ for the default
78 78 default_engine_interfaces = dict(copy.deepcopy(default_engine_interfaces.items()))
@@ -86,7 +86,7 b' default_engine_interfaces = dict(copy.deepcopy(default_engine_interfaces.items()'
86 86 class FCClientServiceFactory(FCServiceFactory):
87 87 """A Foolscap implementation of the client services."""
88 88
89 cert_file = Str('ipcontroller-client.pem', config=True)
89 cert_file = Unicode(u'ipcontroller-client.pem', config=True)
90 90 interfaces = Instance(klass=Config, kw=default_client_interfaces,
91 91 allow_none=False, config=True)
92 92
@@ -94,7 +94,7 b' class FCClientServiceFactory(FCServiceFactory):'
94 94 class FCEngineServiceFactory(FCServiceFactory):
95 95 """A Foolscap implementation of the engine services."""
96 96
97 cert_file = Str('ipcontroller-engine.pem', config=True)
97 cert_file = Unicode(u'ipcontroller-engine.pem', config=True)
98 98 interfaces = Instance(klass=dict, kw=default_engine_interfaces,
99 99 allow_none=False, config=True)
100 100
@@ -176,12 +176,12 b' class IPControllerAppCLConfigLoader(AppWithClusterDirArgParseConfigLoader):'
176 176 arguments = cl_args
177 177
178 178
179 default_config_file_name = 'ipcontroller_config.py'
179 default_config_file_name = u'ipcontroller_config.py'
180 180
181 181
182 182 class IPControllerApp(ApplicationWithClusterDir):
183 183
184 name = 'ipcontroller'
184 name = u'ipcontroller'
185 185 description = 'Start the IPython controller for parallel computing.'
186 186 config_file_name = default_config_file_name
187 187 auto_create_cluster_dir = True
@@ -44,7 +44,7 b' from IPython.kernel.engineconnector import EngineConnector'
44 44 cl_args = (
45 45 # Controller config
46 46 (('--furl-file',), dict(
47 type=str, dest='Global.furl_file', default=NoConfigDefault,
47 type=unicode, dest='Global.furl_file', default=NoConfigDefault,
48 48 help='The full location of the file containing the FURL of the '
49 49 'controller. If this is not given, the FURL file must be in the '
50 50 'security directory of the cluster directory. This location is '
@@ -84,12 +84,12 b' mpi.size = 0'
84 84 """
85 85
86 86
87 default_config_file_name = 'ipengine_config.py'
87 default_config_file_name = u'ipengine_config.py'
88 88
89 89
90 90 class IPEngineApp(ApplicationWithClusterDir):
91 91
92 name = 'ipengine'
92 name = u'ipengine'
93 93 description = 'Start the IPython engine for parallel computing.'
94 94 config_file_name = default_config_file_name
95 95 auto_create_cluster_dir = True
@@ -108,10 +108,10 b' class IPEngineApp(ApplicationWithClusterDir):'
108 108 # Configuration related to the controller
109 109 # This must match the filename (path not included) that the controller
110 110 # used for the FURL file.
111 self.default_config.Global.furl_file_name = 'ipcontroller-engine.furl'
111 self.default_config.Global.furl_file_name = u'ipcontroller-engine.furl'
112 112 # If given, this is the actual location of the controller's FURL file.
113 113 # If not, this is computed using the profile, app_dir and furl_file_name
114 self.default_config.Global.furl_file = ''
114 self.default_config.Global.furl_file = u''
115 115
116 116 # The max number of connection attemps and the initial delay between
117 117 # those attemps.
@@ -244,8 +244,8 b' class LocalProcessLauncher(BaseLauncher):'
244 244 self.start_deferred = defer.Deferred()
245 245 self.process_transport = reactor.spawnProcess(
246 246 self.process_protocol,
247 str(self.args[0]),
248 [str(a) for a in self.args],
247 str(self.args[0]), # twisted expects these to be str, not unicode
248 [str(a) for a in self.args], # str expected, not unicode
249 249 env=os.environ
250 250 )
251 251 return self.start_deferred
General Comments 0
You need to be logged in to leave comments. Login now