Example #1
0
    def clean_dead(self, age=30):
        time = datetime.now()
        active = filter(
            lambda s: time - self._services[s].time <= timedelta(0, age),
            self._services.keys())
        existing = self._services.keys()
        for pid in existing:
            if pid not in active:
                del self._services[pid]


from r2.config.templates import tpm
from r2.lib.wrapped import Wrapped

tpm.add('service_page', 'html', file="server_status_page.html")
tpm.add('service_page', 'htmllite', file="server_status_page.htmllite")


class Service_Page(Wrapped):
    def __init__(self, machines=default_servers):
        self.services = [Services(m) for m in machines]

    def __repr__(self):
        return "service page"


def Alert(restart_list=['MEM', 'CPU']):
    import time
    import smtplib
    import re
Example #2
0
        registry.replace(pylons.translator, translator)


comment = re.compile(r'\A\s*#')
msgid = re.compile(r'\A\s*msgid\s+"')
msgid_pl = re.compile(r'\A\s*msgid_plural\s+"')
msgstr = re.compile(r'\A\s*msgstr(\[\d\])?\s+"')
str_only = re.compile(r'\A\s*"')

substr = re.compile("(%(\([^\)]+\))?([\d\.]+)?[a-zA-Z])")

source_line = re.compile(": (\S+\.[^\.]+):(\d+)")

from r2.config.templates import tpm

tpm.add('translator',       'html', file = "translation.html")



_domain = 'r2'

def hax(string):
    """when site translation strings change, this will allow the subsequent 
       language translations to be updated without giving the translator more
       work"""
    hax_dict = { }
    return hax_dict.get(string, string)
    

class TranslatedString(Templated):
    class _SubstString:
Example #3
0
        svs = [dict(s) for s in self]
        cache.set(key, dict(load=self.load, services=svs, host=self._host))

    def clean_dead(self, age=30):
        time = datetime.now()
        active = filter(lambda s: time - self._services[s].time <= timedelta(0, age), self._services.keys())
        existing = self._services.keys()
        for pid in existing:
            if pid not in active:
                del self._services[pid]


from r2.config.templates import tpm
from r2.lib.wrapped import Wrapped

tpm.add("service_page", "html", file="server_status_page.html")
tpm.add("service_page", "htmllite", file="server_status_page.htmllite")


class Service_Page(Wrapped):
    def __init__(self, machines=default_servers):
        self.services = [Services(m) for m in machines]

    def __repr__(self):
        return "service page"


def Alert(restart_list=["MEM", "CPU"]):
    import time
    import smtplib
    import re
Example #4
0
        registry.replace(pylons.translator, translator)


comment = re.compile(r'^\s*#')
msgid = re.compile(r'^\s*msgid\s+"')
msgid_pl = re.compile(r'^\s*msgid_plural\s+"')
msgstr = re.compile(r'^\s*msgstr(\[\d\])?\s+"')
str_only = re.compile(r'^\s*"')

substr = re.compile("(%(\([^\)]+\))?([\d\.]+)?[a-zA-Z])")

source_line = re.compile(": (\S+\.[^\.]+):(\d+)")

from r2.config.templates import tpm

tpm.add('translator', 'html', file="translation.html")

_domain = 'r2'


def hax(string):
    """when site translation strings change, this will allow the subsequent 
       language translations to be updated without giving the translator more
       work"""
    hax_dict = {}
    return hax_dict.get(string, string)


class TranslatedString(Templated):
    class _SubstString:
        def __init__(self, string, enabled=True):
Example #5
0
        cache.set(key, dict(load = self.load, 
                            services = svs,
                            host = self._host))
    
    def clean_dead(self, age = 30):
        time = datetime.now()
        active = filter(lambda s: time - self._services[s].time <= timedelta(0, age), 
                        self._services.keys())
        existing = self._services.keys()
        for pid in existing:
            if pid not in active:
                del self._services[pid]

from r2.config.templates import tpm
from r2.lib.wrapped import Wrapped
tpm.add('service_page', 'html', file = "server_status_page.html")
tpm.add('service_page', 'htmllite', file = "server_status_page.htmllite")

class Service_Page(Wrapped):
    def __init__(self, machines = default_servers):
        self.services = [Services(m) for m in machines]
    def __repr__(self):
        return "service page"

def Alert(restart_list=['MEM','CPU']):
    import time
    import smtplib
    import re
    p=re.compile("/service/newreddit(\d+)\:")
    cache_key = 'already_alerted_'
    alert_recipients = ['*****@*****.**']