Skip to content

Commit

Permalink
fixed verbosity issue, where adding a verbose flag to the mpi command…
Browse files Browse the repository at this point in the history
… would also make e4s-cl go into verbose mode when implicitly launching processes through e4s-cl
  • Loading branch information
FrederickDeny committed Aug 20, 2024
1 parent a91464e commit 1980293
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions e4s_cl/cli/commands/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ def _construct_parser(self):

return parser

def set_log_level(self, argList):
quiet = getattr(argList, 'quiet', logger.LOG_LEVEL)
verbose = getattr(argList, 'verbose', quiet)
logger.set_log_level(verbose)

def _py38_parse(self, argv):
"""
If a command is not detected, insert 'launch' in the argv array
"""

# Debug is not enabled until below, so the following statement
# enables it for this code block
if {'-v', '--verbose'} & set(argv):
logger.set_log_level('DEBUG')
self.set_log_level(argv)

empty = len(argv) == 0
command = set(argv) & set(cli.commands_next())
Expand Down Expand Up @@ -161,8 +165,8 @@ def _py39_parse(self, argv):
except arguments.ArgumentError as err:
# Debug is not enabled until below, so the following statement
# enables it for this code block
if {'-v', '--verbose'} & set(argv):
logger.set_log_level('DEBUG')
self.set_log_level(argv)

LOGGER.debug("Argument parsing errored out with '%s'", argv)

# Check for the presence of a e4s-cl command
Expand Down Expand Up @@ -213,9 +217,7 @@ def main(self, argv):

args = parse_method(argv)

quiet = getattr(args, 'quiet', logger.LOG_LEVEL)
verbose = getattr(args, 'verbose', quiet)
logger.set_log_level(verbose)
self.set_log_level(args)

# Try to execute as a command
try:
Expand Down

0 comments on commit 1980293

Please sign in to comment.