AW: DorothyLocker and performance

"Bauer, Georg" <[email protected]> Tue, 28 Sep 2004 09:24:09 +0200
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <C43D74B62BA19A45ADD74C1AB7AEE542799893@NT-GWS2>
Hi!

>Oh, did I forget to send that one in? Sorry. :| I had that, alternative
>logging for those post-shutdown logs, and code to make sure EventsTool was
>last.

Your patch wasn't able to be applied - I wrote you this directly and
off-list :-)

My solution is a bit more flexible, though: you now have a flag to tell
where to sort the tool on shutdown. I use that to move the PreferencesTool
directly before EventsTool so that the preferences can be still fetched
until the very last moment in shutdown.

>You're calling PyDS.Tool.getToolsForShutdown twice, just like you used to
>getTools. Is there anything wrong with saving the value and using it twice?


Changed that, although it really doesn't matter much - the shutdown is only
called once in a running instance ;-)

>Could you drop in this latest version of DorothyLocker? You're now a fair
>way behind, and I've lost track of when I fixed certain bugs. That might

Did that. But it would really be a bit better if you stick to CVS mechanisms
- just do an update and merge in the changes I commited and then reproduce
your patch with regard to current CVS. It's much more likely that I put in a
working patch than full module sources, as the latter would require me to
make the diff myself to see what changed. And I am known to be lazy ;-)

For example this time: after adding the full module I could'nt start PyDS,
because of some changes to the interface of DorothyLocker that required
additional patches. But your patch didn't work, as your full module already
was installed. Mixing different patch/dist methods allways makes things more
complicated.

Oh, and now the CVS is broken. One thing was a small typo in Tool.py (wrong
indention) that was easily fixed. But now it barfs about "sequence must be
integer" on start. What's that? It happens in your __getitem__ method in
your FramingContext where it accesses the framestack (line 103). Looks like
ltrim_common doesn't produce integers as index somehow (maybe pos not
initialized?). This happens directly at startup of PyDS:

Exception exceptions.TypeError: sequence index must be integer
('/opt/pyds/lib/python2.2/site-packages/PyDS/Tool.py', 1407, 
'_release', 'return self.lock.release()')
('/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py', 359, 
'release', "self.__sanity_check('release', my_context)")
('/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py', 260, 
'__sanity_check', 'lock_uniques, my_uniques = 
ltrim_common(lock_context, my_context)')
('/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py', 54, 
'ltrim_common', 'return oblist1[pos:], oblist2[pos:]')
('/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py', 103, 
'__getitem__', 'return self.framestack[index]')
Traceback (most recent call last):
   File "/opt/pyds/bin/pyds-start", line 51, in ?
     PyDS.Server.start_server(daemon=_PyDS.daemon)
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/Server.py", line 
298, in start_server
     PyDS.Tool.initTools(PyDS.Tool.mainstatus)
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/Tool.py", line 317, 
in initTools
     tool._initdb()
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/WeblogTool.py", line 
77, in _initdb
     finally: self._release()
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/Tool.py", line 1407, 
in _release
     return self.lock.release()
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py", 
line 359, in release
     self.__sanity_check('release', my_context)
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py", 
line 260, in __sanity_check
     lock_uniques, my_uniques = ltrim_common(lock_context, my_context)
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py", 
line 54, in ltrim_common
     return oblist1[pos:], oblist2[pos:]
   File "/opt/pyds/lib/python2.2/site-packages/PyDS/DorothyLocker.py", 
line 103, in __getitem__
     return self.framestack[index]
TypeError: sequence index must be integer


>also be behind some of the performance hits you're seeing (I used the
>latest, assuming you'd incorporated it after that submission I made that
got
>blocked for size).

I usually write about what I commited (and at least it's in the CVS RSS
feed). So if you don't see me mentioning it, it supposedly isn't in CVS. I
either wasn't able to apply it (then I usually write something) or I just
plain missed it.

bye, Georg