Esempio n. 1
0
 def test_rosetta(self):
     p = Project.createFromXML(parse_input.project_rosetta)
     print p
     self.ignoreSpaces(p.name, 'rosetta@home')
     self.ignoreSpaces(p.url, 'http://www.boinc.bakerlab.org/rosetta')
     self.ignoreSpaces(str(p.statistics), """Total credit,  user: 2 543, host: 2 543, 100%
     Avg credit, user: 227, host: 227, 100%""")
Esempio n. 2
0
 def test_worldcommunitygrid(self):
     p = Project.createFromXML(parse_input.project_worldcommunitygrid)
     print p
     self.ignoreSpaces(p.url, 'http://www.worldcommunitygrid.org')
     self.ignoreSpaces(p.name, 'World Community Grid')
     self.ignoreSpaces(str(p.statistics), """Total credit,  user: 213 009, host: 207 378, 97%
     Avg credit, user: 1 770, host: 1 769, 100%""")
Esempio n. 3
0
    def feed(self, line):
        if line.strip() in ('<project>', '<app>', '<workunit>', '<result>', '<file_transfer>'):
            self.inBlock = True

        reset = True
        if '</project>' in line:
            self.c_proj = Project.createFromXML("\n".join(self.currentBlock))
            self.projects[self.c_proj.url] = self.c_proj
            logger.debug('project %s', self.c_proj)
        elif '</app>' in line:
            self.c_app = self.c_proj.appendApplicationFromXML("\n".join(self.currentBlock))
            logger.debug('application %s', self.c_app)
        elif '</workunit>' in line:
            self.c_task = self.c_proj.appendWorkunitFromXML("\n".join(self.currentBlock))
            logger.debug('task, %s', self.c_task)
        elif '</result>' in line:
            try:
                t = self.c_proj.appendResultFromXML("\n".join(self.currentBlock))
                logger.debug('result, %s', t)
            except KeyError:
                logging.exception('Could not append task to application:')
        elif '</file_transfer>' in line:
            t = Task_fileTransfer.createFromXML("\n".join(self.currentBlock))
            p = Project(url=t.project_url, name=t.project_name)
            
            if not(self.projects.has_key(t.project_url)):
                logger.debug('Hmm, projects does not have key "%s", %s', t.project_url, self.projects)
                self.projects[t.project_url] = p
            logger.debug('appending file_transfer %s', t)
            self.projects[p.url].fileTransfers.append(t)
        else:
            reset = False

        if reset:
            self.inBlock = False
            self.currentBlock = []                

        if self.inBlock:
            self.currentBlock.append(line.strip())