[Erp5-report] r11291 - /erp5/trunk/utils/ooodoc_server/serw.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 14 12:44:03 CET 2006


Author: bartek
Date: Tue Nov 14 12:44:00 2006
New Revision: 11291

URL: http://svn.erp5.org?rev=11291&view=rev
Log:
catch exception if ooo instance is not responding (not started or killed for other reasons) and restart worker

Modified:
    erp5/trunk/utils/ooodoc_server/serw.py

Modified: erp5/trunk/utils/ooodoc_server/serw.py
URL: http://svn.erp5.org/erp5/trunk/utils/ooodoc_server/serw.py?rev=11291&r1=11290&r2=11291&view=diff
==============================================================================
--- erp5/trunk/utils/ooodoc_server/serw.py (original)
+++ erp5/trunk/utils/ooodoc_server/serw.py Tue Nov 14 12:44:00 2006
@@ -34,6 +34,7 @@
 import lib
 import config
 import pool
+from com.sun.star.uno import RuntimeException as unoRuntimeException
 
 nulltrans=string.maketrans('','')
 remother=nulltrans.translate(nulltrans,string.letters)
@@ -122,7 +123,7 @@
       f.write(base64.decodestring(kw['data']))
       f.close()
       kw['filename']=filename
-    return w
+    return id,w
 
   def _safeRemove(self,filename):
     '''remove a file or log warning if none exists'''
@@ -161,7 +162,7 @@
       kw=dict(zip(argtpl,args))
       try:
         try:
-          w=self._pre(kw)
+          id,w=self._pre(kw)
           print 'running',func.__name__
           res=func(w,kw) # XXX am I sure it is threadsafe?
           if kw.get('newfilename') is None:
@@ -193,6 +194,10 @@
             else:
               kw['data']=base64.encodestring(open(self._mkName(kw['newfilename'])).read())
           return kw
+	except  unoRuntimeException:
+	  print "unoRuntimeException in "+str(id)
+	  rebuilder=pool.pool.rebuild(id)()
+	  raise
         except Exception,e:
           print e
           traceback.print_tb(sys.exc_info()[2])




More information about the Erp5-report mailing list