Esempio n. 1
0
File: stats.py Progetto: brianr/uuss
def emit_stats():
    stats_log.info(json.dumps(
        {
            'pid': os.getpid(),
            'time': time.time(),
            'counts': dict([
                (func_name, wrapped._counter.get())
                for (func_name, (func, wrapped))
                in sorted(_counted_funcs.iteritems(), lambda a, b: cmp(a[0], b[0]))
                if wrapped._counter is not None])
        }))
Esempio n. 2
0
File: proto.py Progetto: brianr/uuss
 def _call(self, protocol, userstate, req, config):
     if userstate.is_remote:
         raise UUSSProtocolException(
             "DeleteRequest sent for user_id %r game %r but that game is remote. I will only delete userstates in my local games."
             % (req.user_id, req.game))
     with userstate.open(req.user_id, label='UUSS.Delete') as state:
         log.warn("[w:delete_userstate] Deleting userstate for user_id %r game %r, state follows\n%s", req.user_id, req.game, json.dumps(state))
         userstate.delete(req.user_id)
     
     resp = self.Response()
     resp.game = req.game
     resp.user_id = req.user_id
     yield resp