45 if os.environ[
'DBS_STRATEGY'] ==
"local":
48 for line
in open(
'electronDbsDiscovery.txt').readlines():
49 line = os.path.expandvars(line.strip())
50 if line ==
"":
continue
51 if os.environ[
'DBS_SAMPLE'] !=
"Any" and line.find(os.environ[
'DBS_SAMPLE'])== -1:
continue
52 if line.find(os.environ[
'DBS_COND'])== -1:
continue
53 if line.find(dbs_tier)== -1:
continue
54 result.append(
'file:'+line)
56 elif os.environ[
'DBS_STRATEGY'] ==
"castor":
58 castor_dir =
'/castor/cern.ch/cms/store/relval/'+os.environ[
'DBS_RELEASE']+
'/'+os.environ[
'DBS_SAMPLE']+
'/'+os.environ[
'DBS_TIER']+
'/'+os.environ[
'DBS_COND']+
'/'
59 if __name__ ==
"__main__":
60 print 'castor dir:',castor_dir
62 data = os.popen(
'rfdir '+castor_dir)
63 subdirs = data.readlines()
68 subdir = line.split()[8]
69 data = os.popen(
'rfdir '+castor_dir+
'/'+subdir)
70 datalines = data.readlines()
71 for line
in datalines:
73 file = line.split()[8]
75 result.append(
'/store/relval/'+os.environ[
'DBS_RELEASE']+
'/'+os.environ[
'DBS_SAMPLE']+
'/'+os.environ[
'DBS_TIER']+
'/'+os.environ[
'DBS_COND']+
'/'+subdir+
'/'+file)
78 elif os.environ[
'DBS_STRATEGY'] ==
"lsf":
80 dbs_path =
'/'+os.environ[
'DBS_SAMPLE']+
'/'+os.environ[
'DBS_RELEASE']+
'-'+os.environ[
'DBS_COND']+
'/'+os.environ[
'DBS_TIER']+
'"'
81 if __name__ ==
"__main__":
82 print 'dbs path:',dbs_path
83 data = os.popen(
'dbs lsf --path="'+dbs_path+
'"')
84 datalines = data.readlines()
87 for line
in datalines:
89 if line !=
"" and line[0] ==
"/":
96 if os.environ[
'DBS_RELEASE'] !=
"Any":
97 input = input + separator +
"release = " + os.environ[
'DBS_RELEASE']
99 if os.environ[
'DBS_SAMPLE'] !=
"Any":
100 input = input + separator +
"primds = " + os.environ[
'DBS_SAMPLE']
102 if os.environ[
'DBS_RUN'] !=
"Any":
103 input = input + separator +
"run = " + os.environ[
'DBS_RUN']
105 input = input + separator +
"dataset like *" + os.environ[
'DBS_COND'] +
"*" + dbs_tier +
"*"
132 data = os.popen(
'dbs search --url="http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet" --query "'+input+
'"')
133 datalines = data.readlines()
136 for line
in datalines:
138 if line !=
"" and line[0] ==
"/":