##// END OF EJS Templates
Use NoDB by default...
MinRK -
Show More
@@ -110,10 +110,11 b' flags.update({'
110 'nodb' : ({'HubFactory' : {'db_class' : 'IPython.parallel.controller.dictdb.NoDB'}},
110 'nodb' : ({'HubFactory' : {'db_class' : 'IPython.parallel.controller.dictdb.NoDB'}},
111 """use dummy DB backend, which doesn't store any information.
111 """use dummy DB backend, which doesn't store any information.
112
112
113 This can be used to prevent growth of the memory footprint of the Hub
113 This is the default as of IPython 0.13.
114 in cases where its record-keeping is not required. Requesting results
114
115 of tasks submitted by other clients, db_queries, and task resubmission
115 To enable delayed or repeated retrieval of results from the Hub,
116 will not be available."""),
116 select one of the true db backends.
117 """),
117 'reuse' : ({'IPControllerApp' : {'reuse_files' : True}},
118 'reuse' : ({'IPControllerApp' : {'reuse_files' : True}},
118 'reuse existing json connection files')
119 'reuse existing json connection files')
119 })
120 })
@@ -138,7 +139,6 b' aliases = dict('
138 aliases.update(base_aliases)
139 aliases.update(base_aliases)
139 aliases.update(session_aliases)
140 aliases.update(session_aliases)
140
141
141
142 class IPControllerApp(BaseParallelApplication):
142 class IPControllerApp(BaseParallelApplication):
143
143
144 name = u'ipcontroller'
144 name = u'ipcontroller'
@@ -184,6 +184,10 b' class DictDB(BaseDB):'
184 msg_ids = self._records.keys()
184 msg_ids = self._records.keys()
185 return sorted(msg_ids, key=lambda m: self._records[m]['submitted'])
185 return sorted(msg_ids, key=lambda m: self._records[m]['submitted'])
186
186
187 NODATA = KeyError("NoDB backend doesn't store any data. "
188 "Start the Controller with a DB backend to enable resubmission / result persistence."
189 )
190
187 class NoDB(DictDB):
191 class NoDB(DictDB):
188 """A blackhole db backend that actually stores no information.
192 """A blackhole db backend that actually stores no information.
189
193
@@ -197,7 +201,7 b' class NoDB(DictDB):'
197 pass
201 pass
198
202
199 def get_record(self, msg_id):
203 def get_record(self, msg_id):
200 raise KeyError("NoDB does not support record access")
204 raise NODATA
201
205
202 def update_record(self, msg_id, record):
206 def update_record(self, msg_id, record):
203 pass
207 pass
@@ -209,8 +213,8 b' class NoDB(DictDB):'
209 pass
213 pass
210
214
211 def find_records(self, check, keys=None):
215 def find_records(self, check, keys=None):
212 raise KeyError("NoDB does not store information")
216 raise NODATA
213
217
214 def get_history(self):
218 def get_history(self):
215 raise KeyError("NoDB does not store information")
219 raise NODATA
216
220
@@ -119,6 +119,13 b' class EngineConnector(HasTraits):'
119 heartbeat=CBytes()
119 heartbeat=CBytes()
120 pending=Set()
120 pending=Set()
121
121
122 _db_shortcuts = {
123 'sqlitedb' : 'IPython.parallel.controller.sqlitedb.SQLiteDB',
124 'mongodb' : 'IPython.parallel.controller.mongodb.MongoDB',
125 'dictdb' : 'IPython.parallel.controller.dictdb.DictDB',
126 'nodb' : 'IPython.parallel.controller.dictdb.NoDB',
127 }
128
122 class HubFactory(RegistrationFactory):
129 class HubFactory(RegistrationFactory):
123 """The Configurable for setting up a Hub."""
130 """The Configurable for setting up a Hub."""
124
131
@@ -181,8 +188,17 b' class HubFactory(RegistrationFactory):'
181
188
182 monitor_url = Unicode('')
189 monitor_url = Unicode('')
183
190
184 db_class = DottedObjectName('IPython.parallel.controller.dictdb.DictDB',
191 db_class = DottedObjectName('NoDB',
185 config=True, help="""The class to use for the DB backend""")
192 config=True, help="""The class to use for the DB backend
193
194 Options include:
195
196 SQLiteDB: SQLite
197 MongoDB : use MongoDB
198 DictDB : in-memory storage (fastest, but be mindful of memory growth of the Hub)
199 NoDB : disable database altogether (default)
200
201 """)
186
202
187 # not configurable
203 # not configurable
188 db = Instance('IPython.parallel.controller.dictdb.BaseDB')
204 db = Instance('IPython.parallel.controller.dictdb.BaseDB')
@@ -258,9 +274,9 b' class HubFactory(RegistrationFactory):'
258 sub = ZMQStream(sub, loop)
274 sub = ZMQStream(sub, loop)
259
275
260 # connect the db
276 # connect the db
261 self.log.info('Hub using DB backend: %r'%(self.db_class.split()[-1]))
277 db_class = _db_shortcuts.get(self.db_class.lower(), self.db_class)
262 # cdir = self.config.Global.cluster_dir
278 self.log.info('Hub using DB backend: %r', (db_class.split('.')[-1]))
263 self.db = import_item(str(self.db_class))(session=self.session.session,
279 self.db = import_item(str(db_class))(session=self.session.session,
264 config=self.config, log=self.log)
280 config=self.config, log=self.log)
265 time.sleep(.25)
281 time.sleep(.25)
266 try:
282 try:
@@ -57,7 +57,7 b' def setup():'
57
57
58 cp = TestProcessLauncher()
58 cp = TestProcessLauncher()
59 cp.cmd_and_args = ipcontroller_cmd_argv + \
59 cp.cmd_and_args = ipcontroller_cmd_argv + \
60 ['--profile=iptest', '--log-level=50', '--ping=250']
60 ['--profile=iptest', '--log-level=50', '--ping=250', '--dictdb']
61 cp.start()
61 cp.start()
62 launchers.append(cp)
62 launchers.append(cp)
63 tic = time.time()
63 tic = time.time()
General Comments 0
You need to be logged in to leave comments. Login now