##// END OF EJS Templates
aliases match flag pattern ('-' as wordsep, not '_')...
MinRK -
Show More
@@ -111,7 +111,7 b' class Application(SingletonConfigurable):'
111 self.log.setLevel(new)
111 self.log.setLevel(new)
112
112
113 # the alias map for configurables
113 # the alias map for configurables
114 aliases = Dict(dict(log_level='Application.log_level'))
114 aliases = Dict({'log-level' : 'Application.log_level'})
115
115
116 # flags for loading Configurables or store_const style flags
116 # flags for loading Configurables or store_const style flags
117 # flags are loaded from this dict by '--key' flags
117 # flags are loaded from this dict by '--key' flags
@@ -24,6 +24,7 b' import sys'
24
24
25 from IPython.external import argparse
25 from IPython.external import argparse
26 from IPython.utils.path import filefind, get_ipython_dir
26 from IPython.utils.path import filefind, get_ipython_dir
27 from IPython.utils import warn
27
28
28 #-----------------------------------------------------------------------------
29 #-----------------------------------------------------------------------------
29 # Exceptions
30 # Exceptions
@@ -325,7 +326,22 b' class CommandLineConfigLoader(ConfigLoader):'
325 here.
326 here.
326 """
327 """
327
328
328 kv_pattern = re.compile(r'\-\-[A-Za-z]\w*(\.\w+)*\=.*')
329 # raw --identifier=value pattern
330 # but *also* accept '-' as wordsep, for aliases
331 # accepts: --foo=a
332 # --Class.trait=value
333 # --alias-name=value
334 # rejects: -foo=value
335 # --foo
336 # --Class.trait
337 kv_pattern = re.compile(r'\-\-[A-Za-z][\w\-]*(\.[\w\-]+)*\=.*')
338
339 # just flags, no assignments, with two *or one* leading '-'
340 # accepts: --foo
341 # -foo-bar-again
342 # rejects: --anything=anything
343 # --two.word
344
329 flag_pattern = re.compile(r'\-\-?\w+[\-\w]*$')
345 flag_pattern = re.compile(r'\-\-?\w+[\-\w]*$')
330
346
331 class KeyValueConfigLoader(CommandLineConfigLoader):
347 class KeyValueConfigLoader(CommandLineConfigLoader):
@@ -364,8 +380,8 b' class KeyValueConfigLoader(CommandLineConfigLoader):'
364
380
365 >>> from IPython.config.loader import KeyValueConfigLoader
381 >>> from IPython.config.loader import KeyValueConfigLoader
366 >>> cl = KeyValueConfigLoader()
382 >>> cl = KeyValueConfigLoader()
367 >>> cl.load_config(["--foo='bar'","--A.name='brian'","--B.number=0"])
383 >>> cl.load_config(["--A.name='brian'","--B.number=0"])
368 {'A': {'name': 'brian'}, 'B': {'number': 0}, 'foo': 'bar'}
384 {'A': {'name': 'brian'}, 'B': {'number': 0}}
369 """
385 """
370 self.clear()
386 self.clear()
371 if argv is None:
387 if argv is None:
@@ -444,6 +460,9 b' class KeyValueConfigLoader(CommandLineConfigLoader):'
444 # Substitute longnames for aliases.
460 # Substitute longnames for aliases.
445 if lhs in aliases:
461 if lhs in aliases:
446 lhs = aliases[lhs]
462 lhs = aliases[lhs]
463 if '.' not in lhs:
464 # probably a mistyped alias, but not technically illegal
465 warn.warn("Unrecognized alias: '%s', it will probably have no effect."%lhs)
447 exec_str = 'self.config.' + lhs + '=' + rhs
466 exec_str = 'self.config.' + lhs + '=' + rhs
448 try:
467 try:
449 # Try to see if regular Python syntax will work. This
468 # Try to see if regular Python syntax will work. This
@@ -55,8 +55,13 b' class MyApp(Application):'
55 config_file = Unicode(u'', config=True,
55 config_file = Unicode(u'', config=True,
56 help="Load this config file")
56 help="Load this config file")
57
57
58 aliases = Dict(dict(i='Foo.i',j='Foo.j',name='Foo.name',
58 aliases = Dict({
59 enabled='Bar.enabled', log_level='MyApp.log_level'))
59 'i' : 'Foo.i',
60 'j' : 'Foo.j',
61 'name' : 'Foo.name',
62 'enabled' : 'Bar.enabled',
63 'log-level' : 'MyApp.log_level',
64 })
60
65
61 flags = Dict(dict(enable=({'Bar': {'enabled' : True}}, "Set Bar.enabled to True"),
66 flags = Dict(dict(enable=({'Bar': {'enabled' : True}}, "Set Bar.enabled to True"),
62 disable=({'Bar': {'enabled' : False}}, "Set Bar.enabled to False")))
67 disable=({'Bar': {'enabled' : False}}, "Set Bar.enabled to False")))
@@ -79,7 +84,7 b' class TestApplication(TestCase):'
79
84
80 def test_config(self):
85 def test_config(self):
81 app = MyApp()
86 app = MyApp()
82 app.parse_command_line(["--i=10","--Foo.j=10","--enabled=False","--log_level=50"])
87 app.parse_command_line(["--i=10","--Foo.j=10","--enabled=False","--log-level=50"])
83 config = app.config
88 config = app.config
84 self.assertEquals(config.Foo.i, 10)
89 self.assertEquals(config.Foo.i, 10)
85 self.assertEquals(config.Foo.j, 10)
90 self.assertEquals(config.Foo.j, 10)
@@ -88,7 +93,7 b' class TestApplication(TestCase):'
88
93
89 def test_config_propagation(self):
94 def test_config_propagation(self):
90 app = MyApp()
95 app = MyApp()
91 app.parse_command_line(["--i=10","--Foo.j=10","--enabled=False","--log_level=50"])
96 app.parse_command_line(["--i=10","--Foo.j=10","--enabled=False","--log-level=50"])
92 app.init_foo()
97 app.init_foo()
93 app.init_bar()
98 app.init_bar()
94 self.assertEquals(app.foo.i, 10)
99 self.assertEquals(app.foo.i, 10)
@@ -27,6 +27,8 b' from unittest import TestCase'
27
27
28 from nose import SkipTest
28 from nose import SkipTest
29
29
30 from IPython.testing.tools import mute_warn
31
30 from IPython.utils.traitlets import Int, Unicode
32 from IPython.utils.traitlets import Int, Unicode
31 from IPython.config.configurable import Configurable
33 from IPython.config.configurable import Configurable
32 from IPython.config.loader import (
34 from IPython.config.loader import (
@@ -120,7 +122,8 b' class TestKeyValueCL(TestCase):'
120 def test_basic(self):
122 def test_basic(self):
121 cl = KeyValueConfigLoader()
123 cl = KeyValueConfigLoader()
122 argv = ['--'+s.strip('c.') for s in pyfile.split('\n')[2:-1]]
124 argv = ['--'+s.strip('c.') for s in pyfile.split('\n')[2:-1]]
123 config = cl.load_config(argv)
125 with mute_warn():
126 config = cl.load_config(argv)
124 self.assertEquals(config.a, 10)
127 self.assertEquals(config.a, 10)
125 self.assertEquals(config.b, 20)
128 self.assertEquals(config.b, 20)
126 self.assertEquals(config.Foo.Bar.value, 10)
129 self.assertEquals(config.Foo.Bar.value, 10)
@@ -129,17 +132,20 b' class TestKeyValueCL(TestCase):'
129
132
130 def test_extra_args(self):
133 def test_extra_args(self):
131 cl = KeyValueConfigLoader()
134 cl = KeyValueConfigLoader()
132 config = cl.load_config(['--a=5', 'b', '--c=10', 'd'])
135 with mute_warn():
136 config = cl.load_config(['--a=5', 'b', '--c=10', 'd'])
133 self.assertEquals(cl.extra_args, ['b', 'd'])
137 self.assertEquals(cl.extra_args, ['b', 'd'])
134 self.assertEquals(config.a, 5)
138 self.assertEquals(config.a, 5)
135 self.assertEquals(config.c, 10)
139 self.assertEquals(config.c, 10)
136 config = cl.load_config(['--', '--a=5', '--c=10'])
140 with mute_warn():
141 config = cl.load_config(['--', '--a=5', '--c=10'])
137 self.assertEquals(cl.extra_args, ['--a=5', '--c=10'])
142 self.assertEquals(cl.extra_args, ['--a=5', '--c=10'])
138
143
139 def test_unicode_args(self):
144 def test_unicode_args(self):
140 cl = KeyValueConfigLoader()
145 cl = KeyValueConfigLoader()
141 argv = [u'--a=épsîlön']
146 argv = [u'--a=épsîlön']
142 config = cl.load_config(argv)
147 with mute_warn():
148 config = cl.load_config(argv)
143 self.assertEquals(config.a, u'épsîlön')
149 self.assertEquals(config.a, u'épsîlön')
144
150
145 def test_unicode_bytes_args(self):
151 def test_unicode_bytes_args(self):
@@ -150,7 +156,8 b' class TestKeyValueCL(TestCase):'
150 raise SkipTest("sys.stdin.encoding can't handle 'é'")
156 raise SkipTest("sys.stdin.encoding can't handle 'é'")
151
157
152 cl = KeyValueConfigLoader()
158 cl = KeyValueConfigLoader()
153 config = cl.load_config([barg])
159 with mute_warn():
160 config = cl.load_config([barg])
154 self.assertEquals(config.a, u'é')
161 self.assertEquals(config.a, u'é')
155
162
156
163
@@ -52,11 +52,11 b' from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict'
52
52
53 # aliases and flags
53 # aliases and flags
54
54
55 base_aliases = dict(
55 base_aliases = {
56 profile='BaseIPythonApplication.profile',
56 'profile' : 'BaseIPythonApplication.profile',
57 ipython_dir='BaseIPythonApplication.ipython_dir',
57 'ipython-dir' : 'BaseIPythonApplication.ipython_dir',
58 log_level='Application.log_level',
58 'log-level' : 'Application.log_level',
59 )
59 }
60
60
61 base_flags = dict(
61 base_flags = dict(
62 debug = ({'Application' : {'log_level' : logging.DEBUG}},
62 debug = ({'Application' : {'log_level' : logging.DEBUG}},
@@ -84,13 +84,13 b' class ProfileList(Application):'
84 name = u'ipython-profile'
84 name = u'ipython-profile'
85 description = list_help
85 description = list_help
86
86
87 aliases = Dict(dict(
87 aliases = Dict({
88 ipython_dir = 'ProfileList.ipython_dir',
88 'ipython-dir' : 'ProfileList.ipython_dir',
89 log_level = 'Application.log_level',
89 'log-level' : 'Application.log_level',
90 ))
90 })
91 flags = Dict(dict(
91 flags = Dict(dict(
92 debug = ({'Application' : {'log_level' : 0}},
92 debug = ({'Application' : {'log_level' : 0}},
93 "Set log_level to 0, maximizing log output."
93 "Set Application.log_level to 0, maximizing log output."
94 )
94 )
95 ))
95 ))
96 ipython_dir = Unicode(get_ipython_dir(), config=True,
96 ipython_dir = Unicode(get_ipython_dir(), config=True,
@@ -90,13 +90,13 b' shell_flags[\'nosep\']=(nosep_config, "Eliminate all spacing between prompts.")'
90 # it's possible we don't want short aliases for *all* of these:
90 # it's possible we don't want short aliases for *all* of these:
91 shell_aliases = dict(
91 shell_aliases = dict(
92 autocall='InteractiveShell.autocall',
92 autocall='InteractiveShell.autocall',
93 cache_size='InteractiveShell.cache_size',
94 colors='InteractiveShell.colors',
93 colors='InteractiveShell.colors',
95 logfile='InteractiveShell.logfile',
94 logfile='InteractiveShell.logfile',
96 logappend='InteractiveShell.logappend',
95 logappend='InteractiveShell.logappend',
97 c='InteractiveShellApp.code_to_run',
96 c='InteractiveShellApp.code_to_run',
98 ext='InteractiveShellApp.extra_extension',
97 ext='InteractiveShellApp.extra_extension',
99 )
98 )
99 shell_aliases['cache-size'] = 'InteractiveShell.cache_size'
100
100
101 #-----------------------------------------------------------------------------
101 #-----------------------------------------------------------------------------
102 # Main classes and functions
102 # Main classes and functions
@@ -96,11 +96,11 b' class ParallelCrashHandler(CrashHandler):'
96 base_aliases = {}
96 base_aliases = {}
97 base_aliases.update(base_ip_aliases)
97 base_aliases.update(base_ip_aliases)
98 base_aliases.update({
98 base_aliases.update({
99 'profile_dir' : 'ProfileDir.location',
99 'profile-dir' : 'ProfileDir.location',
100 'work_dir' : 'BaseParallelApplication.work_dir',
100 'work-dir' : 'BaseParallelApplication.work_dir',
101 'log_to_file' : 'BaseParallelApplication.log_to_file',
101 'log-to-file' : 'BaseParallelApplication.log_to_file',
102 'clean_logs' : 'BaseParallelApplication.clean_logs',
102 'clean-logs' : 'BaseParallelApplication.clean_logs',
103 'log_url' : 'BaseParallelApplication.log_url',
103 'log-url' : 'BaseParallelApplication.log_url',
104 })
104 })
105
105
106 base_flags = {
106 base_flags = {
@@ -321,9 +321,9 b' start_aliases = {}'
321 start_aliases.update(engine_aliases)
321 start_aliases.update(engine_aliases)
322 start_aliases.update(dict(
322 start_aliases.update(dict(
323 delay='IPClusterStart.delay',
323 delay='IPClusterStart.delay',
324 clean_logs='IPClusterStart.clean_logs',
325 controller = 'IPClusterStart.controller_launcher_class',
324 controller = 'IPClusterStart.controller_launcher_class',
326 ))
325 ))
326 start_aliases['clean-logs'] = 'IPClusterStart.clean_logs'
327
327
328 class IPClusterStart(IPClusterEngines):
328 class IPClusterStart(IPClusterEngines):
329
329
@@ -111,15 +111,13 b" flags.update(boolean_flag('secure', 'IPControllerApp.secure',"
111 "Don't authenticate messages."
111 "Don't authenticate messages."
112 ))
112 ))
113 aliases = dict(
113 aliases = dict(
114 reuse_files = 'IPControllerApp.reuse_files',
115 secure = 'IPControllerApp.secure',
114 secure = 'IPControllerApp.secure',
116 ssh = 'IPControllerApp.ssh_server',
115 ssh = 'IPControllerApp.ssh_server',
117 use_threads = 'IPControllerApp.use_threads',
118 location = 'IPControllerApp.location',
116 location = 'IPControllerApp.location',
119
117
120 ident = 'Session.session',
118 ident = 'Session.session',
121 user = 'Session.username',
119 user = 'Session.username',
122 exec_key = 'Session.keyfile',
120 keyfile = 'Session.keyfile',
123
121
124 url = 'HubFactory.url',
122 url = 'HubFactory.url',
125 ip = 'HubFactory.ip',
123 ip = 'HubFactory.ip',
@@ -111,7 +111,7 b' aliases = dict('
111
111
112 ident = 'Session.session',
112 ident = 'Session.session',
113 user = 'Session.username',
113 user = 'Session.username',
114 exec_key = 'Session.keyfile',
114 keyfile = 'Session.keyfile',
115
115
116 url = 'EngineFactory.url',
116 url = 'EngineFactory.url',
117 ip = 'EngineFactory.ip',
117 ip = 'EngineFactory.ip',
@@ -323,7 +323,7 b' class LocalControllerLauncher(LocalProcessLauncher):'
323 controller_cmd = List(ipcontroller_cmd_argv, config=True,
323 controller_cmd = List(ipcontroller_cmd_argv, config=True,
324 help="""Popen command to launch ipcontroller.""")
324 help="""Popen command to launch ipcontroller.""")
325 # Command line arguments to ipcontroller.
325 # Command line arguments to ipcontroller.
326 controller_args = List(['--log-to-file','--log_level=%i'%logging.INFO], config=True,
326 controller_args = List(['--log-to-file','--log-level=%i'%logging.INFO], config=True,
327 help="""command-line args to pass to ipcontroller""")
327 help="""command-line args to pass to ipcontroller""")
328
328
329 def find_args(self):
329 def find_args(self):
@@ -331,7 +331,7 b' class LocalControllerLauncher(LocalProcessLauncher):'
331
331
332 def start(self, profile_dir):
332 def start(self, profile_dir):
333 """Start the controller by profile_dir."""
333 """Start the controller by profile_dir."""
334 self.controller_args.extend(['--profile_dir=%s'%profile_dir])
334 self.controller_args.extend(['--profile-dir=%s'%profile_dir])
335 self.profile_dir = unicode(profile_dir)
335 self.profile_dir = unicode(profile_dir)
336 self.log.info("Starting LocalControllerLauncher: %r" % self.args)
336 self.log.info("Starting LocalControllerLauncher: %r" % self.args)
337 return super(LocalControllerLauncher, self).start()
337 return super(LocalControllerLauncher, self).start()
@@ -343,7 +343,7 b' class LocalEngineLauncher(LocalProcessLauncher):'
343 engine_cmd = List(ipengine_cmd_argv, config=True,
343 engine_cmd = List(ipengine_cmd_argv, config=True,
344 help="""command to launch the Engine.""")
344 help="""command to launch the Engine.""")
345 # Command line arguments for ipengine.
345 # Command line arguments for ipengine.
346 engine_args = List(['--log-to-file','--log_level=%i'%logging.INFO], config=True,
346 engine_args = List(['--log-to-file','--log-level=%i'%logging.INFO], config=True,
347 help="command-line arguments to pass to ipengine"
347 help="command-line arguments to pass to ipengine"
348 )
348 )
349
349
@@ -352,7 +352,7 b' class LocalEngineLauncher(LocalProcessLauncher):'
352
352
353 def start(self, profile_dir):
353 def start(self, profile_dir):
354 """Start the engine by profile_dir."""
354 """Start the engine by profile_dir."""
355 self.engine_args.extend(['--profile_dir=%s'%profile_dir])
355 self.engine_args.extend(['--profile-dir=%s'%profile_dir])
356 self.profile_dir = unicode(profile_dir)
356 self.profile_dir = unicode(profile_dir)
357 return super(LocalEngineLauncher, self).start()
357 return super(LocalEngineLauncher, self).start()
358
358
@@ -362,7 +362,7 b' class LocalEngineSetLauncher(BaseLauncher):'
362
362
363 # Command line arguments for ipengine.
363 # Command line arguments for ipengine.
364 engine_args = List(
364 engine_args = List(
365 ['--log-to-file','--log_level=%i'%logging.INFO], config=True,
365 ['--log-to-file','--log-level=%i'%logging.INFO], config=True,
366 help="command-line arguments to pass to ipengine"
366 help="command-line arguments to pass to ipengine"
367 )
367 )
368 # launcher class
368 # launcher class
@@ -468,14 +468,14 b' class MPIExecControllerLauncher(MPIExecLauncher):'
468 controller_cmd = List(ipcontroller_cmd_argv, config=True,
468 controller_cmd = List(ipcontroller_cmd_argv, config=True,
469 help="Popen command to launch the Contropper"
469 help="Popen command to launch the Contropper"
470 )
470 )
471 controller_args = List(['--log-to-file','--log_level=%i'%logging.INFO], config=True,
471 controller_args = List(['--log-to-file','--log-level=%i'%logging.INFO], config=True,
472 help="Command line arguments to pass to ipcontroller."
472 help="Command line arguments to pass to ipcontroller."
473 )
473 )
474 n = Int(1)
474 n = Int(1)
475
475
476 def start(self, profile_dir):
476 def start(self, profile_dir):
477 """Start the controller by profile_dir."""
477 """Start the controller by profile_dir."""
478 self.controller_args.extend(['--profile_dir=%s'%profile_dir])
478 self.controller_args.extend(['--profile-dir=%s'%profile_dir])
479 self.profile_dir = unicode(profile_dir)
479 self.profile_dir = unicode(profile_dir)
480 self.log.info("Starting MPIExecControllerLauncher: %r" % self.args)
480 self.log.info("Starting MPIExecControllerLauncher: %r" % self.args)
481 return super(MPIExecControllerLauncher, self).start(1)
481 return super(MPIExecControllerLauncher, self).start(1)
@@ -491,14 +491,14 b' class MPIExecEngineSetLauncher(MPIExecLauncher):'
491 help="Popen command for ipengine"
491 help="Popen command for ipengine"
492 )
492 )
493 program_args = List(
493 program_args = List(
494 ['--log-to-file','--log_level=%i'%logging.INFO], config=True,
494 ['--log-to-file','--log-level=%i'%logging.INFO], config=True,
495 help="Command line arguments for ipengine."
495 help="Command line arguments for ipengine."
496 )
496 )
497 n = Int(1)
497 n = Int(1)
498
498
499 def start(self, n, profile_dir):
499 def start(self, n, profile_dir):
500 """Start n engines by profile or profile_dir."""
500 """Start n engines by profile or profile_dir."""
501 self.program_args.extend(['--profile_dir=%s'%profile_dir])
501 self.program_args.extend(['--profile-dir=%s'%profile_dir])
502 self.profile_dir = unicode(profile_dir)
502 self.profile_dir = unicode(profile_dir)
503 self.n = n
503 self.n = n
504 self.log.info('Starting MPIExecEngineSetLauncher: %r' % self.args)
504 self.log.info('Starting MPIExecEngineSetLauncher: %r' % self.args)
@@ -567,7 +567,7 b' class SSHControllerLauncher(SSHLauncher):'
567
567
568 program = List(ipcontroller_cmd_argv, config=True,
568 program = List(ipcontroller_cmd_argv, config=True,
569 help="remote ipcontroller command.")
569 help="remote ipcontroller command.")
570 program_args = List(['--reuse-files', '--log-to-file','--log_level=%i'%logging.INFO], config=True,
570 program_args = List(['--reuse-files', '--log-to-file','--log-level=%i'%logging.INFO], config=True,
571 help="Command line arguments to ipcontroller.")
571 help="Command line arguments to ipcontroller.")
572
572
573
573
@@ -745,7 +745,7 b' class WindowsHPCControllerLauncher(WindowsHPCLauncher):'
745
745
746 def start(self, profile_dir):
746 def start(self, profile_dir):
747 """Start the controller by profile_dir."""
747 """Start the controller by profile_dir."""
748 self.extra_args = ['--profile_dir=%s'%profile_dir]
748 self.extra_args = ['--profile-dir=%s'%profile_dir]
749 self.profile_dir = unicode(profile_dir)
749 self.profile_dir = unicode(profile_dir)
750 return super(WindowsHPCControllerLauncher, self).start(1)
750 return super(WindowsHPCControllerLauncher, self).start(1)
751
751
@@ -779,7 +779,7 b' class WindowsHPCEngineSetLauncher(WindowsHPCLauncher):'
779
779
780 def start(self, n, profile_dir):
780 def start(self, n, profile_dir):
781 """Start the controller by profile_dir."""
781 """Start the controller by profile_dir."""
782 self.extra_args = ['--profile_dir=%s'%profile_dir]
782 self.extra_args = ['--profile-dir=%s'%profile_dir]
783 self.profile_dir = unicode(profile_dir)
783 self.profile_dir = unicode(profile_dir)
784 return super(WindowsHPCEngineSetLauncher, self).start(n)
784 return super(WindowsHPCEngineSetLauncher, self).start(n)
785
785
@@ -936,7 +936,7 b' class PBSControllerLauncher(PBSLauncher):'
936 default_template= Unicode("""#!/bin/sh
936 default_template= Unicode("""#!/bin/sh
937 #PBS -V
937 #PBS -V
938 #PBS -N ipcontroller
938 #PBS -N ipcontroller
939 %s --log-to-file --profile_dir={profile_dir}
939 %s --log-to-file --profile-dir={profile_dir}
940 """%(' '.join(ipcontroller_cmd_argv)))
940 """%(' '.join(ipcontroller_cmd_argv)))
941
941
942 def start(self, profile_dir):
942 def start(self, profile_dir):
@@ -952,7 +952,7 b' class PBSEngineSetLauncher(PBSLauncher):'
952 default_template= Unicode(u"""#!/bin/sh
952 default_template= Unicode(u"""#!/bin/sh
953 #PBS -V
953 #PBS -V
954 #PBS -N ipengine
954 #PBS -N ipengine
955 %s --profile_dir={profile_dir}
955 %s --profile-dir={profile_dir}
956 """%(' '.join(ipengine_cmd_argv)))
956 """%(' '.join(ipengine_cmd_argv)))
957
957
958 def start(self, n, profile_dir):
958 def start(self, n, profile_dir):
@@ -977,7 +977,7 b' class SGEControllerLauncher(SGELauncher):'
977 default_template= Unicode(u"""#$ -V
977 default_template= Unicode(u"""#$ -V
978 #$ -S /bin/sh
978 #$ -S /bin/sh
979 #$ -N ipcontroller
979 #$ -N ipcontroller
980 %s --log-to-file --profile_dir={profile_dir}
980 %s --log-to-file --profile-dir={profile_dir}
981 """%(' '.join(ipcontroller_cmd_argv)))
981 """%(' '.join(ipcontroller_cmd_argv)))
982
982
983 def start(self, profile_dir):
983 def start(self, profile_dir):
@@ -992,7 +992,7 b' class SGEEngineSetLauncher(SGELauncher):'
992 default_template = Unicode("""#$ -V
992 default_template = Unicode("""#$ -V
993 #$ -S /bin/sh
993 #$ -S /bin/sh
994 #$ -N ipengine
994 #$ -N ipengine
995 %s --profile_dir={profile_dir}
995 %s --profile-dir={profile_dir}
996 """%(' '.join(ipengine_cmd_argv)))
996 """%(' '.join(ipengine_cmd_argv)))
997
997
998 def start(self, n, profile_dir):
998 def start(self, n, profile_dir):
@@ -1012,7 +1012,7 b' class IPClusterLauncher(LocalProcessLauncher):'
1012 ipcluster_cmd = List(ipcluster_cmd_argv, config=True,
1012 ipcluster_cmd = List(ipcluster_cmd_argv, config=True,
1013 help="Popen command for ipcluster")
1013 help="Popen command for ipcluster")
1014 ipcluster_args = List(
1014 ipcluster_args = List(
1015 ['--clean-logs', '--log-to-file', '--log_level=%i'%logging.INFO], config=True,
1015 ['--clean-logs', '--log-to-file', '--log-level=%i'%logging.INFO], config=True,
1016 help="Command line arguments to pass to ipcluster.")
1016 help="Command line arguments to pass to ipcluster.")
1017 ipcluster_subcommand = Unicode('start')
1017 ipcluster_subcommand = Unicode('start')
1018 ipcluster_n = Int(2)
1018 ipcluster_n = Int(2)
@@ -55,7 +55,7 b' def setup():'
55
55
56 cp = TestProcessLauncher()
56 cp = TestProcessLauncher()
57 cp.cmd_and_args = ipcontroller_cmd_argv + \
57 cp.cmd_and_args = ipcontroller_cmd_argv + \
58 ['--profile=iptest', '--log_level=50']
58 ['--profile=iptest', '--log-level=50']
59 cp.start()
59 cp.start()
60 launchers.append(cp)
60 launchers.append(cp)
61 tic = time.time()
61 tic = time.time()
@@ -74,7 +74,7 b" def add_engines(n=1, profile='iptest'):"
74 eps = []
74 eps = []
75 for i in range(n):
75 for i in range(n):
76 ep = TestProcessLauncher()
76 ep = TestProcessLauncher()
77 ep.cmd_and_args = ipengine_cmd_argv + ['--profile=%s'%profile, '--log_level=50']
77 ep.cmd_and_args = ipengine_cmd_argv + ['--profile=%s'%profile, '--log-level=50']
78 ep.start()
78 ep.start()
79 launchers.append(ep)
79 launchers.append(ep)
80 eps.append(ep)
80 eps.append(ep)
@@ -32,6 +32,8 b' import os'
32 import re
32 import re
33 import sys
33 import sys
34
34
35 from contextlib import contextmanager
36
35 try:
37 try:
36 # These tools are used by parts of the runtime, so we make the nose
38 # These tools are used by parts of the runtime, so we make the nose
37 # dependency optional at this point. Nose is a hard dependency to run the
39 # dependency optional at this point. Nose is a hard dependency to run the
@@ -307,3 +309,13 b' def check_pairs(func, pairs):'
307 for inp, expected in pairs:
309 for inp, expected in pairs:
308 out = func(inp)
310 out = func(inp)
309 assert out == expected, pair_fail_msg.format(func.func_name, inp, expected, out)
311 assert out == expected, pair_fail_msg.format(func.func_name, inp, expected, out)
312
313 @contextmanager
314 def mute_warn():
315 from IPython.utils import warn
316 save_warn = warn.warn
317 warn.warn = lambda *a, **kw: None
318 try:
319 yield
320 finally:
321 warn.warn = save_warn No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now