Commit 51fca55a authored by Jérome Perrin's avatar Jérome Perrin

deferred_style: Allow to configure an activity family

If set, all potentially long activities will be running on this family.

This can be used to prevent situation where all activities are no longer processed because all activity nodes are busy processing reports.
parent a8871500
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferred_deferred_report_activity_family_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>write_permission</string> </key>
<value> <string>Manage properties</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -46,7 +46,10 @@ else:
params['format'] = format_
activity_context.activate(
activity='SQLQueue', tag=tag, priority=priority).Base_renderSimpleView(
activity='SQLQueue',
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
tag=tag,
priority=priority,).Base_renderSimpleView(
localizer_language=localizer_language,
skin_name=skin_name,
request_form=request_form,
......
......@@ -29,8 +29,13 @@ request_other = portal.ERP5Site_filterRequestForDeferredStyle(request)
localizer_language = portal.Localizer.get_selected_language()
context.activate(activity="SQLQueue", tag=tag, after_tag=after_tag,
priority=priority).Base_computeReportSection(
context.activate(
activity="SQLQueue",
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
tag=tag,
after_tag=after_tag,
priority=priority,
).Base_computeReportSection(
form=form.getId(),
request_other=request_other,
user_name=user.getId(),
......
......@@ -29,6 +29,7 @@ for idx, report_section in enumerate(report_section_list):
else:
doc = context
doc.activate(activity='SQLQueue',
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
active_process=active_process,
tag=tag,
priority=priority,
......@@ -43,7 +44,12 @@ if activity_context == portal:
# portal is not an active object
activity_context = portal.portal_simulation
activity_context.activate(activity='SQLQueue', after_tag=tag, priority=priority).Base_report(
activity_context.activate(
activity='SQLQueue',
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
after_tag=tag,
priority=priority,
).Base_report(
active_process_url=active_process.getRelativeUrl(),
skin_name=skin_name,
localizer_language=localizer_language,
......
......@@ -19,7 +19,10 @@ if prefs.getPreferredDeferredReportStoredAsDocument():
(attachment.get('title', document.getStandardFilename(format=format)), document.getRelativeUrl()))
# pre-convert document before sending notification
if format:
document.activate(tag=pre_convert_tag).convert(format=format)
document.activate(
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
tag=pre_convert_tag,
).convert(format=format)
url_base = portal.ERP5Site_getAbsoluteUrl()
attachment_link_list = [
......@@ -53,7 +56,11 @@ if prefs.getPreferredDeferredReportStoredAsDocument():
message=message_html
)
portal.portal_notifications.activate(after_tag=pre_convert_tag, activity='SQLQueue').sendMessage(
portal.portal_notifications.activate(
activity='SQLQueue',
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
after_tag=pre_convert_tag,
).sendMessage(
recipient=user_name,
subject=subject,
message=message,
......
......@@ -76,6 +76,7 @@
<string>my_preferred_deferred_report_notification_message_reference</string>
<string>my_preferred_deferred_report_classification</string>
<string>my_preferred_deferred_report_publication_section</string>
<string>my_preferred_deferred_report_activity_family</string>
</list>
</value>
</item>
......
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