@@ -170,10 +170,16 @@ def process_all_collections(self) -> Dict[str, List[Dict]]:
170
170
Dict[str, List[Dict]]: Dictionary mapping collection names to their operation results
171
171
"""
172
172
results = {}
173
+ any_collection_failed = False
173
174
174
175
for collection_name in self .collection_configs .keys ():
175
176
try :
176
177
results [collection_name ] = self .process_collection_versions (collection_name )
178
+
179
+ # Check if this collection had any errors
180
+ if any (isinstance (op , dict ) and op .get ("status" ) == "error" for op in results [collection_name ]):
181
+ any_collection_failed = True
182
+
177
183
except Exception as e :
178
184
logger .error (f"Error processing collection { collection_name } : { str (e )} " )
179
185
results [collection_name ] = [{
@@ -182,6 +188,23 @@ def process_all_collections(self) -> Dict[str, List[Dict]]:
182
188
"error" : str (e ),
183
189
"status" : "error"
184
190
}]
191
+ any_collection_failed = True
192
+
193
+ # Add final overall status operation
194
+ overall_status = "error" if any_collection_failed else "success"
195
+ overall_message = "Some collections failed to process" if any_collection_failed else "All collections processed successfully"
196
+
197
+ # Add the overall status to each collection's results
198
+ for collection_name in results .keys ():
199
+ results [collection_name ].append ({
200
+ "operation" : "overall_status" ,
201
+ "status" : overall_status ,
202
+ "message" : overall_message ,
203
+ "collections_processed" : len (self .collection_configs ),
204
+ "collections_failed" : sum (1 for result in results .values ()
205
+ if any (isinstance (op , dict ) and op .get ("status" ) == "error"
206
+ for op in result ))
207
+ })
185
208
186
209
return results
187
210
0 commit comments