Commit 85b18536 authored by Klaus Wölfel's avatar Klaus Wölfel Committed by Levin Zimmermann

Add script to reprocess data analysis from scratch

levin: This cherry-picks the latest version of the
'DataAnalysis_clearAndReprocessFromScratch' script from a customer
project. It's needed to successfully run the 'refresh' workflow [1]
and was perhaps forgotten to be added in nexedi/wendelin!31.

[1] https://lab.nexedi.com/nexedi/wendelin/blob/04787344/bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_executeDataAnalysisList.py#L37
parent 6f5af085
# only refresh if causalility analysis is not refreshing
for data_analysis in context.getCausalityValueList(portal_type="Data Analysis"):
if data_analysis.getRefreshState() in ("refresh_planned", "refresh_started"):
return "Refresh not started because causality analysis refresh not finished"
for line in context.objectValues(portal_type="Data Analysis Line"):
if line.getResourceValue().getPortalType() == "Data Product" and line.getQuantity() == -1:
progress_indicator = line.getAggregateProgressIndicatorValue()
if progress_indicator is not None:
progress_indicator.setIntOffsetIndex(0)
progress_indicator.setStringOffsetIndex('')
if line.getResourceValue().getPortalType() == "Data Product" and line.getQuantity() == 1:
data_array = line.getAggregateDataArrayValue()
if data_array is not None:
data_array.setArray(None)
data_array.setStartDate(None)
data_array.manage_delObjects(list(data_array.keys()))
if context.getRefreshState() != "refresh_started":
context.startRefresh()
context.activate(serialization_tag=str(context.getUid())).DataAnalysis_executeDataOperation()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DataAnalysis_clearAndReprocessFromScratch</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