Commit fe8c1958 authored by Julien Muchembled's avatar Julien Muchembled

Update ERP5Catalog.searchAndActivate to match behaviour of new recurseCallMethod

This softens dependency to activate more objects even in case of failed
activities. The downside is that 'activity_count' can't be used to limit the
number of processing nodes.
parent 3332eadf
...@@ -51,7 +51,7 @@ from Products.ERP5Security import mergedLocalRoles ...@@ -51,7 +51,7 @@ from Products.ERP5Security import mergedLocalRoles
from Products.ERP5Security.ERP5UserManager import SUPER_USER from Products.ERP5Security.ERP5UserManager import SUPER_USER
from Products.ERP5Type.Utils import sqlquote from Products.ERP5Type.Utils import sqlquote
import os, time, urllib, warnings import os, urllib, warnings
import sys import sys
from zLOG import LOG, PROBLEM, WARNING, INFO from zLOG import LOG, PROBLEM, WARNING, INFO
...@@ -978,9 +978,6 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -978,9 +978,6 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
parameters) so that it can work efficiently with databases of any size. parameters) so that it can work efficiently with databases of any size.
'activate_kw' may specify an active process to collect results. 'activate_kw' may specify an active process to collect results.
Note however, we don't use Base_makeActiveResult so you're likely to get
ConflictError at the beginning. You could avoid this by making sure
'result_list' is already initialized on the active process.
""" """
catalog_kw = dict(kw) catalog_kw = dict(kw)
packet_size = catalog_kw.pop('packet_size', 30) packet_size = catalog_kw.pop('packet_size', 30)
...@@ -995,14 +992,10 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -995,14 +992,10 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
result_count = len(r) result_count = len(r)
if result_count: if result_count:
if result_count == limit: if result_count == limit:
tag = activate_kw.get('tag') next_kw = dict(activate_kw, priority=1+activate_kw.get('priority', 1))
if not tag: self.activate(activity='SQLQueue', **next_kw) \
activate_kw['tag'] = tag = 'searchAndActivate_%r' % time.time()
_tag = '%s_%s' % (tag, min_uid)
self.activate(tag=tag, after_tag=_tag, activity='SQLQueue') \
._searchAndActivate(method_id,method_args, method_kw, ._searchAndActivate(method_id,method_args, method_kw,
dict(activate_kw), r[-1].getUid(), **kw) activate_kw, r[-1].getUid(), **kw)
activate_kw['tag'] = _tag
r = [x.getPath() for x in r] r = [x.getPath() for x in r]
r.sort() r.sort()
activate = self.getPortalObject().portal_activities.activate activate = self.getPortalObject().portal_activities.activate
......
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