def __init__(self, pdbhelper, rootcc, qmangr, to_eventprocessor, cshardmgr_interface): """@type pdbhelper: L{lobbyapp.playerdb.api.PDBHelperInterface} implementation. @type qmangr: L{lobbyapp.queuemangr.QueueManager} @param to_eventprocessor: Queue that can be used to send orders to EventProcessor @type to_eventprocessor: L{Queue.Queue} @param cshardmgr_interface: interface to CShardMgr @type cshardmgr_interface: tuple(str, int)""" Monitor.__init__(self) self.pirs = {} #: pid => PlayerInformationRecord self.cshardmgr_interface = cshardmgr_interface self.pdbhelper = pdbhelper self.qmangr = qmangr self.alphas = [] # all existing AlphaMatches self.betagammas = [] # all existing BetaGammas self.to_eventprocessor = to_eventprocessor cc = CounterCollection('player_database') self.transactions_counter = PulseCounter('transactions', resolution=60, units=u'transactions per minute', description=u'player database transactions performed') alphas_waiting = CallbackCounter('alphas_waiting', self.alphas.__len__, description=u'matches being prepared') betagammas = CallbackCounter('betagammas', self.betagammas.__len__, description=u'matches being played') cc.add(self.transactions_counter) cc.add(alphas_waiting) cc.add(betagammas) rootcc.add(cc)
def __init__(self, confsection): Monitor.__init__(self) self.conn = sqlite3.connect(confsection['path'], check_same_thread=False) # Check if table exists cur = self.conn.cursor() try: cur.execute('SELECT COUNT(rowid) FROM sent') except sqlite3.OperationalError: cur.execute('''CREATE TABLE sent ( rowid INTEGER PRIMARY KEY ASC, sent_on DATE NOT NULL, content BLOB NOT NULL, target TEXT NOT NULL, tag TEXT); ''') cur.execute('CREATE INDEX i_sent_sent_on ON sent (sent_on)') self.conn.commit() cur.close()
def __init__(self, pdbhelper, rootcc, qmangr, to_eventprocessor, cshardmgr_interface): """@type pdbhelper: L{lobbyapp.playerdb.api.PDBHelperInterface} implementation. @type qmangr: L{lobbyapp.queuemangr.QueueManager} @param to_eventprocessor: Queue that can be used to send orders to EventProcessor @type to_eventprocessor: L{Queue.Queue} @param cshardmgr_interface: interface to CShardMgr @type cshardmgr_interface: tuple(str, int)""" Monitor.__init__(self) self.pirs = {} #: pid => PlayerInformationRecord self.cshardmgr_interface = cshardmgr_interface self.pdbhelper = pdbhelper self.qmangr = qmangr self.alphas = [] # all existing AlphaMatches self.betagammas = [] # all existing BetaGammas self.to_eventprocessor = to_eventprocessor cc = CounterCollection('player_database') self.transactions_counter = PulseCounter( 'transactions', resolution=60, units=u'transactions per minute', description=u'player database transactions performed') alphas_waiting = CallbackCounter('alphas_waiting', self.alphas.__len__, description=u'matches being prepared') betagammas = CallbackCounter('betagammas', self.betagammas.__len__, description=u'matches being played') cc.add(self.transactions_counter) cc.add(alphas_waiting) cc.add(betagammas) rootcc.add(cc)
def __init__(self, namespace, description=None): Monitor.__init__(self) CounterObject.__init__(self, namespace, description=description) self.items = {}
def __init__(self, cqueue): self.cqueue = cqueue Monitor.__init__(self)