Skip to content

Commit

Permalink
0714
Browse files Browse the repository at this point in the history
  • Loading branch information
Su Tian committed Jul 14, 2021
1 parent 6fb1de6 commit 59f8126
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Change Log

1.3.2

- Added log level settings for both command and file output in dakota_interface.process


1.3.1

- Changed log level to 'info' for subprocess commands in analysis.run and presg.preSG


1.3.0

- Added logging and timing functions
Expand All @@ -6,7 +18,6 @@
- Updated the readVABSOutHomo function for the latest VABS output format



1.2.0

- Moved all scripts under an extra layer of directory 'msgpi'
Expand Down
2 changes: 1 addition & 1 deletion msgpi/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def runSwiftComp(
if reduced_integration:
cmd.append('R')

logger.debug(' '.join(cmd))
logger.info(' '.join(cmd))

if scrnout:
sbp.call(cmd)
Expand Down
24 changes: 16 additions & 8 deletions msgpi/dakota_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,33 @@
import msgpi.analysis as sga
import dakota.interfacing as di

def process(fn_json_args, logger=None):
def process(fn_json_args):
# if logger is None:
# logger = mlog.initLogger(__name__)
# if timer is None:
# timer = mtime.Timer(logger=logger.info)

print()
# print()

# timer.start()
# Load JSON arguments
with open(fn_json_args, 'r') as fo:
interface_args = json.load(fo)

# Set logger
log_level = 'INFO'
if 'log_level' in interface_args.keys():
if interface_args['log_level'] == 'debug':
log_level = 'DEBUG'
logger = mlog.initLogger(__name__, cout_level=log_level)
log_level_cmd = 'INFO'
log_level_file = 'INFO'
log_file_name = 'log.txt'
if 'log_level_cmd' in interface_args.keys():
log_level_cmd = interface_args['log_level_cmd'].upper()
if 'log_level_file' in interface_args.keys():
log_level_file = interface_args['log_level_file'].upper()
if 'log_file_name' in interface_args.keys():
log_file_name = interface_args['log_file_name']
logger = mlog.initLogger(
__name__,
cout_level=log_level_cmd, fout_level=log_level_file, filename=log_file_name
)

# Load data processing module
if 'data_process_functions_file' in interface_args.keys():
Expand Down Expand Up @@ -137,7 +145,7 @@ def process(fn_json_args, logger=None):
results.write()

# print(' - done.')
logger.info(evtag + ' done')
logger.critical(' '.join((evtag, 'finished')))
# timer.stop()

return
Expand Down

0 comments on commit 59f8126

Please sign in to comment.