Exemple #1
0
def getInvertedSRMEndpoints():
    XML = url.read('http://cmssst.web.cern.ch/cmssst/vofeed/vofeed.xml')
    XML = ET.fromstring(XML)
    sites = XML.findall('atp_site')
    ret = dict()
    for site in sites:
        groups = site.findall('group')
        siteName = None
        for i in groups:
            if i.attrib['type'] == 'CMS_Site':
                siteName = groups[1].attrib['name']
                break
        if not siteName:
            continue
        services = site.findall('service')
        srms = []
        for j in services:
            if j.attrib["flavour"] == 'SRM':
                ret[j.attrib["hostname"]] = siteName
    return ret
def getInvertedSRMEndpoints():
    XML   = url.read('http://cmssst.web.cern.ch/cmssst/vofeed/vofeed.xml')
    XML   = ET.fromstring(XML)
    sites = XML.findall('atp_site')
    ret   = dict()
    for site in sites:
        groups   = site.findall('group')
        siteName = None
        for i in groups:
            if i.attrib['type'] == 'CMS_Site':
                siteName = groups[1].attrib['name']
                break
        if not siteName: 
            continue
        services = site.findall('service')
        srms = []
        for j in services:
            if j.attrib["flavour"] == 'SRM':
               ret[j.attrib["hostname"]]=siteName
    return ret
Exemple #3
0
def getSites():
    XML   = url.read('http://dashb-cms-vo-feed.cern.ch/dashboard/request.py/cmssitemapbdii')
    XML   = ET.fromstring(XML)
    sites = XML.findall('atp_site')
    ret   = {}
    for site in sites:
        groups   = site.findall('group')
        siteName = None
        for i in groups:
            if i.attrib['type'] == 'CMS_Site':
                siteName = groups[1].attrib['name']
                break
        if not siteName: 
            continue
        services = site.findall('service')
        ret[siteName] = {}
        ret[siteName]['hosts'] = []
        ret[siteName]['name']  = site.attrib['name']
        for service in services:
            serviceName = service.attrib['hostname']
            ret[siteName]['hosts'].append(serviceName)
    return ret
Exemple #4
0
def getSRMEndpoints():
    XML = url.read('http://cmssst.web.cern.ch/cmssst/vofeed/vofeed.xml')
    XML = ET.fromstring(XML)
    sites = XML.findall('atp_site')
    ret = dict()
    for site in sites:
        groups = site.findall('group')
        siteName = None
        for i in groups:
            if i.attrib['type'] == 'CMS_Site':
                siteName = groups[1].attrib['name']
                break
        if not siteName:
            continue
        services = site.findall('service')
        srms = []
        for j in services:
            if j.attrib["flavour"] == 'SRM':
                srms.append(j.attrib["hostname"])
        tier = getTier(siteName)
        if (tier >= 0 and tier <= 2) and srms:
            ret[siteName] = srms
    return ret
def getSRMEndpoints():
    XML   = url.read('http://cmssst.web.cern.ch/cmssst/vofeed/vofeed.xml')
    XML   = ET.fromstring(XML)
    sites = XML.findall('atp_site')
    ret   = dict()
    for site in sites:
        groups   = site.findall('group')
        siteName = None
        for i in groups:
            if i.attrib['type'] == 'CMS_Site':
                siteName = groups[1].attrib['name']
                break
        if not siteName: 
            continue
        services = site.findall('service')
        srms = []
        for j in services:
            if j.attrib["flavour"] == 'SRM':
               srms.append(j.attrib["hostname"])
        tier = getTier(siteName)
        if (tier >= 0 and tier <= 2) and srms:
            ret[siteName]=srms
    return ret
def getSites():
    XML   = url.read('http://dashb-cms-vo-feed.cern.ch/dashboard/request.py/cmssitemapbdii')
    XML   = ET.fromstring(XML)
    sites = XML.findall('atp_site')
    ret   = {}
    for site in sites:
        groups   = site.findall('group')
        siteName = None
        for i in groups:
            if i.attrib['type'] == 'CMS_Site':
                siteName = groups[1].attrib['name']
                break
        if not siteName: 
            continue
        services = site.findall('service')
        if not siteName in ret: ret[siteName] = {}
        if not 'hosts' in ret[siteName]: ret[siteName]['hosts'] = []
        ret[siteName]['name']  = site.attrib['name']
        for service in services:
            if not 'production_status' in service.attrib:
                serviceName = service.attrib['hostname']
                ret[siteName]['hosts'].append(serviceName)
    return ret
Exemple #7
0
    def append(self, siteName, endTime, inEntry):
        if not siteName in self.__entries:
            self.__entries[siteName] = {}
        self.__entries[siteName][endTime] = inEntry


def parseJSONMetric(data):
    data = json.loads(data)
    slots = data['csvdata']
    obj = jsonMetric()
    for slot in slots:
        # get start & end time in unix time
        time = dashboardTime2UnixTime(slot['Time'])
        endTime = dashboardTime2UnixTime(slot['EndTime'])
        siteName = slot['VOName']
        value = slot['Status']
        color = slot['COLORNAME']
        url = slot['URL']
        # add site names from the metric
        obj.append(siteName, endTime, entry(time, siteName, value, color, url))
    return obj


if __name__ == '__main__':
    import url
    wrURL = 'https://cmst1.web.cern.ch/CMST1/WFMon/WaitingRoom_Sites.txt'
    wr = parseMetric(url.read(wrURL))
    for site in wr:
        print str(site)
    print 'Number of rows:', len(wr)
        return entries[max(entries)]

    def append(self, siteName, endTime, inEntry):
        if not siteName in self.__entries:
            self.__entries[siteName] = {}
        self.__entries[siteName][endTime] = inEntry

def parseJSONMetric(data):
    data  = json.loads(data)
    slots = data['csvdata']
    obj   = jsonMetric()
    for slot in slots:
        # get start & end time in unix time
        time     = dashboardTime2UnixTime(slot['Time'])
        endTime  = dashboardTime2UnixTime(slot['EndTime'])
        siteName = slot['VOName']
        value    = slot['Status']
        color    = slot['COLORNAME']
        url      = slot['URL']
        # add site names from the metric
        obj.append(siteName, endTime, entry(time, siteName, value, color, url))
    return obj

if __name__ == '__main__':
    import url
    wrURL = 'https://cmst1.web.cern.ch/CMST1/WFMon/WaitingRoom_Sites.txt'
    wr    = parseMetric(url.read(wrURL))
    for site in wr:
        print str(site)
    print 'Number of rows:', len(wr)