def __init__(self, maxQueueSize=10):
     """ 
 """
     self.dbname = 'GlastAdditionalInfoDB'
     self.logger = gLogger.getSubLogger('GlastAdditionalInfoDB')
     DB.__init__(self, self.dbname, 'ResourceStatus/GlastAdditionalInfoDB',
                 maxQueueSize)
     self.fields = ["CEName", "Status", "Software_Tag"]
     self._createTables({
         "SoftwareTags_has_Sites": {
             "Fields": {
                 "idRelation": "INT NOT NULL AUTO_INCREMENT",
                 "CEName": "VARCHAR(45) NOT NULL",
                 "Status":
                 "ENUM('New','Installing','Valid','Bad','Removed') DEFAULT 'New'",
                 "Software_Tag": "VARCHAR(255) NOT NULL",
                 "LastUpdateTime": "DATETIME"
             },
             "PrimaryKey": ['idRelation'],
             'Indexes': {
                 "Index":
                 ["idRelation", "Software_Tag", "CEName", 'Status']
             }
         }
     })
     self.vo = getVO('glast.org')
     ##tags statuses:
     self.tag_statuses = ['New', 'Installing', 'Valid', 'Bad', 'Removed']
示例#2
0
 def __init__(self, maxQueueSize=10):
     """ 
 """
     # self.ops = Operations()
     self.dbname = "GlastAdditionalInfoDB"
     self.logger = gLogger.getSubLogger("GlastAdditionalInfoDB")
     DB.__init__(self, self.dbname, "ResourceStatus/GlastAdditionalInfoDB", maxQueueSize)
     self.fields = ["CEName", "Status", "Software_Tag"]
     self._createTables(
         {
             "SoftwareTags_has_Sites": {
                 "Fields": {
                     "idRelation": "INT NOT NULL AUTO_INCREMENT",
                     "CEName": "VARCHAR(45) NOT NULL",
                     "Status": "ENUM('New','Installing','Valid','Bad','Removed') DEFAULT 'New'",
                     "Software_Tag": "VARCHAR(255) NOT NULL",
                     "LastUpdateTime": "DATETIME",
                 },
                 "PrimaryKey": ["idRelation"],
                 "Indexes": {"Index": ["idRelation", "Software_Tag", "CEName", "Status"]},
             }
         }
     )
     self.vo = getVO("glast.org")
     ##tags statuses:
     self.tag_statuses = ["New", "Installing", "Valid", "Bad", "Removed"]
 def __init__( self, maxQueueSize = 10 ):
   """ 
   """
   self.dbname = 'GlastAdditionalInfoDB'
   self.logger = gLogger.getSubLogger('GlastAdditionalInfoDB')
   DB.__init__( self, self.dbname, 'ResourceStatus/GlastAdditionalInfoDB', maxQueueSize  )
   self.fields = ["CEName","Status","Software_Tag"]
   self._createTables( { "SoftwareTags_has_Sites" :{"Fields":{"idRelation":"INT NOT NULL AUTO_INCREMENT",
                                                              "CEName":"VARCHAR(45) NOT NULL",
                                                              "Status":"ENUM('New','Installing','Valid','Bad','Removed') DEFAULT 'New'",
                                                              "Software_Tag":"VARCHAR(255) NOT NULL",
                                                              "LastUpdateTime":"DATETIME"},
                                                    "PrimaryKey" : ['idRelation'],
                                                    'Indexes' : { "Index":["idRelation","Software_Tag","CEName", 'Status']}
                                                    }             
                       }
                     )
   self.vo = getVO('glast.org')
   ##tags statuses: 
   self.tag_statuses = ['New','Installing','Valid','Bad','Removed']
示例#4
0
def getSiteForCEs(ces,vo="glast.org"):
    """ We want to get the site for a given CE because that's what the job expects
    copy of private DB method.
    """
    res = getVO("glast.org")
    if not res['OK']:
        return S_ERROR("Could not get VO")
    vo = res["Value"]
    res = getQueues(community = vo)
    if not res['OK']:
        return S_ERROR("Could not get site for CE")
    sitedict = res['Value']
    
    final_sdict = {}
    for site, s_ces in sitedict.items():
        for ce in ces:
            if ce in s_ces:
                if not site in final_sdict:
                    final_sdict[site] = []
                final_sdict[site].append(ce)
    
    return S_OK(final_sdict)
示例#5
0
def getSiteForCEs(ces, vo="glast.org"):
    """ We want to get the site for a given CE because that's what the job expects
    copy of private DB method.
    """
    res = getVO("glast.org")
    if not res['OK']:
        return S_ERROR("Could not get VO")
    vo = res["Value"]
    res = getQueues(community=vo)
    if not res['OK']:
        return S_ERROR("Could not get site for CE")
    sitedict = res['Value']

    final_sdict = {}
    for site, s_ces in sitedict.items():
        for ce in ces:
            if ce in s_ces:
                if not site in final_sdict:
                    final_sdict[site] = []
                final_sdict[site].append(ce)

    return S_OK(final_sdict)