Author: tmckay
Date: 2011-08-26 18:22:16 +0000 (Fri, 26 Aug 2011)
New Revision: 4937
Modified:
trunk/sage/python/sage/wallaby/wallabyoperations.py
Log:
Add basic facilities to cache feature lists, make use of new isTag() and addTag() routines
to better support tagging.
BZ733365
BZ733367
Modified: trunk/sage/python/sage/wallaby/wallabyoperations.py
===================================================================
--- trunk/sage/python/sage/wallaby/wallabyoperations.py 2011-08-26 14:18:11 UTC (rev
4936)
+++ trunk/sage/python/sage/wallaby/wallabyoperations.py 2011-08-26 18:22:16 UTC (rev
4937)
@@ -25,6 +25,7 @@
NODES = "nodes"
GROUPS = "groups"
TAGS = "tags"
+ FEATURES = "features"
if imports_ok:
class WallabyOperations(object):
@@ -70,9 +71,10 @@
# an attribute on the Wallaby Store object, with the exception of
# WBTypes.TAGS. The TAGS data is a subset of the GROUPS produced
# in this module.
- self._cache = {WBTypes.NODES: self.CacheData(refresh_interval),
- WBTypes.GROUPS: self.CacheData(refresh_interval),
- WBTypes.TAGS: self.CacheData(refresh_interval,
+ self._cache = {WBTypes.NODES: self.CacheData(refresh_interval),
+ WBTypes.GROUPS: self.CacheData(refresh_interval),
+ WBTypes.FEATURES: self.CacheData(refresh_interval),
+ WBTypes.TAGS: self.CacheData(refresh_interval,
synthetic=self._generate_tag_data)}
# Cache a list of nodes that are members of a tag
@@ -350,6 +352,15 @@
'''
return self._lookup_by_name(WBTypes.TAGS, name)
+ def get_feature_by_name(self, name):
+ '''
+ Return a cached wallaby.Feature object by name.
+
+ If name does not designate a currently cached
+ object, None is returned.
+ '''
+ return self._lookup_by_name(WBTypes.FEATURES, name)
+
def get_node_names(self, tag):
'''
Return a list of node names associated with the tag.
@@ -393,7 +404,7 @@
Refresh the cached lists of groups and tags.
'''
try:
- self._store.addExplicitGroup(name)
+ self._store.addTag(name)
self.refresh((WBTypes.GROUPS,WBTypes.TAGS))
except Exception, e:
log.debug("WallabyOperations: create_tag, exception suppressed,
%s" % str(e))
@@ -503,8 +514,7 @@
nodes_by_tag = dict()
for g in groups:
if not g.name.startswith("+++") and \
- g.name != self._partition_group and \
- g.getConfig() == {}:
+ self._store.isTag(g):
tags.append(g)
nodes = g.membership()
nodes_by_tag[g.name] = nodes
Show replies by date