Skip to content

Commit

Permalink
Merge pull request #344 from yisangriB/auto_testing
Browse files Browse the repository at this point in the history
sy - fixing missing dakota.err error in dcv
  • Loading branch information
fmckenna authored Oct 24, 2024
2 parents 0af5b91 + d5d50b6 commit 4349a74
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
12 changes: 6 additions & 6 deletions modules/performUQ/SimCenterUQ/UQengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def cleanup_workdir(self): # noqa: C901, D102
for del_pkl in del_pkls:
os.remove(del_pkl) # noqa: PTH107

try:
del_errs = glob.glob(os.path.join(self.work_dir, '*err')) # noqa: PTH118, PTH207
for del_err in del_errs:
os.remove(del_err) # noqa: PTH107
except: # noqa: S110, E722
pass
#try:
# del_errs = glob.glob(os.path.join(self.work_dir, '*err')) # noqa: PTH118, PTH207
# for del_err in del_errs:
# os.remove(del_err) # noqa: PTH107
#except: # noqa: S110, E722
# pass

if glob.glob(os.path.join(self.work_dir, 'templatedir', 'results.out')): # noqa: PTH118, PTH207
try:
Expand Down
15 changes: 12 additions & 3 deletions modules/performUQ/SimCenterUQ/surrogateBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,26 @@
print('Failed to import module:' + moduleName) # noqa: T201


errFileName = os.path.join(os.getcwd(),'dakota.err') # noqa: N816
develop_mode = (len(sys.argv)==7) # a flag for develeopmode

print("Initializing error log file..")
print(f"Current working dir (getcwd): {os.getcwd()}")

work_dir_tmp = sys.argv[1].replace(os.sep, '/')
errFileName = os.path.join(work_dir_tmp,'dakota.err') # noqa: N816

develop_mode = (len(sys.argv)==8) # a flag for develeopmode
if develop_mode:
# import matplotlib
# matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
print("developer mode")
print("Developer mode")
else:
with open(errFileName, 'w') as f:
f.write("")
sys.stderr = open(errFileName, 'w') # noqa: SIM115, PTH123
print(f"Error file created at: {errFileName}")



#
# Modify GPy package
Expand Down

0 comments on commit 4349a74

Please sign in to comment.