Skip to content

Commit c911859

Browse files
Merge pull request #157 from statisticsnorway/archived-files
MICNO-684: Added check that input file not already exist in input_dir/archive
2 parents 180c62e + 75ddc72 commit c911859

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

job_executor/adapter/local_storage.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,12 @@ def archive_input_files(dataset_name: str):
409409
Archives the input .tar files if not already archived
410410
"""
411411
archive_dir = INPUT_DIR / "archive"
412-
tar_file = INPUT_DIR / f"{dataset_name}.tar"
412+
tar_filename = f"{dataset_name}.tar"
413+
archived_tar_file = archive_dir / tar_filename
414+
tar_file = INPUT_DIR / tar_filename
413415
if not archive_dir.exists():
414416
os.makedirs(archive_dir, exist_ok=True)
415-
if tar_file.exists():
417+
if tar_file.exists() and not os.path.isfile(archived_tar_file):
416418
shutil.move(str(tar_file), str(archive_dir))
417419

418420

0 commit comments

Comments
 (0)