In an earlier post, I presented a technique for adding node tagging to Wallaby without adding explicit tagging support to the Wallaby API. Node tags are useful for a variety of reasons: they can correspond to informal user-supplied classifications of nodes or machine-generated system attributes (e.g. "64-bit", "high-memory", "infiniband"). Since we implemented tags as special Wallaby groups, they may contain configuration information (although they don't need to) and will be advertised as one of the machine's Condor attributes.

The Wallaby source repository now includes a small Python module that patches the Wallaby python client library with idiomatic tagging support: namely, you can ask the store for the name of the group that represents the partition between tags and groups, and you can call getTags() and modifyTags() methods on Node objects, as well as inspect the tags property of a Node. This will appear in Wallaby packages in the future, but you don't have to be that adventurous to try it out now! To use it, clone the repository and put extensions/ and schema/ somewhere in your PYTHONPATH. Then follow along with this transcript:

import wallaby
# the "tagging" module patches the Wallaby client library with 
# support for tag operations
import tagging
# We'll start by setting up a Wallaby client library session against
# the broker on localhost
from qmf.console import Session
console = Session()
raw_store, = console.getObjects(_class="Store")
store = wallaby.Store(raw_store, console)
# call this method after the store client is initialized so that
# the tagging library knows how to create missing groups
# Clear out all of the memberships on a fake node
store.getNode("").modifyMemberships("REPLACE", [], {})
# After clearing a node's membership list, it will have no tags
# You can also access the tags of a given node via its "tags" attribute
# by convention, we're preceding tags with "@" here
store.getNode("").modifyTags("ADD", ["@Foo", "@Blitz"], create_missing_tags=True)
# This should return ["@Foo", "@Blitz"]
# This should return ["===TAGS_BELOW===", "@Foo", "@Blitz"]

I appreciate any feedback or comments on this library.

  htcondormrgwallaby • You may reply to this post on Twitter or