xet-repo-data-collection / refresh_lists.py
znation's picture
znation HF staff
let's try this
f624d68
raw
history blame contribute delete
745 Bytes
"""
Refreshes the `files` and `reconstructions` tables for a single repo.
"""
import sys
import list_files
import list_reconstructions
import list_repos
def refresh_oldest_repo():
oldest_repo = list_repos.list_repos(limit=1)
assert(len(oldest_repo) == 1)
refresh_repo(oldest_repo[0])
def refresh_repo(repo):
print("Refreshing repo", repo, file=sys.stderr)
print("Listing files", file=sys.stderr)
list_files.write_files_to_db(repo)
print("Listing reconstructions", file=sys.stderr)
list_reconstructions.write_files_to_db(repo)
print("Updating timestamp", file=sys.stderr)
list_repos.set_updated_datetime(repo)
print("Done", file=sys.stderr)
if __name__ == "__main__":
refresh_oldest_repo()