##// END OF EJS Templates
Use DottedObjectName traits in zmq and parallel modules.
Thomas Kluyver -
Show More
@@ -37,7 +37,8 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.traitlets import Int, Unicode, Bool, CFloat, Dict, List
40 from IPython.utils.traitlets import (Int, Unicode, Bool, CFloat, Dict, List,
41 DottedObjectName)
41
42
42 from IPython.parallel.apps.baseapp import (
43 from IPython.parallel.apps.baseapp import (
43 BaseParallelApplication,
44 BaseParallelApplication,
@@ -198,7 +199,7 b' class IPClusterEngines(BaseParallelApplication):'
198 n = Int(2, config=True,
199 n = Int(2, config=True,
199 help="The number of engines to start.")
200 help="The number of engines to start.")
200
201
201 engine_launcher_class = Unicode('LocalEngineSetLauncher',
202 engine_launcher_class = DottedObjectName('LocalEngineSetLauncher',
202 config=True,
203 config=True,
203 help="The class for launching a set of Engines."
204 help="The class for launching a set of Engines."
204 )
205 )
@@ -330,7 +331,7 b' class IPClusterStart(IPClusterEngines):'
330 delay = CFloat(1., config=True,
331 delay = CFloat(1., config=True,
331 help="delay (in s) between starting the controller and the engines")
332 help="delay (in s) between starting the controller and the engines")
332
333
333 controller_launcher_class = Unicode('LocalControllerLauncher',
334 controller_launcher_class = DottedObjectName('LocalControllerLauncher',
334 config=True,
335 config=True,
335 help="The class for launching a Controller."
336 help="The class for launching a Controller."
336 )
337 )
@@ -30,7 +30,7 b' from zmq.eventloop.zmqstream import ZMQStream'
30 # internal:
30 # internal:
31 from IPython.utils.importstring import import_item
31 from IPython.utils.importstring import import_item
32 from IPython.utils.traitlets import (
32 from IPython.utils.traitlets import (
33 HasTraits, Instance, Int, Unicode, Dict, Set, Tuple, Bytes
33 HasTraits, Instance, Int, Unicode, Dict, Set, Tuple, Bytes, DottedObjectName
34 )
34 )
35
35
36 from IPython.parallel import error, util
36 from IPython.parallel import error, util
@@ -179,8 +179,8 b' class HubFactory(RegistrationFactory):'
179
179
180 monitor_url = Unicode('')
180 monitor_url = Unicode('')
181
181
182 db_class = Unicode('IPython.parallel.controller.dictdb.DictDB', config=True,
182 db_class = DottedObjectName('IPython.parallel.controller.dictdb.DictDB',
183 help="""The class to use for the DB backend""")
183 config=True, help="""The class to use for the DB backend""")
184
184
185 # not configurable
185 # not configurable
186 db = Instance('IPython.parallel.controller.dictdb.BaseDB')
186 db = Instance('IPython.parallel.controller.dictdb.BaseDB')
@@ -30,7 +30,8 b' from IPython.core.application import ('
30 )
30 )
31 from IPython.utils import io
31 from IPython.utils import io
32 from IPython.utils.localinterfaces import LOCALHOST
32 from IPython.utils.localinterfaces import LOCALHOST
33 from IPython.utils.traitlets import Any, Instance, Dict, Unicode, Int, Bool
33 from IPython.utils.traitlets import (Any, Instance, Dict, Unicode, Int, Bool,
34 DottedObjectName)
34 from IPython.utils.importstring import import_item
35 from IPython.utils.importstring import import_item
35 # local imports
36 # local imports
36 from IPython.zmq.heartbeat import Heartbeat
37 from IPython.zmq.heartbeat import Heartbeat
@@ -75,7 +76,7 b' class KernelApp(BaseIPythonApplication):'
75 flags = Dict(kernel_flags)
76 flags = Dict(kernel_flags)
76 classes = [Session]
77 classes = [Session]
77 # the kernel class, as an importstring
78 # the kernel class, as an importstring
78 kernel_class = Unicode('IPython.zmq.pykernel.Kernel')
79 kernel_class = DottedObjectName('IPython.zmq.pykernel.Kernel')
79 kernel = Any()
80 kernel = Any()
80 poller = Any() # don't restrict this even though current pollers are all Threads
81 poller = Any() # don't restrict this even though current pollers are all Threads
81 heartbeat = Instance(Heartbeat)
82 heartbeat = Instance(Heartbeat)
@@ -93,10 +94,10 b' class KernelApp(BaseIPythonApplication):'
93 # streams, etc.
94 # streams, etc.
94 no_stdout = Bool(False, config=True, help="redirect stdout to the null device")
95 no_stdout = Bool(False, config=True, help="redirect stdout to the null device")
95 no_stderr = Bool(False, config=True, help="redirect stderr to the null device")
96 no_stderr = Bool(False, config=True, help="redirect stderr to the null device")
96 outstream_class = Unicode('IPython.zmq.iostream.OutStream', config=True,
97 outstream_class = DottedObjectName('IPython.zmq.iostream.OutStream',
97 help="The importstring for the OutStream factory")
98 config=True, help="The importstring for the OutStream factory")
98 displayhook_class = Unicode('IPython.zmq.displayhook.DisplayHook', config=True,
99 displayhook_class = DottedObjectName('IPython.zmq.displayhook.DisplayHook',
99 help="The importstring for the DisplayHook factory")
100 config=True, help="The importstring for the DisplayHook factory")
100
101
101 # polling
102 # polling
102 parent = Int(0, config=True,
103 parent = Int(0, config=True,
@@ -47,7 +47,8 b' from zmq.eventloop.zmqstream import ZMQStream'
47 from IPython.config.configurable import Configurable, LoggingConfigurable
47 from IPython.config.configurable import Configurable, LoggingConfigurable
48 from IPython.utils.importstring import import_item
48 from IPython.utils.importstring import import_item
49 from IPython.utils.jsonutil import extract_dates, squash_dates, date_default
49 from IPython.utils.jsonutil import extract_dates, squash_dates, date_default
50 from IPython.utils.traitlets import Bytes, Unicode, Bool, Any, Instance, Set
50 from IPython.utils.traitlets import (Bytes, Unicode, Bool, Any, Instance, Set,
51 DottedObjectName)
51
52
52 #-----------------------------------------------------------------------------
53 #-----------------------------------------------------------------------------
53 # utility functions
54 # utility functions
@@ -211,7 +212,7 b' class Session(Configurable):'
211
212
212 debug=Bool(False, config=True, help="""Debug output in the Session""")
213 debug=Bool(False, config=True, help="""Debug output in the Session""")
213
214
214 packer = Unicode('json',config=True,
215 packer = DottedObjectName('json',config=True,
215 help="""The name of the packer for serializing messages.
216 help="""The name of the packer for serializing messages.
216 Should be one of 'json', 'pickle', or an import name
217 Should be one of 'json', 'pickle', or an import name
217 for a custom callable serializer.""")
218 for a custom callable serializer.""")
@@ -225,7 +226,7 b' class Session(Configurable):'
225 else:
226 else:
226 self.pack = import_item(str(new))
227 self.pack = import_item(str(new))
227
228
228 unpacker = Unicode('json', config=True,
229 unpacker = DottedObjectName('json', config=True,
229 help="""The name of the unpacker for unserializing messages.
230 help="""The name of the unpacker for unserializing messages.
230 Only used with custom functions for `packer`.""")
231 Only used with custom functions for `packer`.""")
231 def _unpacker_changed(self, name, old, new):
232 def _unpacker_changed(self, name, old, new):
General Comments 0
You need to be logged in to leave comments. Login now