Skip to content

Commit

Permalink
Prepares cover archival to be run as cron #8278
Browse files Browse the repository at this point in the history
For closing #8278

To be run with:
```
PYTHONPATH=. python /openlibrary/openlibrary/coverstore/archive.py /olsystem/etc/openlibrary.yml /olsystem/etc/coverstore.yml
```
  • Loading branch information
mekarpeles authored May 17, 2024
1 parent 2d9a6c8 commit 08ee830
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions openlibrary/coverstore/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from openlibrary.coverstore import config, db
from openlibrary.coverstore.coverlib import find_image_path
from openlibrary.coverstore.server import load_config
from scripts.solr_builder.solr_builder.fn_to_cli import FnToCLI


ITEM_SIZE = 1_000_000
Expand Down Expand Up @@ -509,3 +511,12 @@ def get_last_file_in_zip(cls, zip_file_path):
file_list = zip_file.namelist()
if file_list:
return max(file_list)

def main(openlibrary_yml: str, coverstore_yml: str, dry_run: bool = False):
load_config(openlibrary_yml)
load_config(coverstore_yml)
archive.archive()
archive.Batch.process_pending(upload=True, finalize=True, test=not dry_run)

if __name__ == '__main__':
FnToCLI(main).run()

0 comments on commit 08ee830

Please sign in to comment.