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.1 by slacapra, Tue Aug 23 10:57:51 2005 UTC vs.
Revision 1.4 by afanfani, Wed Nov 16 13:26:57 2005 UTC

# Line 3 | Line 3 | import sys, os, string, re
3   import urllib, urllister
4   import urllib2
5   from UnserializePHP import *
6 < from orcarcBuilderNew import *
6 > from orcarcBuilder import *
7  
8   class PubDBInfoError:
9    def __init__(self, Collections):
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            
# Line 122 | Line 126 | class PubDBInfo:
126                       #print "----------------------------------"
127  
128                       ## fill a catlogue entry
129 <                     acatalogue=catalogEntryNew(FileType,ValidationStatus,ContactString,ContactProtocol,CatalogueType,SE,CElist,TotalEvents,FirstRun+'-'+LastRun,Variables)          
129 > #                     acatalogue=catalogEntryNew(FileType,ValidationStatus,ContactString,ContactProtocol,CatalogueType,SE,CElist,TotalEvents,FirstRun+'-'+LastRun,Variables)          
130 >                     ## store collection type and primarycollection flag
131 >                     acatalogue=catalogEntryNew(CollType,PrimaryCollFlag,FileType,ValidationStatus,ContactString,ContactProtocol,CatalogueType,SE,CElist,TotalEvents,FirstRun+'-'+LastRun,Variables)
132 >
133                       ## list the catalogues belonging to a given collection
134                       colllist.append(acatalogue)
135                      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines