def stop(self): """Stop polling the subscription.""" if not self._run: print "ERROR: Test not started" return SUBSCRIPTION_MANAGER.destroy(self._sid) self._run = 0 self._sid = None return
def _poll(self): try: self._running = 1 if self._poll_all: changed_values = SUBSCRIPTION_MANAGER.poll_all(self._sid) else: changed_values = SUBSCRIPTION_MANAGER.poll_changed(self._sid) if changed_values: self._changed_values = changed_values self._values.update(changed_values) finally: self._schedule() return
def start(self): """Start the memory use test's thread.""" if self._run: print "ERROR: Test already started" return nrt = {} self._nids = [] getable_nodes = all_getable_nodes(self._anchor) for node in getable_nodes: node_url = as_node_url(node) self._nids.append(node_url) nrt[node_url] = node self._nids.sort() self._sid = SUBSCRIPTION_MANAGER.create_polled(nrt) self._run = 1 self._schedule() return
>>> p0.start() """ print 78*"*" return def help(): print 78*"*" + """ Interactive Functions: help() - Display this message. examples() - Display a bunch of test doc examples. new_polled() - Instanciate a new "memory use test." Returns an integer used to identify the test. Pass the returned integer to the subscriber() function to get a reference to the new test. The test object has a "help()" method providing information on interacting with the test. The test does not start running until the start() method is invoked.""" print 78*"*" if __name__ == '__main__': SUBSCRIPTION_MANAGER._set_tunable_parameters({'slow_poll_delay':0.5, 'untuned_poll_delay':0.0, }) SUBSCRIPTION_MANAGER.start() help()