Skip to content

Commit

Permalink
changing the way the directory is removed, not creating the output di…
Browse files Browse the repository at this point in the history
…rectory if it cant find the run.
  • Loading branch information
PhillipsOwen committed Jan 9, 2024
1 parent c247542 commit df8645b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/staging/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit df8645b

Please sign in to comment.