def _runServiceById(sid, proto_func): ftlog.info("run service:", sid) _initProtocol(sid, proto_func) stackless.set_schedule_callback(_tasklet_schedule_cb) if REACTOR_RUN_NORMAL: mainloop() return stackless.tasklet(mainloop)() stackless.run()
def _runServiceById(sid, proto_func): ftlog.info("run service:", sid) _initProtocol(sid, proto_func) stackless.set_schedule_callback(_tasklet_schedule_cb) if REACTOR_RUN_NORMAL: mainloop() return stackless.tasklet(mainloop)() stackless.run()
def saveRoomInfo(gameId, roomInfo): pass def removeRoomInfo(gameId, roomId): pass if __name__ == '__main__': ftlog.initLog('groupmatch.log', './logs/') matchId = 6057 masterRoomId = 60571 areaRoomIds = [60571] roominfo.saveRoomInfo = saveRoomInfo roominfo.removeRoomInfo = removeRoomInfo roominfo.loadRoomInfo = loadRoomInfo matchConf = MatchConfig.parse(6, 60571, 6057, '满3人开赛', match_conf['matchConf']) signerInfoLoader = SignerInfoLoaderTest() areas = [] master = buildMatchMaster(masterRoomId, matchId, matchConf) for areaRoomId in areaRoomIds: area = buildMatchArea(areaRoomId, matchId, matchConf, master) areas.append(area) master.addArea(area) master.startHeart() MatchChecker(master, areas, signerInfoLoader).startHeart() reactor.mainloop()
(code, body)) if code == 200: return 0, uploadPath ftlog.info('uploader.uploadVideo Fail uploadUrl=', uploadUrl, 'uploadPath=', uploadPath, 'token=', token, 'ret=', (code, body)) return -1, '上传失败' except: return -2, '上传失败' if __name__ == '__main__': uploadUrl = 'http://up.wcsapi.biz.matocloud.com:8090/file/upload' token = '87c953283acaba7e75340fccad71c97b047569c2:MjEwN2QyMzI2NzAwNDNjYTMzYmQyYjFiYzJiMWRmODg5NDU0YmEyNQ==:eyJzY29wZSI6InR5aGFsbCIsImRlYWRsaW5lIjoiMTQ4NTUyMjU3MDAwMCIsIm92ZXJ3cml0ZSI6MCwiZnNpemVMaW1pdCI6MCwiaW5zdGFudCI6MCwic2VwYXJhdGUiOjB9' uploadUrl = 'http://zxty.up0.v1.wcsapi.com/file/upload' uploadUrl = 'http://192.168.56.200:9300/file/upload' token = '87c953283acaba7e75340fccad71c97b047569c2:OGZhZWE0MDEzZWQ5ZTU5OTdiNmJhY2YwZWNhNzc1MDMxNzAzYzAyYw==:eyJzY29wZSI6InR5aGFsbCIsImRlYWRsaW5lIjoiMTQ4NjY5ODIxNzAwMCIsIm92ZXJ3cml0ZSI6MCwiZnNpemVMaW1pdCI6MCwiaW5zdGFudCI6MCwic2VwYXJhdGUiOjB9' from freetime.core.reactor import mainloop def runUpload(): ec, info = uploadVideo(uploadUrl, token, 'ztest_video_4.txt', 'videoData_23456') print 'runupload ec=', ec, 'info=', info argd = {'handler': runUpload} FTTasklet.create([], argd) mainloop()
'uploadPath=', uploadPath, 'token=', token, 'ret=', (code, body)) if code == 200: return 0, body ftlog.info('uploader.uploadVideo Res uploadUrl=', uploadUrl, 'uploadPath=', uploadPath, 'token=', token, 'ret=', code) return -1, '上传失败' except: return -2, '上传失败' if __name__ == '__main__': uploadUrl = 'http://up.wcsapi.biz.matocloud.com:8090/file/upload/' token = '87c953283acaba7e75340fccad71c97b047569c2:MjEwN2QyMzI2NzAwNDNjYTMzYmQyYjFiYzJiMWRmODg5NDU0YmEyNQ==:eyJzY29wZSI6InR5aGFsbCIsImRlYWRsaW5lIjoiMTQ4NTUyMjU3MDAwMCIsIm92ZXJ3cml0ZSI6MCwiZnNpemVMaW1pdCI6MCwiaW5zdGFudCI6MCwic2VwYXJhdGUiOjB9' from freetime.core.reactor import mainloop def runUpload(): ec, info = uploadVideo(uploadUrl, token, 'util1.py', zlib.compress('util.py')) print 'runupload ec=', ec, 'info=', info argd = {'handler': runUpload} FTTasklet.create([], argd) mainloop()