Exemplo n.º 1
0
    def ListQueues(self):         
        queue = QUEUE()
        queues = queue.ListQueues()
        labels = ('Name', 'href', 'metadata')
        rows = []

        for queue in queues:
            rows.append((str(queue['name']), str(queue['href']), str(queue['metadata'])))
        
        to = TableOutput()
        print to.indent([labels] + rows, hasHeader=True, separateRows=True, prefix='| ', postfix=' |')

        return
Exemplo n.º 2
0
    def GetQueueStats(self):
        name = ainput("Queue Name: ").getString()

        queue = QUEUE()
        stats = queue.GetQueueStats(name)
        labels = ('Queue', 'Free', 'Claimed')
        rows = []

        rows.append((name, str(stats['messages']['free']), str(stats['messages']['claimed'])))
        
        to = TableOutput()
        print to.indent([labels] + rows, hasHeader=True, separateRows=True, prefix='| ', postfix=' |')
    
        return
Exemplo n.º 3
0
    def run(self):
        while not self.kill_received:
            # get a list of queues
            print "Retrieving Queue Stats..."
            queues = self.queue.ListQueues()
            labels = ("Name", "Free Messages", "Claimed Messages")
            rows = []

            # print the queue details
            for q in queues:
                stats = self.queue.GetQueueStats(str(q["name"]))
                rows.append((str(q["name"]), str(stats["messages"]["free"]), str(stats["messages"]["claimed"])))

            to = TableOutput()
            print to.indent([labels] + rows, hasHeader=True, separateRows=True, prefix="| ", postfix=" |")

            # sleep for a bit
            time.sleep(2)

        print "Updater exiting"
        return