@@ -2697,7 +2697,15 @@ def __init__(self, b, dbs=None):
26972697 self .res = None
26982698
26992699 def run (self ):
2700- self .res = self .a .listFileLumis ( block_name = self .b , validFileOnly = int (not check_with_invalid_files_too ))
2700+ response = self .a .listFileLumis ( block_name = self .b , validFileOnly = int (not check_with_invalid_files_too ))
2701+ if type (response [0 ]["lumi_section_num" ]) is list :
2702+ # New DBS Server response
2703+ print "Handling dbsapi.listFileLumis response from NEW DBS server"
2704+ self .res = aggregateListFileLumis (response )
2705+ else :
2706+ # Old DBS Server response
2707+ print "Handling dbsapi.listFileLumis response from OLD DBS server"
2708+ self .res = response
27012709
27022710 threads = []
27032711 all_blocks = dbsapi .listBlocks ( dataset = dataset )
@@ -5349,3 +5357,34 @@ def getFailedJobs(taskname, caller='getFailedJobs'):
53495357 failed_jobs += numFailures
53505358
53515359 return failed_jobs
5360+
5361+ def aggregateListFileLumis (response ):
5362+
5363+ aggregatedResponse = []
5364+
5365+ tmpDict = {}
5366+
5367+ for entry in response :
5368+ run_num = entry ["run_num" ]
5369+ lumi_section_num = entry ["lumi_section_num" ]
5370+ logical_file_name = entry ["logical_file_name" ]
5371+ event_count = entry ["event_count" ]
5372+
5373+ key = (run_num , logical_file_name )
5374+
5375+ if key in tmpDict :
5376+ tmpDict [key ]["event_count" ].append (event_count )
5377+
5378+ else :
5379+ tmpDict [key ] = {"event_count" : [event_count ], "lumi_section_num" : [lumi_section_num ]}
5380+
5381+
5382+ for key , value in tmpDict .iteritems ():
5383+ aggregatedResponse .append ({'run_num' : key [0 ],'lumi_section_num' : value ["lumi_section_num" ],'logical_file_name' : key [1 ],'event_count' : value ["event_count" ]})
5384+
5385+ return aggregatedResponse
5386+
5387+
5388+
5389+
5390+
0 commit comments