Esempio n. 1
0
def handle_activity(bot, ievent):
    """ no arguments - show running threads. """
    try: import threading
    except ImportError:
         ievent.reply("threading is not enabled.")
         return
    result = {}
    todo = threadloops
    for thread in threadloops:
        name = "%s_%s" % (getname(type(thread)), thread.name)
        try: result[name] = date.duration(thread.lastiter, plain=True)
        except Exception, ex: logging.warn("%s - %s" % (name, str(ex))) 
    for b in getfleet().bots:
        try: result[b.cfg.name] = date.duration(b.lastiter, plain=True)
        except Exception, ex: logging.warn("%s - %s" % (name, str(ex))) 
        
    ievent.reply("last iterations: ", result)
Esempio n. 2
0
def handle_activity(bot, ievent):
    """ no arguments - show running threads. """
    try:
        import threading
    except ImportError:
        ievent.reply("threading is not enabled.")
        return
    result = {}
    todo = threadloops
    for thread in threadloops:
        name = "%s_%s" % (getname(type(thread)), thread.name)
        try:
            result[name] = date.duration(thread.lastiter, plain=True)
        except Exception, ex:
            logging.warn("%s - %s" % (name, str(ex)))
Esempio n. 3
0
    try:
        import threading
    except ImportError:
        ievent.reply("threading is not enabled.")
        return
    result = {}
    todo = threadloops
    for thread in threadloops:
        name = "%s_%s" % (getname(type(thread)), thread.name)
        try:
            result[name] = date.duration(thread.lastiter, plain=True)
        except Exception, ex:
            logging.warn("%s - %s" % (name, str(ex)))
    for b in getfleet().bots:
        try:
            result[b.cfg.name] = date.duration(b.lastiter, plain=True)
        except Exception, ex:
            logging.warn("%s - %s" % (name, str(ex)))

    ievent.reply("last iterations: ", result)


cmnds.add('activity', handle_activity, ['USER', 'GUEST'])
examples.add('activity', 'show time past last thread iteration', 'activity')

## threads command


def handle_threads(bot, ievent):
    """ no arguments - show running threads. """
    try: