Commit dc19d241 authored by Antoine Catton's avatar Antoine Catton

Revert "Switch poor man list queue to optimized collections.deque"

It is not allowed to access to collections.deque in a python script.
Let switch back to poor man queue using python native lists.

This reverts commit 18060ee5.

Conflicts:

	master/bt5/vifib_base/bt/revision
parent 788cc0d8
...@@ -50,9 +50,7 @@ ...@@ -50,9 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>import collections\n <value> <string>software_instance = state_change[\'object\']\n
\n
software_instance = state_change[\'object\']\n
portal = software_instance.getPortalObject()\n portal = software_instance.getPortalObject()\n
\n \n
root_hosting_subscription = portal.portal_catalog.getResultValue(uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid())\n root_hosting_subscription = portal.portal_catalog.getResultValue(uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid())\n
...@@ -61,9 +59,12 @@ root_software_instance = root_hosting_subscription.HostingSubscription_requestRo ...@@ -61,9 +59,12 @@ root_software_instance = root_hosting_subscription.HostingSubscription_requestRo
\n \n
# Use iterative algorithm instead of recursive approach in order to avoid\n # Use iterative algorithm instead of recursive approach in order to avoid\n
# complexity as much as possible.\n # complexity as much as possible.\n
flat_tree = collections.deque([root_software_instance])\n flat_tree = [root_software_instance]\n
while flat_tree:\n while True:\n
software_instance = flat_tree.popleft()\n try:\n
software_instance = flat_tree.pop(0)\n
except:\n
break\n
flat_tree.extend(software_instance.getPredecessorValueList())\n flat_tree.extend(software_instance.getPredecessorValueList())\n
try:\n try:\n
software_instance.Item_getInstancePackingListLine(service_relative_url=portal.portal_preferences.getPreferredInstanceCleanupResource())\n software_instance.Item_getInstancePackingListLine(service_relative_url=portal.portal_preferences.getPreferredInstanceCleanupResource())\n
......
...@@ -52,8 +52,6 @@ ...@@ -52,8 +52,6 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
import collections\n
\n
software_instance = state_change[\'object\']\n software_instance = state_change[\'object\']\n
portal = software_instance.getPortalObject()\n portal = software_instance.getPortalObject()\n
# Get required arguments\n # Get required arguments\n
...@@ -78,9 +76,12 @@ root_hosting_subscription = software_instance.portal_catalog.getResultValue(\n ...@@ -78,9 +76,12 @@ root_hosting_subscription = software_instance.portal_catalog.getResultValue(\n
uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid(),\n uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid(),\n
)\n )\n
\n \n
predecessor_list = collections.deque(root_hosting_subscription.getPredecessorValueList())\n predecessor_list = root_hosting_subscription.getPredecessorValueList()\n
while predecessor_list:\n while True:\n
software_instance = predecessor_list.popleft()\n try:\n
software_instance = predecessor_list.pop(0)\n
except IndexError:\n
break\n
software_instance_predecessor_list = software_instance.getPredecessorValueList() or []\n software_instance_predecessor_list = software_instance.getPredecessorValueList() or []\n
graph[software_instance.getUid()] = [predecessor.getUid()\n graph[software_instance.getUid()] = [predecessor.getUid()\n
for predecessor in software_instance_predecessor_list]\n for predecessor in software_instance_predecessor_list]\n
......
335 336
\ No newline at end of file \ 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