@@ -156,7 +156,7 @@ def main():
156156 fmt = "json"
157157 elif args .filebeat :
158158 fmt = "filebeat"
159- ls (transfers , fmt = fmt , stats = args .stats , mirror_failures = args . mirror_failures , file_types = file_types )
159+ ls (transfers , fmt = fmt , stats = args .stats , file_types = file_types )
160160 case "get" :
161161 get (transfers , todo = storage .rangeset (args .range ), monitor_interval = cfg .monitor_interval )
162162 case "put" :
@@ -173,7 +173,6 @@ def ls(
173173 * ,
174174 fmt : LsFormat = "json" ,
175175 stats : bool = False ,
176- mirror_failures : bool = False ,
177176 file_types : set [storage .TransferFileType ] | None = None ,
178177) -> None :
179178 LOG .info ("Found %d transfer(s)." , len (transfers ))
@@ -185,19 +184,19 @@ def ls(
185184 sys .stdout .write ("\n " .join (sorted (filenames )) + "\n " )
186185 case "json" :
187186 json .dump (
188- [transfer_to_dict (tr , stats = stats , mirror_failures = mirror_failures ) for tr in transfers ],
187+ [transfer_to_dict (tr , stats = stats ) for tr in transfers ],
189188 sys .stdout ,
190189 indent = 2 ,
191190 sort_keys = True ,
192191 )
193192 case "filebeat" :
194193 for tr in transfers :
195194 # Filebeat format is made of the root object (without stats), plus a separate object for each transfer stat.
196- for d in transfer_to_filebeat (tr , stats = stats , mirror_failures = mirror_failures ):
195+ for d in transfer_to_filebeat (tr , stats = stats ):
197196 line = json .dumps ({"rally" : {"storage" : d }})
198197 sys .stdout .write (f"{ line } \n " )
199198 case "pretty" :
200- json .dump ([t .pretty (stats = stats , mirror_failures = mirror_failures ) for t in transfers ], sys .stdout , indent = 2 )
199+ json .dump ([t .pretty (stats = stats ) for t in transfers ], sys .stdout , indent = 2 )
201200
202201
203202class BaseTransferDict (TypedDict ):
@@ -239,7 +238,7 @@ class StatsDict(TypedDict):
239238 write_time : float
240239
241240
242- def transfer_to_dict (tr : storage .Transfer , * , stats : bool = False , mirror_failures : bool = False ) -> TransferDict :
241+ def transfer_to_dict (tr : storage .Transfer , * , stats : bool = False ) -> TransferDict :
243242 """It obtains dictionaries from transfer status in the format to be serialized as JSON."""
244243 d = TransferDict (
245244 url = tr .url ,
@@ -252,9 +251,9 @@ def transfer_to_dict(tr: storage.Transfer, *, stats: bool = False, mirror_failur
252251 todo = str (tr .todo ),
253252 finished = tr .finished ,
254253 )
255- if mirror_failures :
254+ if tr . mirror_failures :
256255 d ["mirror_failures" ] = [MirrorFailureDict (url = f .url , error = f .error ) for f in tr .mirror_failures ]
257- if stats :
256+ if stats and tr . stats :
258257 d ["stats" ] = [
259258 StatsDict (
260259 url = s .url ,
@@ -270,7 +269,7 @@ def transfer_to_dict(tr: storage.Transfer, *, stats: bool = False, mirror_failur
270269
271270
272271def transfer_to_filebeat (
273- tr : storage .Transfer , stats : bool = False , mirror_failures : bool = False
272+ tr : storage .Transfer , stats : bool = False
274273) -> Generator [TransferDict | FilebeatStatsDict | FilebeatMirrorFailureDict ]:
275274 """It obtains dictionaries from transfer in the format to be ingested to filebeat.
276275
@@ -279,7 +278,7 @@ def transfer_to_filebeat(
279278 - a FilebeatMirrorFailureDict for every MirrorFailureDict in 'mirror_failures' list.
280279 - a FilebeatStatsDict for every TransferStatsDict in 'stats' list.
281280 """
282- root : TransferDict = transfer_to_dict (tr , stats = stats , mirror_failures = mirror_failures )
281+ root : TransferDict = transfer_to_dict (tr , stats = stats )
283282 _mirror_failures : list [MirrorFailureDict ] = root .pop ("mirror_failures" , [])
284283 _stats : list [StatsDict ] = root .pop ("stats" , [])
285284 yield root
0 commit comments