Skip to content

Commit

Permalink
50: Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Sharples committed Sep 13, 2024
1 parent cfd4edd commit 4042a02
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 1 addition & 5 deletions METdbLoad/ush/met_db_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ def main(args):
begin_time = str(datetime.now())

# setup a logger for this module

# Any loglevel set here will be overwirtten later if XML tag "verbose" is true.
#TODO: determine if we want to write to file instead of stout
cli_loglevel = False
if args.loglevel:
loglevel = args.loglevel
Expand Down Expand Up @@ -322,8 +319,7 @@ def main(args):
# move indices to the next set of files
first_file, mid_file, last_file = next_set(mid_file, last_file)

except (RuntimeError, TypeError, NameError, KeyError) as e:
raise e
except (RuntimeError, TypeError, NameError, KeyError):
logger.error("*** %s occurred in Main writing data ***", sys.exc_info()[0])
sys.exit("*** Error when writing data to database")

Expand Down
3 changes: 2 additions & 1 deletion METdbLoad/ush/run_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pymysql

from METdbLoad.ush import constants as CN
from METdbLoad.ush.met_db_load import DEFAULT_LOGLEVEL
from METreformat.util import get_common_logger

class RunSql:
Expand All @@ -36,7 +37,7 @@ def __init__(self, logger=None):
self.conn = None
self.cur = None
if logger is None:
self.logger = get_common_logger('DEBUG', 'stdout')
self.logger = get_common_logger(DEFAULT_LOGLEVEL, 'stdout')
else:
self.logger = logger

Expand Down
3 changes: 2 additions & 1 deletion METdbLoad/ush/write_file_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from METdbLoad.ush import constants as CN
from METdbLoad.ush.run_sql import RunSql
from METdbLoad.ush.met_db_load import DEFAULT_LOGLEVEL
from METreformat.util import get_common_logger

class WriteFileSql:
Expand All @@ -34,7 +35,7 @@ class WriteFileSql:
def __init__(self, logger=None):
self.sql_met = RunSql()
if logger is None:
self.logger = get_common_logger('DEBUG', 'stdout')
self.logger = get_common_logger(DEFAULT_LOGLEVEL, 'stdout')
else:
self.logger = logger

Expand Down

0 comments on commit 4042a02

Please sign in to comment.