Skip to content

Commit

Permalink
Merge pull request #90 from USDA-ARS-NWRC/test/logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jomey committed Sep 9, 2021
1 parent 4a6f6f6 commit 3a55e17
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
17 changes: 9 additions & 8 deletions awsm/framework/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def smrf_config_sections(self):
return MasterConfig(modules='smrf').cfg.keys()

def read_config(self, config):

if isinstance(config, str):
if not os.path.isfile(config):
raise Exception('Configuration file does not exist --> {}'
Expand All @@ -211,22 +210,22 @@ def read_config(self, config):

elif isinstance(config, UserConfig):
self.ucfg = config
configFile = ''

else:
raise Exception("""Config passed to AWSM is neither file """
"""name nor UserConfig instance""")

# Check the user config file for errors and report issues if any
warnings, errors = check_config(self.ucfg)
print_config_report(warnings, errors)

self.config = self.ucfg.cfg

if len(errors) > 0:
print_config_report(warnings, errors)
print("Errors in the config file. "
"See configuration status report above.")
sys.exit()
elif len(warnings) > 0:
print_config_report(warnings, errors)

self.config = self.ucfg.cfg

def load_topo(self):

Expand Down Expand Up @@ -312,14 +311,16 @@ def create_log(self):
logfile = \
os.path.join(self.path_log,
'log_{}.out'.format(self.folder_date_stamp))
# let user know
print('Logging to file: {}'.format(logfile))

self.config['awsm system']['log_file'] = logfile
logger.SMRFLogger(self.config['awsm system'])

self._logger = logging.getLogger(__name__)

if self._logger.level == logging.DEBUG and \
not os.getenv('SUPPRESS_AWSM_STDOUT'):
print('Logging to file: {}'.format(logfile))

self._logger.info(ascii_art.MOUNTAIN)
self._logger.info(ascii_art.TITLE)

Expand Down
1 change: 1 addition & 0 deletions awsm/tests/basins/Lakes/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ input_backup: True
threading: False
log_level: debug
log_file: ./output/log.txt
time_out: 10

################################################################################
# Configurations for AWSM Master section
Expand Down
1 change: 0 additions & 1 deletion awsm/tests/basins/Lakes/gold_hrrr/gold_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ mask_output: False
threading: False
time_out: None
log_level: debug
log_file: ./log.txt
qotw: False
queue_max_values: 2

Expand Down
1 change: 0 additions & 1 deletion awsm/tests/basins/Lakes/gold_hrrr_update/gold_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ mask_output: False
threading: False
time_out: None
log_level: debug
log_file: ./log.txt
qotw: False
queue_max_values: 2

Expand Down
1 change: 0 additions & 1 deletion awsm/tests/basins/RME/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ mask_output: False
[system]
threading: True
log_level: debug
log_file: log.txt
qotw: False
queue_max_values: 1.0

Expand Down
1 change: 0 additions & 1 deletion awsm/tests/basins/RME/gold/gold_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ mask_output: False
threading: False
time_out: None
log_level: debug
log_file: None
qotw: False
queue_max_values: 1

Expand Down

0 comments on commit 3a55e17

Please sign in to comment.