##// END OF EJS Templates
command-line pass...
MinRK -
Show More
@@ -66,7 +66,9 b' base_flags = dict('
66 init = ({'BaseIPythonApplication' : {
66 init = ({'BaseIPythonApplication' : {
67 'copy_config_files' : True,
67 'copy_config_files' : True,
68 'auto_create' : True}
68 'auto_create' : True}
69 }, "Initialize profile with default config files")
69 }, """Initialize profile with default config files. This is equivalent
70 to running `ipython profile create <profile>` prior to startup.
71 """)
70 )
72 )
71
73
72
74
@@ -136,11 +136,13 b' class ProfileList(Application):'
136
136
137 create_flags = {}
137 create_flags = {}
138 create_flags.update(base_flags)
138 create_flags.update(base_flags)
139 create_flags.update(boolean_flag('reset', 'ProfileCreate.overwrite',
139 # don't include '--init' flag, which implies running profile create in other apps
140 "reset config files to defaults", "leave existing config files"))
140 create_flags.pop('init')
141 create_flags.update(boolean_flag('parallel', 'ProfileCreate.parallel',
141 create_flags['reset'] = ({'ProfileCreate': {'overwrite' : True}},
142 "Include parallel computing config files",
142 "reset config files in this profile to the defaults.")
143 "Don't include parallel computing config files"))
143 create_flags['parallel'] = ({'ProfileCreate': {'parallel' : True}},
144 "Include the config files for parallel "
145 "computing apps (ipengine, ipcontroller, etc.)")
144
146
145
147
146 class ProfileCreate(BaseIPythonApplication):
148 class ProfileCreate(BaseIPythonApplication):
@@ -176,21 +176,20 b' class MainWindow(QtGui.QMainWindow):'
176 #-----------------------------------------------------------------------------
176 #-----------------------------------------------------------------------------
177
177
178 flags = dict(ipkernel_flags)
178 flags = dict(ipkernel_flags)
179
179 qt_flags = {
180 flags.update({
181 'existing' : ({'IPythonQtConsoleApp' : {'existing' : True}},
180 'existing' : ({'IPythonQtConsoleApp' : {'existing' : True}},
182 "Connect to an existing kernel."),
181 "Connect to an existing kernel."),
183 'pure' : ({'IPythonQtConsoleApp' : {'pure' : True}},
182 'pure' : ({'IPythonQtConsoleApp' : {'pure' : True}},
184 "Use a pure Python kernel instead of an IPython kernel."),
183 "Use a pure Python kernel instead of an IPython kernel."),
185 'plain' : ({'ConsoleWidget' : {'kind' : 'plain'}},
184 'plain' : ({'ConsoleWidget' : {'kind' : 'plain'}},
186 "Disable rich text support."),
185 "Disable rich text support."),
187 })
186 }
188 flags.update(boolean_flag(
187 qt_flags.update(boolean_flag(
189 'gui-completion', 'ConsoleWidget.gui_completion',
188 'gui-completion', 'ConsoleWidget.gui_completion',
190 "use a GUI widget for tab completion",
189 "use a GUI widget for tab completion",
191 "use plaintext output for completion"
190 "use plaintext output for completion"
192 ))
191 ))
193 flags.update(boolean_flag(
192 qt_flags.update(boolean_flag(
194 'confirm-exit', 'IPythonQtConsoleApp.confirm_exit',
193 'confirm-exit', 'IPythonQtConsoleApp.confirm_exit',
195 """Set to display confirmation dialog on exit. You can always use 'exit' or 'quit',
194 """Set to display confirmation dialog on exit. You can always use 'exit' or 'quit',
196 to force a direct exit without any confirmation.
195 to force a direct exit without any confirmation.
@@ -199,31 +198,31 b' flags.update(boolean_flag('
199 if it is owned by the frontend, and leave it alive if it is external.
198 if it is owned by the frontend, and leave it alive if it is external.
200 """
199 """
201 ))
200 ))
201 flags.update(qt_flags)
202 # the flags that are specific to the frontend
202 # the flags that are specific to the frontend
203 # these must be scrubbed before being passed to the kernel,
203 # these must be scrubbed before being passed to the kernel,
204 # or it will raise an error on unrecognized flags
204 # or it will raise an error on unrecognized flags
205 qt_flags = ['existing', 'pure', 'plain', 'gui-completion', 'no-gui-completion',
205 qt_flags = qt_flags.keys()
206 'confirm-exit', 'no-confirm-exit']
207
206
208 aliases = dict(ipkernel_aliases)
207 aliases = dict(ipkernel_aliases)
209
208
210 aliases.update(dict(
209 qt_aliases = dict(
211 hb = 'IPythonQtConsoleApp.hb_port',
210 hb = 'IPythonQtConsoleApp.hb_port',
212 shell = 'IPythonQtConsoleApp.shell_port',
211 shell = 'IPythonQtConsoleApp.shell_port',
213 iopub = 'IPythonQtConsoleApp.iopub_port',
212 iopub = 'IPythonQtConsoleApp.iopub_port',
214 stdin = 'IPythonQtConsoleApp.stdin_port',
213 stdin = 'IPythonQtConsoleApp.stdin_port',
215 ip = 'IPythonQtConsoleApp.ip',
214 ip = 'IPythonQtConsoleApp.ip',
216
215
217 plain = 'IPythonQtConsoleApp.plain',
218 pure = 'IPythonQtConsoleApp.pure',
219 style = 'IPythonWidget.syntax_style',
216 style = 'IPythonWidget.syntax_style',
220 stylesheet = 'IPythonQtConsoleApp.stylesheet',
217 stylesheet = 'IPythonQtConsoleApp.stylesheet',
221 colors = 'ZMQInteractiveShell.colors',
218 colors = 'ZMQInteractiveShell.colors',
222
219
223 editor = 'IPythonWidget.editor',
220 editor = 'IPythonWidget.editor',
224 paging = 'ConsoleWidget.paging',
221 paging = 'ConsoleWidget.paging',
225 ))
222 )
226 aliases['gui-completion'] = 'ConsoleWidget.gui_completion'
223 aliases.update(qt_aliases)
224 # also scrub aliases from the frontend
225 qt_flags.extend(qt_aliases.keys())
227
226
228
227
229 #-----------------------------------------------------------------------------
228 #-----------------------------------------------------------------------------
@@ -316,8 +315,11 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
316 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
315 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
317 # scrub frontend-specific flags
316 # scrub frontend-specific flags
318 for a in argv:
317 for a in argv:
319 if a.startswith('-') and a.lstrip('-') in qt_flags:
318
320 self.kernel_argv.remove(a)
319 if a.startswith('-'):
320 key = a.lstrip('-').split('=')[0]
321 if key in qt_flags:
322 self.kernel_argv.remove(a)
321
323
322 def init_kernel_manager(self):
324 def init_kernel_manager(self):
323 # Don't let Qt or ZMQ swallow KeyboardInterupts.
325 # Don't let Qt or ZMQ swallow KeyboardInterupts.
@@ -37,6 +37,7 b' from IPython.core.application import BaseIPythonApplication'
37 from IPython.core.profiledir import ProfileDir
37 from IPython.core.profiledir import ProfileDir
38 from IPython.utils.daemonize import daemonize
38 from IPython.utils.daemonize import daemonize
39 from IPython.utils.importstring import import_item
39 from IPython.utils.importstring import import_item
40 from IPython.utils.sysinfo import num_cpus
40 from IPython.utils.traitlets import (Int, Unicode, Bool, CFloat, Dict, List,
41 from IPython.utils.traitlets import (Int, Unicode, Bool, CFloat, Dict, List,
41 DottedObjectName)
42 DottedObjectName)
42
43
@@ -228,12 +229,32 b' class IPClusterEngines(BaseParallelApplication):'
228 eslaunchers = [ l for l in launchers if 'EngineSet' in l.__name__]
229 eslaunchers = [ l for l in launchers if 'EngineSet' in l.__name__]
229 return [ProfileDir]+eslaunchers
230 return [ProfileDir]+eslaunchers
230
231
231 n = Int(2, config=True,
232 n = Int(num_cpus(), config=True,
232 help="The number of engines to start.")
233 help="""The number of engines to start. The default is to use one for each
234 CPU on your machine""")
233
235
234 engine_launcher_class = DottedObjectName('LocalEngineSetLauncher',
236 engine_launcher_class = DottedObjectName('LocalEngineSetLauncher',
235 config=True,
237 config=True,
236 help="The class for launching a set of Engines."
238 help="""The class for launching a set of Engines. Change this value
239 to use various batch systems to launch your engines, such as PBS,SGE,MPIExec,etc.
240 Each launcher class has its own set of configuration options, for making sure
241 it will work in your environment.
242
243 You can also write your own launcher, and specify it's absolute import path,
244 as in 'mymodule.launcher.FTLEnginesLauncher`.
245
246 Examples include:
247
248 LocalEngineSetLauncher : start engines locally as subprocesses [default]
249 MPIExecEngineSetLauncher : use mpiexec to launch in an MPI environment
250 PBSEngineSetLauncher : use PBS (qsub) to submit engines to a batch queue
251 SGEEngineSetLauncher : use SGE (qsub) to submit engines to a batch queue
252 SSHEngineSetLauncher : use SSH to start the controller
253 Note that SSH does *not* move the connection files
254 around, so you will likely have to do this manually
255 unless the machines are on a shared file system.
256 WindowsHPCEngineSetLauncher : use Windows HPC
257 """
237 )
258 )
238 daemonize = Bool(False, config=True,
259 daemonize = Bool(False, config=True,
239 help="""Daemonize the ipcluster program. This implies --log-to-file.
260 help="""Daemonize the ipcluster program. This implies --log-to-file.
@@ -267,10 +288,14 b' class IPClusterEngines(BaseParallelApplication):'
267 # not a module, presume it's the raw name in apps.launcher
288 # not a module, presume it's the raw name in apps.launcher
268 clsname = 'IPython.parallel.apps.launcher.'+clsname
289 clsname = 'IPython.parallel.apps.launcher.'+clsname
269 # print repr(clsname)
290 # print repr(clsname)
270 klass = import_item(clsname)
291 try:
292 klass = import_item(clsname)
293 except (ImportError, KeyError):
294 self.log.fatal("Could not import launcher class: %r"%clsname)
295 self.exit(1)
271
296
272 launcher = klass(
297 launcher = klass(
273 work_dir=self.profile_dir.location, config=self.config, log=self.log
298 work_dir=u'.', config=self.config, log=self.log
274 )
299 )
275 return launcher
300 return launcher
276
301
@@ -348,6 +373,12 b' start_aliases.update(dict('
348 ))
373 ))
349 start_aliases['clean-logs'] = 'IPClusterStart.clean_logs'
374 start_aliases['clean-logs'] = 'IPClusterStart.clean_logs'
350
375
376 # set inherited Start keys directly, to ensure command-line args get higher priority
377 # than config file options.
378 for key,value in start_aliases.items():
379 if value.startswith('IPClusterEngines'):
380 start_aliases[key] = value.replace('IPClusterEngines', 'IPClusterStart')
381
351 class IPClusterStart(IPClusterEngines):
382 class IPClusterStart(IPClusterEngines):
352
383
353 name = u'ipcluster'
384 name = u'ipcluster'
@@ -369,7 +400,21 b' class IPClusterStart(IPClusterEngines):'
369
400
370 controller_launcher_class = DottedObjectName('LocalControllerLauncher',
401 controller_launcher_class = DottedObjectName('LocalControllerLauncher',
371 config=True,
402 config=True,
372 help="The class for launching a Controller."
403 helep="""The class for launching a Controller. Change this value if you want
404 your controller to also be launched by a batch system, such as PBS,SGE,MPIExec,etc.
405
406 Each launcher class has its own set of configuration options, for making sure
407 it will work in your environment.
408
409 Examples include:
410
411 LocalControllerLauncher : start engines locally as subprocesses
412 MPIExecControllerLauncher : use mpiexec to launch engines in an MPI universe
413 PBSControllerLauncher : use PBS (qsub) to submit engines to a batch queue
414 SGEControllerLauncher : use SGE (qsub) to submit engines to a batch queue
415 SSHControllerLauncher : use SSH to start the controller
416 WindowsHPCControllerLauncher : use Windows HPC
417 """
373 )
418 )
374 reset = Bool(False, config=True,
419 reset = Bool(False, config=True,
375 help="Whether to reset config files as part of '--create'."
420 help="Whether to reset config files as part of '--create'."
General Comments 0
You need to be logged in to leave comments. Login now