Skip to content

Commit

Permalink
added test for backup files before restart RMG and some changes in ba…
Browse files Browse the repository at this point in the history
…ckup func
  • Loading branch information
NellyMitnik committed Aug 15, 2024
1 parent 6a52219 commit 6c38a7d
Show file tree
Hide file tree
Showing 12 changed files with 1,756,191 additions and 6 deletions.
12 changes: 6 additions & 6 deletions t3/runners/rmg_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Should be executed locally on the head node using the t3 environment.
"""

from typing import TYPE_CHECKING, List, Optional, Tuple

import datetime
import os
import shutil
import time
from typing import TYPE_CHECKING, List, Optional, Tuple

from arc.job.local import _determine_job_id, change_mode, execute_command, parse_running_jobs_ids, submit_job
from arc.job.local import (_determine_job_id, change_mode, execute_command,
parse_running_jobs_ids, submit_job)

from t3.imports import local_t3_path, settings, submit_scripts

Expand Down Expand Up @@ -391,7 +391,7 @@ def backup_rmg_files(project_directory: str):
project_directory (str): The path to the RMG folder.
"""
restart_backup_dir = os.path.join(project_directory,
f'restart_backup_{datetime.datetime.now().strftime("%b%d_%Y_%H:%M:%S")}')
f'restart_backup_{datetime.datetime.now().strftime("%b%d_%Y_%H-%M-%S")}')
os.mkdir(restart_backup_dir)
os.mkdir(os.path.join(restart_backup_dir, 'chemkin'))
files = ['RMG.log',
Expand All @@ -400,11 +400,11 @@ def backup_rmg_files(project_directory: str):
]
folders = ['pdep']
for file in files:
if os.path.isfile(os.path.join(project_directory, file)):
if os.path.exists(os.path.join(project_directory, file)):
shutil.copy(src=os.path.join(project_directory, file),
dst=os.path.join(restart_backup_dir, file))
for folder in folders:
if os.path.isdir(os.path.join(project_directory, folder)):
if os.path.exists(os.path.join(project_directory, folder)):
shutil.copytree(src=os.path.join(project_directory, folder),
dst=os.path.join(restart_backup_dir, folder))

Expand Down
9,462 changes: 9,462 additions & 0 deletions tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem.inp

Large diffs are not rendered by default.

8,730 changes: 8,730 additions & 0 deletions tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem0113.inp

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 6c38a7d

Please sign in to comment.