Beispiel #1
0
basepath = os.path.dirname(__file__)
logging.config.fileConfig(basepath + "/../conf/log.conf")


class PublishThread(threading.Thread):
    def __init__(self, t):
        self.id = id
        self.m = "aadfaddaffdf"
        self.t = t
        threading.Thread.__init__(self)

    def run(self):
        times = range(10)
        for i in times:
            time.sleep(1)
            post(self.t, self.m + str(i))


if __name__ == '__main__':
    use(passport("jiugao", "1111"))
    t = tunnel("t1")
    threads = []
    threadnum = range(10)
    for i in threadnum:
        pt = PublishThread(t)
        pt.start()
        threads.append(pt)

    [t.join() for t in threads]
    release()
Beispiel #2
0
basepath = os.path.dirname(__file__)
logging.config.fileConfig(basepath + "/../conf/log.conf")

class PublishThread(threading.Thread):
    def __init__(self, t):
        self.id = id
        self.m = "aadfaddaffdf"
        self.t = t
        threading.Thread.__init__(self)
     
    def run(self):
        times = range(10)
        for i in times:
            time.sleep(1)
            post(self.t, self.m + str(i))


if __name__ == '__main__':
    use(passport("jiugao", "1111"))
    t = tunnel("t1")
    threads = []
    threadnum = range(10)
    for i in threadnum:
        pt = PublishThread(t)
        pt.start()
        threads.append(pt)
        
    [t.join() for t in threads] 
    release()
Beispiel #3
0

if __name__ == '__main__':
    topics = conf.get_topic_name().split(",")
    index = 0
    tail = []
    stop_flag = False

    if sys.platform != 'win32':
        daemonize()

    single = SingleInstance()

    if conf.get_test_path() == "null":
        use(
            passport(conf.get_passport().split(":")[0],
                     conf.get_passport().split(":")[1]))
        set_router(conf.get_routers())

    for topic in topics:
        t = Tail(index, conf)
        tail.append(t)
        index += 1
        logger.error("Tail file for topic: " + topic)

    def stop(n=0, e=0):
        global stop_flag
        logger.error("stopping.....")
        for t in tail:
            logger.error("stopping " + str(t))
            try:
                t.join(60)
Beispiel #4
0
    os.dup2(so.fileno(), sys.stdout.fileno())
    os.dup2(se.fileno(), sys.stderr.fileno())

if __name__ == '__main__':
    topics = conf.get_topic_name().split(",")
    index = 0
    tail = []
    stop_flag = False
    
    if sys.platform != 'win32':
        daemonize()

    single=SingleInstance()

    if conf.get_test_path() == "null":
        use(passport(conf.get_passport().split(":")[0], conf.get_passport().split(":")[1]))
        set_router(conf.get_routers())
        
    for topic in topics:
        t = Tail(index, conf)
        tail.append(t)
        index += 1
        logger.error("Tail file for topic: " + topic)
        
    def stop(n=0, e=0):
        global stop_flag
        logger.error("stopping.....")
        for t in tail:
            logger.error("stopping " + str(t))
            try:
                t.join(60)