Skip to content

Commit

Permalink
Remove debugging code and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Nov 25, 2024
1 parent 1b83241 commit fab8ff3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/datafix/refresh_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,30 @@
import json
import functools
import time
import typing

MAX_BATCH_SIZE = 500


def get_relevant_ids(verbose: bool) -> list[str]:
relevant_ids = []
query = osv.Bug.query()

query: ndb.Query = query.filter()
query = osv.Bug.query()
query.projection = ["db_id"]
print(f"Running initial query on {query.kind}...")
result: list[osv.Bug] = list(query.fetch(limit=5000))

print(f"Retrieved {len(result)} bugs to examine for reputting")
result: typing.Iterable[osv.Bug] = query.iter()
counter = 0

for res in result:
counter += 1
# Check if the key needs to be updated
if res.key.id() != res.db_id: # type: ignore
relevant_ids.append(res.db_id)
if verbose:
print(res.db_id + ' - ' + res.key.id()) # type: ignore

print(str(len(relevant_ids)) + " / " + str(len(result)))
print(f"Found {len(relevant_ids)} / {counter} relevant bugs to refresh.")
return relevant_ids


Expand All @@ -45,8 +47,6 @@ def reput_bugs(dryrun: bool, verbose: bool) -> None:
# Store the state incase we cancel halfway to avoid having to do the initial query again
json.dump(relevant_ids, open('relevant_ids.json', 'w'))

relevant_ids = relevant_ids[:2]
print(relevant_ids)
num_reputted = 0
time_start = time.perf_counter()

Expand Down

0 comments on commit fab8ff3

Please sign in to comment.