Created
October 4, 2011 15:27
-
-
Save anonymous/1261935 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qmf.console import Session | |
import wallaby | |
from wallaby_collections import StorePatches | |
from tagging import StorePatches, NodePatches, setup | |
import datetime | |
#from wooly import memdebug | |
#memdebug.start(9999) | |
# create a new console object | |
console = Session() | |
# connect to the broker (on localhost:5672, by default) | |
console.addBroker() | |
# find the QMF object for the wallaby service | |
raw_store, = console.getObjects(_class="Store") | |
# wrap it up in a client object | |
store = wallaby.Store(raw_store, console) | |
# now, interact with it! | |
tag_base_name = "A Scripted tag" | |
numtags = 5 | |
def main(): | |
import cProfile | |
# create() | |
# remove() | |
# getPartGroup() | |
# getNodes() | |
# getGroups() | |
# getFeatures() | |
# cProfile.runctx('create()', globals(), locals(), "create.txt") | |
# cProfile.runctx('remove()', globals(), locals(), "remove.txt") | |
# cProfile.runctx('getPartGroup()', globals(), locals(), "getparts.txt") | |
for i in range(100): | |
print "%d" % i | |
cProfile.runctx('getNodes()', globals(), locals(), "getnodes.txt") | |
# cProfile.runctx('getGroups()', globals(), locals(), "getgroups.txt") | |
# cProfile.runctx('getFeatures()', globals(), locals(), "getfeatures.txt") | |
def getNodes(): | |
print "\nGetting nodes from wallaby store" | |
start() | |
nodes = getattr(store, "nodes", []) | |
now = datetime.datetime.now() | |
end() | |
print "The nodes have been fetched" | |
def start(): | |
now = datetime.datetime.now() | |
print "Start: %d:%d.%d" % (now.minute, now.second, now.microsecond) | |
def end(): | |
now = datetime.datetime.now() | |
print "End: %d:%d.%d" % (now.minute, now.second, now.microsecond) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment