Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/backfill.py
Show First 20 Lines • Show All 533 Lines • ▼ Show 20 Lines | def run(self, object_type, start_object, end_object, dry_run=False): | ||||
): | ): | ||||
logger.info( | logger.info( | ||||
"Processing %s range %s to %s", | "Processing %s range %s to %s", | ||||
object_type, | object_type, | ||||
_format_range_bound(range_start), | _format_range_bound(range_start), | ||||
_format_range_bound(range_end), | _format_range_bound(range_end), | ||||
) | ) | ||||
for obj in fetch(db, object_type, start=range_start, end=range_end,): | objects = fetch(db, object_type, start=range_start, end=range_end) | ||||
if dry_run: | |||||
continue | |||||
writer.write_addition(object_type, obj) | |||||
writer.journal.producer.flush() | if not dry_run: | ||||
writer.write_additions(object_type, objects) | |||||
else: | |||||
# only consume the objects iterator to check for any potential | |||||
# decoding/encoding errors | |||||
for obj in objects: | |||||
pass | |||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
print('Please use the "swh-journal backfiller run" command') | print('Please use the "swh-journal backfiller run" command') |