Commit 045bf494 authored by Yoshinori Okuji's avatar Yoshinori Okuji

2010-09-17 yo

* Add an utility script BusinessPath_build which can be used to unify the way of invoking global builds.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38444 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 30acbdff
<?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>_body</string> </key>
<value> <string># This script is a helper to perform a global build safely.\n
\n
builder = context.getDeliveryBuilderValue()\n
if builder is None:\n
raise RuntimeError(\'No delivery builder available in the business path %s\' % (context.getPath(),))\n
\n
# The key points are:\n
#\n
# - that making multiple deliveries when they should be merged must be avoided (safety)\n
# - that waiting for unrelated active objects to be finished should be avoided (low latency)\n
#\n
# There are two case worth considering. One of them is where new deliveries may be created.\n
# In this case, we must make sure that multiple builder processes (whether the same builder\n
# or different builders) would not run against the same delivery portal type under the same\n
# module, because they might need to merge deliveries. This case is a bit complicated, as\n
# delivery select methods often depend on the catalog, thus it is necessary to wait for\n
# the indexing of new deliveries.\n
#\n
# The other case is where no new deliveries may be created. This is typical when using\n
# trade model lines or simplified accounting. In this case, we only need to make sure that\n
# the same builder would not run in parallel, because the result is unpredictable when\n
# the builder selects the same movements. Besides that, there is no risk to run the builder,\n
# as the builder does no harm, even if it could not find updatable deliveries.\n
if builder.getDeliveryCreatable():\n
module_id = builder.getDeliveryModule()\n
delivery_portal_type = builder.getDeliveryPortalType()\n
serialization_tag = \'build:%s:%s\' % (module_id, delivery_portal_type)\n
indexing_tag = \'indexing:%s:%s\' % (module_id, delivery_portal_type)\n
after_tag = indexing_tag\n
# XXX actually, this parameter is used even for lines and cells as well as only modifying\n
# existing deliveries. So this implies that the builder may still wait unnecessarily.\n
activate_kw = dict(tag=indexing_tag)\n
else:\n
builder_uid = builder.getUid()\n
serialization_tag = \'build:%s\' % (builder_uid)\n
after_tag = None\n
activate_kw = None\n
\n
builder.activate(serialization_tag=serialization_tag, after_tag=after_tag) \\\n
.build(activate_kw=activate_kw)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>builder</string>
<string>None</string>
<string>RuntimeError</string>
<string>module_id</string>
<string>delivery_portal_type</string>
<string>serialization_tag</string>
<string>indexing_tag</string>
<string>after_tag</string>
<string>dict</string>
<string>activate_kw</string>
<string>builder_uid</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BusinessPath_build</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2010-09-17 yo
* Add an utility script BusinessPath_build which can be used to unify the way of invoking global builds.
2010-09-17 yo
* Add a flag to specify if a delivery builder may create any new deliveries or not.
......
843
\ No newline at end of file
845
\ No newline at end of file
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