From df8645ba4abd54e7f76544f7ca07bc9b2a012d99 Mon Sep 17 00:00:00 2001 From: Phil Owen <19691521+PhillipsOwen@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:02:10 -0500 Subject: [PATCH] changing the way the directory is removed, not creating the output directory if it cant find the run. --- src/staging/staging.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/staging/staging.py b/src/staging/staging.py index e063907..4b1d106 100644 --- a/src/staging/staging.py +++ b/src/staging/staging.py @@ -11,6 +11,8 @@ """ import os import json +import shutil + from src.common.logger import LoggingUtil from src.common.pg_impl import PGImplementation from src.common.staging_enums import StagingType @@ -83,14 +85,14 @@ def initial_staging(self, run_dir: str, run_id: str, staging_type: StagingType) ret_val: int = 0 try: - # make the directory - os.makedirs(run_dir, exist_ok=True) - # try to make the call for records run_data: json = self.db_info.get_run_def(run_id) # did getting the data go ok if run_data != -1: + # make the directory + os.makedirs(run_dir, exist_ok=True) + # create the file that contains the test list with open(os.path.join(run_dir, 'test_list.json'), 'w', encoding='utf-8') as fp: fp.write(json.dumps(run_data['request_data']['tests'])) @@ -121,7 +123,7 @@ def final_staging(self, run_dir: str, staging_type: StagingType) -> int: try: # remove the run directory - os.unlink(run_dir) + shutil.rmtree(run_dir) except Exception: # declare ready