ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PubDBInfo.py
(Generate patch)

Comparing COMP/CRAB/python/PubDBInfo.py (file contents):
Revision 1.2 by slacapra, Tue Aug 23 10:59:02 2005 UTC vs.
Revision 1.5 by afanfani, Thu Dec 15 13:26:23 2005 UTC

# Line 10 | Line 10 | class PubDBInfoError:
10      print '\nERROR accessing PubDB for Collections: '+Collections+'\n'
11      pass
12   class PubDBInfoNoCollectionError:
13 <  def __init__(self, Collections):
14 <    print '\nERROR No Collections found in PubDB : '+Collections+'\n'
13 >  def __init__(self, Collections, url):
14 >    print '\nERROR No Collections '+Collections+' found in PubDB '+url
15      pass
16   class NoPHPError:
17    def __init__(self, url):
# Line 29 | Line 29 | class PubDBInfoResult:
29   class PubDBInfo:
30    def __init__(self, pubdburl, Collections):
31           self.Collections= Collections
32 +         self.PrimaryCollID=string.split(Collections,'-')[0]
33           self.PubDBurl_ = pubdburl
33         #self.PubDBInfophp_ = 'pubdb-get-analisys-info.php'
34           self.PubDBInfophp_ = 'pubdb-get-analysisinfo.php'
35           self.protocolPrio_ = ['http', 'rfio', 'mysql' , 'gridftp']
36         #self.protocolPrio_ = ['http', 'mysql' , 'rfio' , 'gridftp']
36  
37    ##########################################################################  
38    def GetPubDBInfo(self):
# Line 61 | Line 60 | class PubDBInfo:
60      #print data
61      if len(data)>0:
62         if data[0]=='<':
63 <              raise PubDBInfoNoCollectionError(self.Collections)
63 >              raise PubDBInfoNoCollectionError(self.Collections,self.PubDBurl_+self.PubDBInfophp_)
64      try:
65          catalogues = PHPUnserialize().unserialize(data)
66      except IOError:
# Line 71 | Line 70 | class PubDBInfo:
70          collmap={}
71          for k in catalogues.keys():
72             CollId=catalogues[k]['CollectionId']
73 +           ## get also the collection type
74 +           CollType=catalogues[k]['CollectionType']
75 +           ## set primary collection flag
76 +           PrimaryCollFlag=0
77 +           if ( CollId == self.PrimaryCollID ) : PrimaryCollFlag=1
78             colllist=[]
79             #print ">>> Catalogues for Collection: "+CollId+"\n"
80            
81             cat=catalogues[k]['Catalogue']
82             for kcat in cat.keys():
83 +              if cat[kcat]:
84                  ##print ("key %s, val %s" %(kcat,cat[kcat]))
85                  ContactString=cat[kcat]['ContactString']
86                  ContactProtocol=cat[kcat]['ContactProtocol']
# Line 122 | Line 127 | class PubDBInfo:
127                       #print "----------------------------------"
128  
129                       ## fill a catlogue entry
130 <                     acatalogue=catalogEntryNew(FileType,ValidationStatus,ContactString,ContactProtocol,CatalogueType,SE,CElist,TotalEvents,FirstRun+'-'+LastRun,Variables)          
130 > #                     acatalogue=catalogEntryNew(FileType,ValidationStatus,ContactString,ContactProtocol,CatalogueType,SE,CElist,TotalEvents,FirstRun+'-'+LastRun,Variables)          
131 >                     ## store collection type and primarycollection flag
132 >                     acatalogue=catalogEntryNew(CollType,PrimaryCollFlag,FileType,ValidationStatus,ContactString,ContactProtocol,CatalogueType,SE,CElist,TotalEvents,FirstRun+'-'+LastRun,Variables)
133 >
134                       ## list the catalogues belonging to a given collection
135                       colllist.append(acatalogue)
136                      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines