Skip to content

Commit ee7eb86

Browse files
author
Paolo Tranquilli
committed
MaD: make bulk generator cleanup downloaded DBs
1 parent 4f47ee2 commit ee7eb86

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

misc/scripts/models-as-data/bulk_generate_mad.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import requests
1717
import zipfile
1818
import tarfile
19+
import shutil
1920

2021
try:
2122
import yaml
@@ -385,6 +386,8 @@ def download(item: tuple[str, dict]) -> str:
385386
# First we open the zip file
386387
with zipfile.ZipFile(artifact_zip_location, "r") as zip_ref:
387388
artifact_unzipped_location = os.path.join(build_dir, artifact_name)
389+
# clean up any remnants of previous runs
390+
shutil.rmtree(artifact_unzipped_location, ignore_errors=True)
388391
# And then we extract it to build_dir/artifact_name
389392
zip_ref.extractall(artifact_unzipped_location)
390393
# And then we iterate over the contents of the extracted directory

0 commit comments

Comments
 (0)