def main(argc, argv): os.chdir(sys.path[0]) #init logging system, it's told logging is threadsafe, so do NOT need to sync logging.basicConfig(format = '%(asctime)s - %(levelname)s: %(message)s', level=logging.DEBUG, stream = sys.stdout) #init constants timeout_buildserver = 0 workerId = '33e71796-7aea-4ff9-a24b-33cdd7812a1f' nickname = 'BDMV414' while True: ws_service = None try: #make connection to wsserver logging.info('try connectting to server') opts = list() opts.append('sid: %s' % workerId) ws_service = websocketclt.create_connection("ws://10.52.156.21:13412/buildserver", timeout = timeout_buildserver, sockopt = ((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),), header = opts) logging.info('server connected') #main logic mainLoop(ws_service, workerId, nickname) except Exception,e: logging.error(e) logging.error('failed to connect to server') logging.info('sleep 5 seconds and try again ...') time.sleep(5)
def main(argc, argv): os.chdir(sys.path[0]) #init logging system, it's told logging is threadsafe, so do NOT need to sync logging.basicConfig(format = '%(asctime)s - %(levelname)s: %(message)s', level=logging.DEBUG, stream = sys.stdout) #init constants timeout_buildserver = 0 workerId = '72beef83-8fc8-43b6-aebc-f2b473dd1653' nickname = 'KVBeta3Dev' while True: ws_service = None try: #make connection to wsserver logging.info('try connectting to server') opts = list() opts.append('sid: %s' % workerId) ws_service = websocketclt.create_connection("ws://10.52.156.21:13412/buildserver", timeout = timeout_buildserver, sockopt = ((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),), header = opts) logging.info('server connected') #main logic mainLoop(ws_service, workerId, nickname) except Exception,e: logging.error(e) logging.error('failed to connect to server') logging.info('sleep 5 seconds and try again ...') time.sleep(5)
def main(argc, argv): os.chdir(sys.path[0]) # init logging system, it's told logging is threadsafe, so do NOT need to sync logging.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=logging.DEBUG, stream=sys.stdout) # init constants timeout_buildserver = 0 workerId = "86abb4c5-ebd4-4838-b024-dd524ee292f1" nickname = "KV1.3Antivirus" while True: ws_service = None try: # make connection to wsserver logging.info("try connectting to server") opts = list() opts.append("sid: %s" % workerId) ws_service = websocketclt.create_connection( "ws://10.52.156.21:13412/buildserver", timeout=timeout_buildserver, sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),), header=opts, ) logging.info("server connected") # main logic mainLoop(ws_service, workerId, nickname) except Exception, e: logging.error(e) logging.error("failed to connect to server") logging.info("sleep 5 seconds and try again ...") time.sleep(5)
def main(argc, argv): if argc != 2: print 'usage:python cron_client.py <nickname>' return #init logging system, it's told logging is threadsafe, so do NOT need to sync logging.basicConfig(format='%(asctime)s - %(levelname)s: %(message)s', level=logging.DEBUG, stream=sys.stdout) timeout_buildserver = 0 opts = list() while True: ws_service = None try: #make connection to wsserver logging.info('try connectting to server') ws_service = websocketclt.create_connection( "ws://10.52.156.21:13412/buildserver", timeout=timeout_buildserver, sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1), ), header=opts) logging.info('cron-client connected') #ws_service.send('{"msrc":"ws-client-connect","content":""}') logging.info('build nickname : %s' % argv[1]) if cron_tasks.has_key(argv[1]): logging.info('build command : %s' % cron_tasks[argv[1]]) ws_service.send(cron_tasks[argv[1]]) logging.info('message sent, program quit') break else: logging('can not find specific build nickname, program quit') except Exception, e: logging.error(e) time.sleep(5)
def main(argc, argv): if argc != 2: print "usage:python cron_client.py <nickname>" return # init logging system, it's told logging is threadsafe, so do NOT need to sync logging.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=logging.DEBUG, stream=sys.stdout) timeout_buildserver = 0 opts = list() while True: ws_service = None try: # make connection to wsserver logging.info("try connectting to server") ws_service = websocketclt.create_connection( "ws://10.52.156.21:13412/buildserver", timeout=timeout_buildserver, sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),), header=opts, ) logging.info("cron-client connected") # ws_service.send('{"msrc":"ws-client-connect","content":""}') logging.info("build nickname : %s" % argv[1]) if cron_tasks.has_key(argv[1]): logging.info("build command : %s" % cron_tasks[argv[1]]) ws_service.send(cron_tasks[argv[1]]) logging.info("message sent, program quit") break else: logging("can not find specific build nickname, program quit") except Exception, e: logging.error(e) time.sleep(5)