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): |
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): |
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: |
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'] |
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 |
|
|