##// END OF EJS Templates
command-line pass...
MinRK -
Show More
@@ -66,7 +66,9 b' base_flags = dict('
66 66 init = ({'BaseIPythonApplication' : {
67 67 'copy_config_files' : True,
68 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 137 create_flags = {}
138 138 create_flags.update(base_flags)
139 create_flags.update(boolean_flag('reset', 'ProfileCreate.overwrite',
140 "reset config files to defaults", "leave existing config files"))
141 create_flags.update(boolean_flag('parallel', 'ProfileCreate.parallel',
142 "Include parallel computing config files",
143 "Don't include parallel computing config files"))
139 # don't include '--init' flag, which implies running profile create in other apps
140 create_flags.pop('init')
141 create_flags['reset'] = ({'ProfileCreate': {'overwrite' : True}},
142 "reset config files in this profile to the defaults.")
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 148 class ProfileCreate(BaseIPythonApplication):
@@ -176,21 +176,20 b' class MainWindow(QtGui.QMainWindow):'
176 176 #-----------------------------------------------------------------------------
177 177
178 178 flags = dict(ipkernel_flags)
179
180 flags.update({
179 qt_flags = {
181 180 'existing' : ({'IPythonQtConsoleApp' : {'existing' : True}},
182 181 "Connect to an existing kernel."),
183 182 'pure' : ({'IPythonQtConsoleApp' : {'pure' : True}},
184 183 "Use a pure Python kernel instead of an IPython kernel."),
185 184 'plain' : ({'ConsoleWidget' : {'kind' : 'plain'}},
186 185 "Disable rich text support."),
187 })
188 flags.update(boolean_flag(
186 }
187 qt_flags.update(boolean_flag(
189 188 'gui-completion', 'ConsoleWidget.gui_completion',
190 189 "use a GUI widget for tab completion",
191 190 "use plaintext output for completion"
192 191 ))
193 flags.update(boolean_flag(
192 qt_flags.update(boolean_flag(
194 193 'confirm-exit', 'IPythonQtConsoleApp.confirm_exit',
195 194 """Set to display confirmation dialog on exit. You can always use 'exit' or 'quit',
196 195 to force a direct exit without any confirmation.
@@ -199,31 +198,31 b' flags.update(boolean_flag('
199 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 202 # the flags that are specific to the frontend
203 203 # these must be scrubbed before being passed to the kernel,
204 204 # or it will raise an error on unrecognized flags
205 qt_flags = ['existing', 'pure', 'plain', 'gui-completion', 'no-gui-completion',
206 'confirm-exit', 'no-confirm-exit']
205 qt_flags = qt_flags.keys()
207 206
208 207 aliases = dict(ipkernel_aliases)
209 208
210 aliases.update(dict(
209 qt_aliases = dict(
211 210 hb = 'IPythonQtConsoleApp.hb_port',
212 211 shell = 'IPythonQtConsoleApp.shell_port',
213 212 iopub = 'IPythonQtConsoleApp.iopub_port',
214 213 stdin = 'IPythonQtConsoleApp.stdin_port',
215 214 ip = 'IPythonQtConsoleApp.ip',
216 215
217 plain = 'IPythonQtConsoleApp.plain',
218 pure = 'IPythonQtConsoleApp.pure',
219 216 style = 'IPythonWidget.syntax_style',
220 217 stylesheet = 'IPythonQtConsoleApp.stylesheet',
221 218 colors = 'ZMQInteractiveShell.colors',
222 219
223 220 editor = 'IPythonWidget.editor',
224 221 paging = 'ConsoleWidget.paging',
225 ))
226 aliases['gui-completion'] = 'ConsoleWidget.gui_completion'
222 )
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 315 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
317 316 # scrub frontend-specific flags
318 317 for a in argv:
319 if a.startswith('-') and a.lstrip('-') in qt_flags:
320 self.kernel_argv.remove(a)
318
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 324 def init_kernel_manager(self):
323 325 # Don't let Qt or ZMQ swallow KeyboardInterupts.
@@ -37,6 +37,7 b' from IPython.core.application import BaseIPythonApplication'
37 37 from IPython.core.profiledir import ProfileDir
38 38 from IPython.utils.daemonize import daemonize
39 39 from IPython.utils.importstring import import_item
40 from IPython.utils.sysinfo import num_cpus
40 41 from IPython.utils.traitlets import (Int, Unicode, Bool, CFloat, Dict, List,
41 42 DottedObjectName)
42 43
@@ -228,12 +229,32 b' class IPClusterEngines(BaseParallelApplication):'
228 229 eslaunchers = [ l for l in launchers if 'EngineSet' in l.__name__]
229 230 return [ProfileDir]+eslaunchers
230 231
231 n = Int(2, config=True,
232 help="The number of engines to start.")
232 n = Int(num_cpus(), config=True,
233 help="""The number of engines to start. The default is to use one for each
234 CPU on your machine""")
233 235
234 236 engine_launcher_class = DottedObjectName('LocalEngineSetLauncher',
235 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 259 daemonize = Bool(False, config=True,
239 260 help="""Daemonize the ipcluster program. This implies --log-to-file.
@@ -267,10 +288,14 b' class IPClusterEngines(BaseParallelApplication):'
267 288 # not a module, presume it's the raw name in apps.launcher
268 289 clsname = 'IPython.parallel.apps.launcher.'+clsname
269 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 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 300 return launcher
276 301
@@ -348,6 +373,12 b' start_aliases.update(dict('
348 373 ))
349 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 382 class IPClusterStart(IPClusterEngines):
352 383
353 384 name = u'ipcluster'
@@ -369,7 +400,21 b' class IPClusterStart(IPClusterEngines):'
369 400
370 401 controller_launcher_class = DottedObjectName('LocalControllerLauncher',
371 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 419 reset = Bool(False, config=True,
375 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