Commit 924f20fa authored by Sebastien Robin's avatar Sebastien Robin

simulation: solve random solving issues in a cluster environment

Before, when solving a solver, parsing sub objects of solver_process was done directly synchronously
in solver_workflow. And we had the case where you have parallel transactions solving a solver,
each of theses transactions see remaining solver not in solved state, but once all transaction are
finished, all solver are solved. This could lead to the case where solver_process is never moved
to succeeded. Instead of using serialize (which may lead to conflicts), just use activities in queue
with a serialization tag.
parent 1b087745
solver_process = state_change['object'].getParentValue()
for solver in solver_process.objectValues(
portal_type=solver_process.getPortalObject().getPortalTargetSolverTypeList()):
if solver.getValidationState() != 'solved':
return
solver_process.succeed()
# Before parsing sub objects was done directly here. And we had the
# case where you have parallel transactions solving a solver,
# each of theses transactions see remaining solver not in solved state,
# but once all transaction are finished, all solver are solved. This
# could lead to the case where solver_process is never moved to succeeded
# Instead of using serialize (which may lead to conflicts), just use
# activities in queue.
solver_process.activate(serialization_tag=solver_process.getRelativeUrl()
).SolverProcess_tryToSucceed()
solver_process = context
for solver in solver_process.objectValues(
portal_type=solver_process.getPortalObject().getPortalTargetSolverTypeList()):
if solver.getValidationState() != 'solved':
break
else:
portal = context.getPortalObject()
if portal.portal_workflow.isTransitionPossible(solver_process, 'succeed'):
solver_process.succeed()
<?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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SolverProcess_tryToSucceed</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