Page MenuHomeSoftware Heritage
Paste P1122

generate backfill command for a given range (for sha1)
ActivePublic

Authored by vsellier on Aug 17 2021, 12:34 PM.
import sys
begin=0
end=0x1000000
#partitions=10
partitions=int(sys.argv[1])
current=int(sys.argv[2])
inc=int(end/partitions)
#print(f"current: {current}")
#print(f"end: {end}")
#print(f"inc: {inc}")
start_object=begin + int(current)*int(inc)
end_object=start_object + int(inc)
#print(start_object)
if current > 0:
start_object += 1
if start_object >= end:
sys.exit(0)
#print(start_object)
start_object_str = format(start_object, "06x")
end_object_str = format(end_object, "06x")
if end_object < end -1:
print(f"swh --log-config /etc/softwareheritage/journal/backfill_logger.yml storage backfill extid --start-object {start_object_str} --end-object {end_object_str}")
else:
print(f"swh --log-config /etc/softwareheritage/journal/backfill_logger.yml storage backfill extid --start-object {start_object_str}")