CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
electronDbsDiscovery Namespace Reference

Functions

def common_search
 
def search
 
def search2
 

Variables

tuple files = dbs.search()
 

Function Documentation

def electronDbsDiscovery.common_search (   dbs_tier)

Definition at line 45 of file electronDbsDiscovery.py.

Referenced by search(), and search2().

45 
46 def common_search(dbs_tier):
47 
48  if os.environ['DBS_STRATEGY'] == "local":
49 
50  result = []
51  for line in open('electronDbsDiscovery.txt').readlines():
52  line = os.path.expandvars(line.strip())
53  if line == "": continue
54  if os.environ['DBS_SAMPLE'] != "Any" and line.find(os.environ['DBS_SAMPLE'])== -1: continue
55  if line.find(os.environ['DBS_COND'])== -1: continue
56  if line.find(dbs_tier)== -1: continue
57  result.append('file:'+line)
58 
59  elif os.environ['DBS_STRATEGY'] == "castor":
60 
61  castor_dir = os.environ['DBS_CASTOR_DIR']
62  result = []
63  data = os.popen('rfdir /castor/cern.ch/cms'+castor_dir)
64  subdirs = data.readlines()
65  data.close()
66  datalines = []
67  for line in subdirs:
68  line = line.rstrip()
69  subdir = line.split()[8]
70  data = os.popen('rfdir /castor/cern.ch/cms'+castor_dir+'/'+subdir)
71  datalines = data.readlines()
72  for line in datalines:
73  line = line.rstrip()
74  file = line.split()[8]
75  if file != "":
76  result.append(castor_dir+'/'+subdir+'/'+file)
77  data.close()
78 
79  elif os.environ['DBS_STRATEGY'] == "lsf":
80 
81  dbs_path = '/'+os.environ['DBS_SAMPLE']+'/'+os.environ['DBS_RELEASE']+'-'+os.environ['DBS_COND']+'/'+os.environ['DBS_TIER']+'"'
82  if __name__ == "__main__":
83  print 'dbs path:',dbs_path
84  data = os.popen('dbs lsf --path="'+dbs_path+'"')
85  datalines = data.readlines()
86  data.close()
87  result = []
88  for line in datalines:
89  line = line.rstrip()
90  if line != "" and line[0] =="/":
91  result.append(line)
92 
93  else:
94 
95  input = "find file"
96  separator = " where "
97  if os.environ['DBS_RELEASE'] != "Any":
98  input = input + separator + "release = " + os.environ['DBS_RELEASE']
99  separator = " and "
100  if os.environ['DBS_SAMPLE'] != "Any":
101  input = input + separator + "primds = " + os.environ['DBS_SAMPLE']
102  separator = " and "
103  if os.environ['DBS_RUN'] != "Any":
104  input = input + separator + "run = " + os.environ['DBS_RUN']
105  separator = " and "
106  input = input + separator + "dataset like *" + os.environ['DBS_COND'] + "*" + dbs_tier + "*"
107 
108  #url = "https://cmsweb.cern.ch:443/dbs_discovery/aSearch"
109  #final_input = urllib.quote(input) ;
110  #
111  #agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)"
112  #ctypes = "text/plain"
113  #headers = { 'User-Agent':agent, 'Accept':ctypes}
114  #params = {'dbsInst':'cms_dbs_prod_global',
115  # 'html':0,'caseSensitive':'on','_idx':0,'pagerStep':-1,
116  # 'userInput':final_input,
117  # 'xml':0,'details':0,'cff':0,'method':'dbsapi'}
118  #data = urllib.urlencode(params,doseq=True)
119  #req = urllib2.Request(url, data, headers)
120  #data = ""
121  #
122  #try:
123  # response = urllib2.urlopen(req)
124  # data = response.read()
125  #except urllib2.HTTPError, e:
126  # if e.code==201:
127  # print e.headers
128  # print e.msg
129  # pass
130  # else:
131  # raise e
132 
133  data = os.popen('dbs search --url="http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet" --query "'+input+'"')
134  datalines = data.readlines()
135  data.close()
136  result = []
137  for line in datalines:
138  line = line.rstrip()
139  if line != "" and line[0] =="/":
140  result.append(line)
141 
142  return result
def electronDbsDiscovery.search ( )

Definition at line 143 of file electronDbsDiscovery.py.

References common_search().

Referenced by AlignmentMonitorTemplate.event(), FileNamesHelper.getJobID_fromFileName(), and duplicateReflexLibrarySearch.searchClassDefXml().

144 def search():
145  return common_search(os.environ['DBS_TIER'])
def electronDbsDiscovery.search2 ( )

Definition at line 146 of file electronDbsDiscovery.py.

References common_search().

147 def search2():
148  return common_search(os.environ['DBS_TIER_SECONDARY'])
149 
150 
151 
152 

Variable Documentation

tuple electronDbsDiscovery.files = dbs.search()

Definition at line 10 of file electronDbsDiscovery.py.

Referenced by HcalCalibrator.endJob(), fillABSRPFiles(), SiStripDbParams.inputDcuInfoXmlFiles(), SiStripDbParams.inputFecXmlFiles(), SiStripDbParams.inputFedXmlFiles(), SiStripDbParams.inputModuleXmlFiles(), IO.IO(), pftools::IO.IO(), HcalPatternSource.loadPatterns(), main(), PlotCombiner(), and MillePedeAlignmentAlgorithm.terminate().