def _create_srs(self, msg_text):
        '''
        Given the text from a summary record message, create a list of 
        JobRecord objects and return it.
        '''
        
        msg_text = msg_text.strip()

        records = msg_text.split('%%')
        msgs = []
        for record in records:
            # unnecessary hack?
            if (record != '') and not (record.isspace()):
                s = SummaryRecord()
                s.load_from_msg(record)
                msgs.append(s)
        
        return msgs
示例#2
0
文件: aur_parser.py 项目: nasiaa/apel
        tags = [
            'Site', 'Month', 'Year', 'GlobalUserName', 'Group',
            'GroupAttribute', 'SubmitHost', 'Infrastructure',
            'EarliestEndTime', 'LatestEndTime', 'WallDuration', 'CpuDuration',
            'ServiceLevel', 'NumberOfJobs', 'NodeCount', 'Processors'
        ]

        nodes = {}.fromkeys(tags)
        data = {}

        for node in nodes:

            nodes[node] = xml_record.getElementsByTagNameNS(
                AurParser.NAMESPACE, node)
            # Some of the nodes are in the CAR namespace.
            nodes[node].extend(
                xml_record.getElementsByTagNameNS(CarParser.NAMESPACE, node))

        for field in functions:
            try:
                data[field] = functions[field](nodes)
            except IndexError, e:
                log.debug('Failed to parse field %s: %s' % (field, e))
            except KeyError, e:
                log.debug('Failed to parse field %s: %s' % (field, e))

        sr = SummaryRecord()
        sr.set_all(data)

        return sr
示例#3
0
            'NodeCount'        : lambda nodes: self.getText(nodes['NodeCount'][0].childNodes),
            'Processors'       : lambda nodes: self.getText(nodes['Processors'][0].childNodes),
            }

        tags = ['Site', 'Month', 'Year', 'GlobalUserName', 'Group', 
                'GroupAttribute', 'SubmitHost', 'Infrastructure',
                'EarliestEndTime', 'LatestEndTime', 'WallDuration', 'CpuDuration', 
                'ServiceLevel', 'NumberOfJobs', 'NodeCount', 'Processors']

        nodes = {}.fromkeys(tags)
        data = {}
        
        for node in nodes:

            nodes[node] = xml_record.getElementsByTagNameNS(AurParser.NAMESPACE, node)
            # Some of the nodes are in the CAR namespace.
            nodes[node].extend(xml_record.getElementsByTagNameNS(CarParser.NAMESPACE, node))
        
        for field in functions:
            try:
                data[field] = functions[field](nodes)
            except IndexError, e:
                log.debug('Failed to parse field %s: %s' % (field, e))
            except KeyError, e:
                log.debug('Failed to parse field %s: %s' % (field, e))
        
        sr = SummaryRecord()
        sr.set_all(data)
        
        return sr