Changeset 165
- Timestamp:
- 02/11/06 02:37:21
- Files:
-
- trunk/doc/intro.html (modified) (1 diff)
- trunk/doc/storage.html (modified) (1 diff)
- trunk/engines.py (modified) (2 diffs)
- trunk/recur.py (added)
- trunk/storage/__init__.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/doc/intro.html
r164 r165 178 178 installed in <tt>site-packages/dejavu</tt> or some other root python 179 179 path.</p> 180 181 <p>Dejavu usually depends upon two additional libraries (but you can get by182 without either), <tt>recur.py</tt> and <tt>xray.py</tt>, which are available183 at <tt>http://projects.amor.org/misc/svn/trunk</tt>. Place these two modules184 in your python path, usually site-packages.</p>185 180 186 181 <p>Dejavu was built using Python 2.3.2. You should probably use trunk/doc/storage.html
r164 r165 257 257 only persist for the lifetime of the arena.</li> 258 258 <li><b>Lifetime:</b> Optional. The recurrence string which declares 259 how often to sweep Units out of the in-memory cache. If you supply 260 this value, you need to grab the <tt>recur</tt> module from 261 <tt>http://projects.amor.org/misc/svn/trunk</tt>. The string you 259 how often to sweep Units out of the in-memory cache. The string you 262 260 supply should be one of the following types: 263 261 <ul> trunk/engines.py
r164 r165 13 13 except ImportError: 14 14 import pickle 15 import recur 16 15 17 import dejavu 16 18 from dejavu import logic … … 34 36 35 37 36 # The TemporarySweeper class is wrapped in a try/except to 37 # allow Dejavu to be deployed without the recur module present. 38 # You can obtain the recur module at http://projects.amor.org/misc. 39 try: 40 import recur 41 except ImportError: 42 def TemporarySweeper(*args, **kwargs): 43 raise AttributeError("The TemporarySweeper class is not available " 44 "because the recur module could not be imported.") 45 else: 46 class TemporarySweeper(recur.Worker): 47 """A worker to sweep out expired TemporaryUnit's.""" 48 49 def work(self): 50 """Start a cycle of scheduled work.""" 51 now = datetime.datetime.now() 52 f = logic.Expression(lambda x: x.Expiration != None 53 and x.Expiration <= now) 54 box = self.arena.new_sandbox() 55 56 for cls in self.arena._registered_classes: 57 if issubclass(cls, TemporaryUnit): 58 # Running box.recall will call TemporaryUnit.on_recall, 59 # which should forget expired units. 60 box.recall(cls, f) 61 box.flush_all() 38 class TemporarySweeper(recur.Worker): 39 """A worker to sweep out expired TemporaryUnit's.""" 40 41 def work(self): 42 """Start a cycle of scheduled work.""" 43 now = datetime.datetime.now() 44 f = logic.Expression(lambda x: x.Expiration != None 45 and x.Expiration <= now) 46 box = self.arena.new_sandbox() 47 48 for cls in self.arena._registered_classes: 49 if issubclass(cls, TemporaryUnit): 50 # Running box.recall will call TemporaryUnit.on_recall, 51 # which should forget expired units. 52 box.recall(cls, f) 53 box.flush_all() 62 54 63 55 trunk/storage/__init__.py
r164 r165 10 10 import pickle 11 11 12 from dejavu import logic 12 from dejavu import logic, recur 13 13 14 14 … … 193 193 if lifetime: 194 194 195 import recur196 195 class IdleSweeper(recur.Worker): 197 196 """A worker to sweep out idle Units."""
