Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos.core
Commits
18060ee5
Commit
18060ee5
authored
Nov 30, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch poor man list queue to optimized collections.deque
parent
98b7f177
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
14 deletions
+12
-14
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_bangSoftwareInstanceTree.xml
...low/scripts/SoftwareInstance_bangSoftwareInstanceTree.xml
+6
-7
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
...flow/scripts/SoftwareInstance_requestSoftwareInstance.xml
+5
-6
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
No files found.
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_bangSoftwareInstanceTree.xml
View file @
18060ee5
...
...
@@ -50,7 +50,9 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
software_instance = state_change[\'object\']\n
<value>
<string>
import collections\n
\n
software_instance = state_change[\'object\']\n
portal = software_instance.getPortalObject()\n
\n
root_hosting_subscription = portal.portal_catalog.getResultValue(uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid())\n
...
...
@@ -59,12 +61,9 @@ root_software_instance = root_hosting_subscription.HostingSubscription_requestRo
\n
# Use iterative algorithm instead of recursive approach in order to avoid\n
# complexity as much as possible.\n
flat_tree = [root_software_instance]\n
while True:\n
try:\n
software_instance = flat_tree.pop(0)\n
except:\n
break\n
flat_tree = collections.deque([root_software_instance])\n
while flat_tree:\n
software_instance = flat_tree.popleft()\n
flat_tree.extend(software_instance.getPredecessorValueList())\n
try:\n
software_instance.Item_getInstancePackingListLine(service_relative_url=portal.portal_preferences.getPreferredInstanceCleanupResource())\n
...
...
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
View file @
18060ee5
...
...
@@ -52,6 +52,8 @@
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
import collections\n
\n
software_instance = state_change[\'object\']\n
portal = software_instance.getPortalObject()\n
# Get required arguments\n
...
...
@@ -76,12 +78,9 @@ root_hosting_subscription = software_instance.portal_catalog.getResultValue(\n
uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid(),\n
)\n
\n
predecessor_list = root_hosting_subscription.getPredecessorValueList()\n
while True:\n
try:\n
software_instance = predecessor_list.pop(0)\n
except IndexError:\n
break\n
predecessor_list = collections.deque(root_hosting_subscription.getPredecessorValueList())\n
while predecessor_list:\n
software_instance = predecessor_list.popleft()\n
software_instance_predecessor_list = software_instance.getPredecessorValueList() or []\n
graph[software_instance.getUid()] = [predecessor.getUid()\n
for predecessor in software_instance_predecessor_list]\n
...
...
master/bt5/vifib_base/bt/revision
View file @
18060ee5
333
\ No newline at end of file
334
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment