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
Pipeline #8012 failed with stage
in 0 seconds
<?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: ...@@ -46,7 +46,10 @@ else:
params['format'] = format_ params['format'] = format_
activity_context.activate( 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, localizer_language=localizer_language,
skin_name=skin_name, skin_name=skin_name,
request_form=request_form, request_form=request_form,
......
...@@ -29,8 +29,13 @@ request_other = portal.ERP5Site_filterRequestForDeferredStyle(request) ...@@ -29,8 +29,13 @@ request_other = portal.ERP5Site_filterRequestForDeferredStyle(request)
localizer_language = portal.Localizer.get_selected_language() localizer_language = portal.Localizer.get_selected_language()
context.activate(activity="SQLQueue", tag=tag, after_tag=after_tag, context.activate(
priority=priority).Base_computeReportSection( activity="SQLQueue",
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
tag=tag,
after_tag=after_tag,
priority=priority,
).Base_computeReportSection(
form=form.getId(), form=form.getId(),
request_other=request_other, request_other=request_other,
user_name=user.getId(), user_name=user.getId(),
......
...@@ -29,6 +29,7 @@ for idx, report_section in enumerate(report_section_list): ...@@ -29,6 +29,7 @@ for idx, report_section in enumerate(report_section_list):
else: else:
doc = context doc = context
doc.activate(activity='SQLQueue', doc.activate(activity='SQLQueue',
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
active_process=active_process, active_process=active_process,
tag=tag, tag=tag,
priority=priority, priority=priority,
...@@ -43,7 +44,12 @@ if activity_context == portal: ...@@ -43,7 +44,12 @@ if activity_context == portal:
# portal is not an active object # portal is not an active object
activity_context = portal.portal_simulation 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(), active_process_url=active_process.getRelativeUrl(),
skin_name=skin_name, skin_name=skin_name,
localizer_language=localizer_language, localizer_language=localizer_language,
......
...@@ -19,7 +19,10 @@ if prefs.getPreferredDeferredReportStoredAsDocument(): ...@@ -19,7 +19,10 @@ if prefs.getPreferredDeferredReportStoredAsDocument():
(attachment.get('title', document.getStandardFilename(format=format)), document.getRelativeUrl())) (attachment.get('title', document.getStandardFilename(format=format)), document.getRelativeUrl()))
# pre-convert document before sending notification # pre-convert document before sending notification
if format: 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() url_base = portal.ERP5Site_getAbsoluteUrl()
attachment_link_list = [ attachment_link_list = [
...@@ -53,7 +56,11 @@ if prefs.getPreferredDeferredReportStoredAsDocument(): ...@@ -53,7 +56,11 @@ if prefs.getPreferredDeferredReportStoredAsDocument():
message=message_html 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, recipient=user_name,
subject=subject, subject=subject,
message=message, message=message,
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<string>my_preferred_deferred_report_notification_message_reference</string> <string>my_preferred_deferred_report_notification_message_reference</string>
<string>my_preferred_deferred_report_classification</string> <string>my_preferred_deferred_report_classification</string>
<string>my_preferred_deferred_report_publication_section</string> <string>my_preferred_deferred_report_publication_section</string>
<string>my_preferred_deferred_report_activity_family</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ListField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_deferred_report_activity_family</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Activity Family to Compute Reports</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\', \'\')] + context.getPortalObject().portal_activities.getFamilyNameList()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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