6 from operator
import itemgetter, attrgetter
8 samweb = samweb_client.SAMWebClient(experiment=
'nova')
11 pattern = re.compile(
r"^.*?_r(.*?)_s(.*?)_.*")
12 query =
"Nova.DetectorID = fd and data_tier = artdaq and data_stream = " + stream +
" and file_type = importedDetector and run_number >= 11496 and DAQ2RawDigit.base_release = S14-01-20" 13 listResult = samweb.listFiles(query)
17 for file
in listResult:
18 match = pattern.match(file)
22 run =
int(match.groups()[0])
23 subrun =
int(match.groups()[1])
24 fileInfo = (run, subrun, file)
25 fileList.append(fileInfo)
27 fileList.sort(key=itemgetter(0,1))
33 for fileInfo
in fileList:
38 if count > 1
and run == lastRun
and subrun == lastSubrun:
39 print "Duplicate found!" 40 print "File 1: ", file
41 print "File 2: ", lastFile
42 samweb.retireFile(lastFile)
43 print "-----------------------------"