Skip to content

Commit

Permalink
Integrate update_trilinos_fork.py into... (#162)
Browse files Browse the repository at this point in the history
In the Trilinos sync pipeline, swap out the old bash updateTrilinosFork
script for the new update_trilinos_fork.py Python one.
  • Loading branch information
jmgate committed Oct 2, 2019
1 parent 336328a commit 8f33f28
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def print(self, msg, end='\n'):
self.log_book.append(log)

def log(self, msg, cmd, cwd, live_stdout=False, live_stderr=False,
return_info=False):
return_info=False, verbose=False):
"""
Add something to the log. To conserve memory, ``stdout`` and ``stderr``
will be written to the files as it is being generated.
Expand All @@ -357,6 +357,7 @@ def log(self, msg, cmd, cwd, live_stdout=False, live_stderr=False,
dictionary. Consider leaving this set to ``False`` if you
anticipate your command producing large ``stdout``/``stderr``
streams that could cause memory issues.
verbose (bool): Print the command before it is executed.
Returns:
dict: A dictionary containing `stdout`, `stderr`, and
Expand Down Expand Up @@ -397,7 +398,8 @@ def log(self, msg, cmd, cwd, live_stdout=False, live_stderr=False,

with open(stdout_path, 'a') as out, open(stderr_path, 'a') as err:
# Print the command to be executed.
print(cmd_str)
if verbose:
print(cmd_str)

if return_info:
stdout = ''
Expand Down Expand Up @@ -600,13 +602,14 @@ def finalize(self):
if not os.path.exists(os.path.join(self.log_dir, 'utils')):
os.mkdir(os.path.join(self.log_dir, 'utils'))

logger_py = __file__
logger_py = os.path.join(os.path.dirname(os.path.realpath(
__file__)), "logger.py")
new_location = os.path.join(self.log_dir, "utils/logger.py")
if not os.path.exists(new_location):
shutil.copyfile(logger_py, new_location)

common_functions_py = os.path.join(os.path.dirname(__file__),
"common_functions.py")
common_functions_py = os.path.join(os.path.dirname(
os.path.realpath(__file__)), "common_functions.py")
new_location = os.path.join(self.log_dir,
"utils/common_functions.py")
if not os.path.exists(new_location):
Expand Down

0 comments on commit 8f33f28

Please sign in to comment.