Beispiel #1
0
    def _createConfig(self):
        '''
        Creates and sets self.currentconfig and self.stringconfig as configured by files. 
        
        '''
        td = datetime.datetime.now() - self.lastconfigupdate
        totalseconds = td.seconds + (td.days * 24 * 3600)
        if totalseconds > self.sleep:
            self.log.debug("Configs older than %s seconds. Re-creating..." %
                           self.sleep)
            self._filter()
            cp = Config()
            sc = ''  # New string config.

            for i in range(len(self.activities)):
                tmpcp = Config()
                vo = self.vos[i]
                cloud = self.clouds[i]
                activity = self.activities[i]
                default = self.defaultsfiles[i]
                pilotmgr = self.pilotmanager[i]

                if default is not None:
                    tmpfile = open(default)
                    tmpcp.readfp(tmpfile)
                    tmpfile.seek(0)  # to read the file over again
                    for line in tmpfile.readlines():
                        sc += line

                for q in self.currentinfo:
                    if q.vo_name == vo and\
                       q.cloud == cloud and\
                       q.type == activity and\
                       q.pilot_manager == pilotmgr :
                        for cq in q.ce_queues:
                            try:
                                qc = cq.getAPFConfig()
                                tmpcp.merge(qc)
                                # add content of Config object to the string representation
                                sc += "\n"
                                sc += qc.getContent()
                            except Exception as e:
                                self.log.error('Captured exception %s' % e)
                cp.merge(tmpcp)
            self.currentconfig = cp
            self.stringconfig = sc
        else:
            self.log.debug("Configs up to date.")
Beispiel #2
0
 def _createConfig(self):
     '''
     Creates and sets self.currentconfig and self.stringconfig as configured by files. 
     
     '''
     td = datetime.datetime.now() - self.lastconfigupdate
     totalseconds = td.seconds + ( td.days * 24 * 3600)
     if totalseconds > self.sleep:
         self.log.debug("Configs older than %s seconds. Re-creating..." % self.sleep)
         self._filter()
         cp = Config()
         sc = ''   # New string config. 
 
         for i in range(len(self.activities)):
             tmpcp = Config()    
             vo = self.vos[i]
             cloud = self.clouds[i]
             activity = self.activities[i]
             default = self.defaultsfiles[i]
             pilotmgr = self.pilotmanager[i]
             
             if default is not None: 
                 tmpfile = open(default)
                 tmpcp.readfp(tmpfile)
                 tmpfile.seek(0) # to read the file over again
                 for line in tmpfile.readlines():
                     sc += line
 
             for q in self.currentinfo:
                 if q.vo_name == vo and\
                    q.cloud == cloud and\
                    q.type == activity and\
                    q.pilot_manager == pilotmgr :
                     for cq in q.ce_queues:
                         try:
                             qc = cq.getAPFConfig()
                             tmpcp.merge(qc)
                             # add content of Config object to the string representation
                             sc += "\n"
                             sc += qc.getContent()
                         except Exception as e:
                             self.log.error('Captured exception %s' % e) 
             cp.merge(tmpcp)
         self.currentconfig = cp
         self.stringconfig = sc
     else:
         self.log.debug("Configs up to date.")
Beispiel #3
0
def getMockMappingsConfig():
    
    mappingsconf = '''[NATIVECONDORBATCHSTATUS]
0 = unexpanded
1 = idle
2 = running
3 = removed
4 = completed
5 = held
6 = submission_err

 
[CONDORBATCHSTATUS-JOBSTATUS2INFO]
0 = pending
1 = pending
2 = running
3 = done
4 = done
5 = pending
6 = running


[CONDOREC2BATCHSTATUS-JOBSTATUS2INFO]
0 = pending
1 = pending
2 = running
3 = done
4 = done
5 = pending
6 = running


[PANDAWMSSTATUS-JOBSSTATISTICSPERSITE2INFO]
pending      = notready
defined      = notready
assigned     = notready
waiting      = notready
throttled    = notready
activated    = ready
starting     = running
sent         = running
running      = running
holding      = running
transferring = running
finished     = done
failed       = failed
cancelled    = failed


[CONDORWMSSTATUS-JOBSTATUS2INFO]
0 = ready
1 = ready
2 = running
3 = done
4 = done
5 = failed
6 = running'''
    buf = StringIO.StringIO(mappingsconf)
    cp = Config()
    cp.readfp(buf)
    return cp
Beispiel #4
0
def getMockMappingsConfig():

    mappingsconf = '''[NATIVECONDORBATCHSTATUS]
0 = unexpanded
1 = idle
2 = running
3 = removed
4 = completed
5 = held
6 = submission_err

 
[CONDORBATCHSTATUS-JOBSTATUS2INFO]
0 = pending
1 = pending
2 = running
3 = done
4 = done
5 = pending
6 = running


[CONDOREC2BATCHSTATUS-JOBSTATUS2INFO]
0 = pending
1 = pending
2 = running
3 = done
4 = done
5 = pending
6 = running


[PANDAWMSSTATUS-JOBSSTATISTICSPERSITE2INFO]
pending      = notready
defined      = notready
assigned     = notready
waiting      = notready
throttled    = notready
activated    = ready
starting     = running
sent         = running
running      = running
holding      = running
transferring = running
finished     = done
failed       = failed
cancelled    = failed


[CONDORWMSSTATUS-JOBSTATUS2INFO]
0 = ready
1 = ready
2 = running
3 = done
4 = done
5 = failed
6 = running'''
    buf = StringIO.StringIO(mappingsconf)
    cp = Config()
    cp.readfp(buf)
    return cp