Commit 2b79103c authored by Andreas Jung's avatar Andreas Jung

added logging of subtransaction commits

parent 5a285eb4
...@@ -32,6 +32,9 @@ class IProgressHandler(Interface): ...@@ -32,6 +32,9 @@ class IProgressHandler(Interface):
'max' -- maximum number of objects to be processed (int) 'max' -- maximum number of objects to be processed (int)
""" """
def info(text):
""" Log some 'text'"""
def finish(): def finish():
""" Called up termination """ """ Called up termination """
...@@ -61,6 +64,9 @@ class StdoutHandler: ...@@ -61,6 +64,9 @@ class StdoutHandler:
self.fp = sys.stdout self.fp = sys.stdout
self.output('Process started (%d objects to go)' % self._max) self.output('Process started (%d objects to go)' % self._max)
def info(self, text):
self.output(text)
def finish(self): def finish(self):
self.output('Process terminated. Duration: %0.2f seconds' % \ self.output('Process terminated. Duration: %0.2f seconds' % \
(time.time() -self._start)) (time.time() -self._start))
......
...@@ -289,7 +289,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -289,7 +289,7 @@ class ZCatalog(Folder, Persistent, Implicit):
obj = self.resolve_url(p, self.REQUEST) obj = self.resolve_url(p, self.REQUEST)
if obj is not None: if obj is not None:
try: try:
self.catalog_object(obj, p) self.catalog_object(obj, p, pghandler=pghandler)
except ConflictError: except ConflictError:
raise raise
except: except:
...@@ -491,7 +491,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -491,7 +491,7 @@ class ZCatalog(Folder, Persistent, Implicit):
# index via the UI # index via the UI
try: try:
self.catalog_object(obj, p, idxs=name, self.catalog_object(obj, p, idxs=name,
update_metadata=0) update_metadata=0, pghandler=pghandler)
except TypeError: except TypeError:
# Fall back to Zope 2.6.2 interface. This is necessary for # Fall back to Zope 2.6.2 interface. This is necessary for
# products like CMF 1.4.2 and earlier that subclass from # products like CMF 1.4.2 and earlier that subclass from
...@@ -501,7 +501,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -501,7 +501,7 @@ class ZCatalog(Folder, Persistent, Implicit):
warn('catalog_object interface of %s not up to date' warn('catalog_object interface of %s not up to date'
% self.__class__.__name__, % self.__class__.__name__,
DeprecationWarning) DeprecationWarning)
self.catalog_object(obj, p, idxs=name) self.catalog_object(obj, p, idxs=name, pghandler=pghandler)
if pghandler: if pghandler:
pghandler.finish() pghandler.finish()
...@@ -530,7 +530,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -530,7 +530,7 @@ class ZCatalog(Folder, Persistent, Implicit):
return Splitter.availableSplitters return Splitter.availableSplitters
def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1): def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1, pghandler=None):
""" wrapper around catalog """ """ wrapper around catalog """
if uid is None: if uid is None:
...@@ -572,6 +572,8 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -572,6 +572,8 @@ class ZCatalog(Folder, Persistent, Implicit):
get_transaction().commit(1) get_transaction().commit(1)
self._p_jar.cacheGC() self._p_jar.cacheGC()
self._v_total = 0 self._v_total = 0
if pghandler:
pghandler.info('commiting subtransaction')
def uncatalog_object(self, uid): def uncatalog_object(self, uid):
"""Wrapper around catalog """ """Wrapper around catalog """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment