Skip to content

Commit

Permalink
removing the removal of the run data directory
Browse files Browse the repository at this point in the history
  • Loading branch information
PhillipsOwen committed Feb 26, 2024
1 parent f3175e8 commit 4485164
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/staging/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,11 @@ def create_test_files(self, run_dir: str, run_data: json, workflow_type: Workflo
# declare the testing complete
fp.write(f'echo "Copying /var/lib/irods/test-report/ results..."; cp ./test-reports/*.xml {run_dir};\n')

# save these directories for extended forensics
# save the log directory for extended forensics
fp.write(f'echo "Moving /var/lib/irods/log dir..."; mv ./log {run_dir};\n')

# this directory may or may not exist
fp.write(f'if [-f /var/log/irods ]; then\n')
fp.write(f' echo "Moving /var/log/irods/ dir..."; mv /var/log/irods/ {run_dir};\n')
fp.write(f'fi\n')
fp.write(f'echo "Moving /var/log/irods/ dir..."; mv /var/log/irods/ {run_dir};\n')

# make sure the file has the correct permissions
if sys.platform != 'win32':
Expand Down Expand Up @@ -245,22 +243,10 @@ def final_staging(self, run_id: str, run_dir: str, staging_type: StagingType) ->
try:
# does the directory exist?
if os.path.isdir(run_dir):
# try to make the call for records
run_data: json = self.db_info.get_run_def(run_id)
self.logger.info('Run dir exists. run_dir: %s', run_dir)

# did we get the run definition?
if run_data != ReturnCodes.DB_ERROR:
# get the grouping value from the request
run_group: str = run_data['request_group']
# do more things here.

# get the target directory
dest_dir = run_dir.replace(run_id, run_group)

# remove the dest directory
shutil.rmtree(dest_dir, ignore_errors=True)

# move the source directory to the dest
shutil.move(run_dir, dest_dir)
except Exception:
# declare ready
self.logger.exception('Exception: The iRODS K8s "%s" final staging request for run directory %s failed.', staging_type, run_dir)
Expand Down

0 comments on commit 4485164

Please sign in to comment.