Example #1
0
from modules import mnode, Mqueue
from modules import meeting
from actions import db_writebacker, m_announcer

#logging.basicConfig(level=logging.DEBUG, filename='sm_server.log', filemode='w', format='(%(funcName)-10s) %(message)s')
#loger = logging.getLogger()
loger.debug("starting server now...")
# 初始化db连接池
if sys.platform.startswith('win'):
    com_cons = com_con('test', cur_config.testdb, length=2, debug=True)
else:
    com_cons = com_con('test', cur_config.dbserver, length=3, debug=True)
Qer.set_con_pool(com_cons)

# 初始化管理队列
Mqueue.set_announcer(m_announcer)
Mqueue.set_dbwritebacker(db_writebacker)
Mqueue.set_synctime()


# 处理手动关闭ctrl+c
def signal_shutdown(sig, frame):
    Mqueue.stop_syc()
    print('mqueue over')
    com_cons.shutdown()
    print("cons shutdown")
    loger.warning("Manual Shutdown.")
    sys.exit(0)


# 从数据库加载会议队列到内存
Example #2
0
from libs import com_con,Qer
from tschool import myschool
import wxmnp
from cur_config import cur_config, logging
from modules import Mqueue
from modules import meeting

#logging.basicConfig(level=logging.DEBUG, filename='sm_server.log', filemode='w', format='(%(funcName)-10s) %(message)s')
loger = logging.getLogger()
loger.debug("starting server now...")
# 初始化db连接池
com_cons = com_con('test', cur_config.testdb, length=3, debug=True)
Qer.set_con_pool(com_cons)
# 初始化管理队列
Mqueue.set_announcer(None)
Mqueue.set_dbwritebacker(None)
Mqueue.set_synctime()
# 从数据库加载会议队列到内存
for m in meeting.load_all_meetings(datetime.today()):
	print(m)
	keys = meeting.key_list
	_mid = m[0]
	_objid = m[1]
	_name = m[2]
	_ondate = m[8]
	_ontime = m[9]
	_mtime = m[10]
	_rpmode = m[12]
	_rparg = m[13]
	node = mnode(_mid, _name, rpmode=_rpmode, rparg=_rparg, ondate=_ondate, ontime=_ontime, holdtime=_mtime)