Exemple #1
0
    def __init__(self, confobj, oams, oxms, insmgr, osm):
        """
        @type confobj: L{eunike.config.ConfigurationObject}
        @type oams: dict(handle::str => OAMInterface)
        @type oxms: dict(handle::str => OXMInterface)
        @param insmgr: Instrumentation manager
        @type insmgr: satella.instrumentation.CounterCollection
        @param osm: OSM instance
        """
        BaseThread.__init__(self)

        self.config = confobj
        self.osm = osm
        self.bm = None  #: public, BackendManager

        register_objects(self, confobj, oams, oxms, insmgr)

        self.messages = []  # heap with messages

        insmgr.add(
            CallbackCounter("messages_in_queue", lambda: len(self.messages), None, u"Messages waiting to be sent")
        )

        try:
            with open(self.config["serialization_storage_path"], "rb") as msgfin:
                messages = pickle.load(msgfin)
                self.messages.extend(messages)
                heapq.heapify(self.messages)
        except:
            pass
Exemple #2
0
    def __init__(self, oxmi, recovery_message, cc, confsection):
        BaseThread.__init__(self)
        self.name = confsection['handle']
        self.comport, self.baudrate = confsection['serial_port'], confsection['serial_baudrate']
        self.notifier = SMTPNotifier(confsection)
        self.mk_serport()
        self.mte = None     #: message to execute
        self.interesting_shit = Lock()
        self.interesting_shit.acquire()
        self.oxm = oxmi
        self.conseq_reset = 0

        self.recovery_message = recovery_message

        self.is_attempting_recovery = False

        self.cc_hard_resets = PulseCounter('hard_resets',
            resolution=24*60*60, units='resets', 
            description=u'Hard resets during last 24 hours')
        self.cc_soft_resets = PulseCounter('soft_resets',
            resolution=24*60*60, units='resets', 
            description=u'Hard resets during last 24 hours')
        self.cc_send_time = NumericValueCounter('send_time',
            units='seconds', description='Time it took to send last SMS',
            history=20)


        cc.add(self.cc_hard_resets)
        cc.add(self.cc_soft_resets)
        cc.add(self.cc_send_time)
Exemple #3
0
    def __init__(self, pdb, rootcc):
        """
        @param pdb: PlayerDatabase
        @param rootcc: Root CounterCollection
        """
        BaseThread.__init__(self)
        self.pdb = pdb

        cc = CounterCollection(
            'alpha_counter',
            description=u'Module that creates games from hero picking rooms')
        self.matches_dt = PulseCounter('matches_made',
                                       resolution=60,
                                       units=u'matches per minute',
                                       description=u'successful allocations')
        self.matches_dt_so = PulseCounter(
            'matches_failed_so',
            resolution=60,
            units=u'matches per minute',
            description=u'fails to allocate due to shard overload')
        self.matches_dt_fl = PulseCounter(
            'matches_failed_fl',
            resolution=60,
            units=u'matches per minute',
            description=u'fails to allocate due to other reasons')
        cc.add(self.matches_dt)
        cc.add(self.matches_dt_so)
        cc.add(self.matches_dt_fl)
        rootcc.add(cc)
Exemple #4
0
    def __init__(self, pdb, rootcc):
        """
        @param pdb: PlayerDatabase
        @param rootcc: Root CounterCollection
        """
        BaseThread.__init__(self)
        self.pdb = pdb

        cc = CounterCollection('match_maker', 
                               description=u'Module that organizes matches from enqueued players')
        self.total_matches_made = DeltaCounter('matches_made', units=u'matches', description=u'total matches made')
        self.matches_dt = PulseCounter('matches_made_p', resolution=60, units=u'matches per minute',
                                       description=u'organized matches per minute')
        cc.add(self.total_matches_made)
        cc.add(self.matches_dt)
        rootcc.add(cc)
Exemple #5
0
    def __init__(self, pdb, rootcc):
        """
        @param pdb: PlayerDatabase
        @param rootcc: Root CounterCollection
        """
        BaseThread.__init__(self)
        self.pdb = pdb

        cc = CounterCollection('alpha_counter', 
                               description=u'Module that creates games from hero picking rooms')
        self.matches_dt = PulseCounter('matches_made', resolution=60, units=u'matches per minute',
                                       description=u'successful allocations')
        self.matches_dt_so = PulseCounter('matches_failed_so', resolution=60, units=u'matches per minute',
                                       description=u'fails to allocate due to shard overload')
        self.matches_dt_fl = PulseCounter('matches_failed_fl', resolution=60, units=u'matches per minute',
                                       description=u'fails to allocate due to other reasons')
        cc.add(self.matches_dt)
        cc.add(self.matches_dt_so)
        cc.add(self.matches_dt_fl)
        rootcc.add(cc)
Exemple #6
0
 def __init__(self, sl):
     BaseThread.__init__(self)
     self.sl = sl
Exemple #7
0
 def __init__(self, cp, tc):
     BaseThread.__init__(self)
     self.cp = cp  #: connection pool
     self.tc = tc  #: core test case
Exemple #8
0
 def __init__(self, pts, mc):
     BaseThread.__init__(self)
     self.pts = pts
     self.mc = mc
Exemple #9
0
 def __init__(self, phl):
     BaseThread.__init__(self)
     self.phl = phl
Exemple #10
0
 def __init__(self, idname, fail=False):
     """@param fail: whether to fail allocations"""
     BaseThread.__init__(self)
     self.fail = fail
     self.idname = idname
Exemple #11
0
 def __init__(self, sl):
     BaseThread.__init__(self)
     self.sl = sl
 def __init__(self, insmgr, confsection):
     BaseThread.__init__(self)
     self.interval = confsection['save_interval']
     self.savetarget = confsection['save_json_to']
     self.insmgr = insmgr
Exemple #13
0
 def __init__(self, eio, confsection):
     BaseThread.__init__(self)
     self.eio = eio
     self.dirscan = confsection['directory']
Exemple #14
0
 def __init__(self, idname, fail=False):
     """@param fail: whether to fail allocations"""
     BaseThread.__init__(self)
     self.fail = fail
     self.idname = idname
Exemple #15
0
 def __init__(self, interface, port, rootcc, use_tabled_layout=False):
     BaseThread.__init__(self)
     self.server = BHTIPIServer(interface, port, rootcc, use_tabled_layout)
Exemple #16
0
 def __init__(self, pts, mc):
     BaseThread.__init__(self)
     self.pts = pts
     self.mc = mc
Exemple #17
0
 def terminate(self):
     BaseThread.terminate(self)
     self.server.server_close()
Exemple #18
0
 def terminate(self):
     BaseThread.terminate(self)
     self.on_interesting_shit()
Exemple #19
0
 def __init__(self, phl):
     BaseThread.__init__(self)
     self.phl = phl