Commit e73ba8d7 authored by Peter-Bernd Otte's avatar Peter-Bernd Otte

Improved verbosity option

parent 70497f17
......@@ -8,7 +8,10 @@
# on Mogon 2: run first
# module load lang/Python/3.6.6-foss-2018b
from mpi4py import MPI
try:
from mpi4py import MPI
except ImportError:
print("mpi4py module not loaded. On Mogon2 / HIMster2 type\n module load lang/Python/3.6.6-foss-2018b\nfirst.\n\n")
import platform
import multiprocessing # to get number of cores
import argparse
......@@ -28,7 +31,7 @@ logger = logging.getLogger('rank' + str(rank))
now = datetime.datetime.now()
parser = argparse.ArgumentParser(description='Workload distributor for trivial parallelism.')
parser.add_argument('execname', help='name of executable to call')
parser.add_argument("-v", "--verbose", help="increase output verbosity", default=False, action="store_true")
parser.add_argument("-v", "--verbosity", help="increase output verbosity", default=0, action="count")
parser.add_argument("-V", "--version", help="Returns the actual program version", action="version",
version='%(prog)s 0.3')
parser.add_argument("-d", "--delay", help="time delay in ms between starts of consecutive jobs to help "
......@@ -50,7 +53,9 @@ if rank == 0:
"appropriate launcher and a higher number of MPI ranks. eg mpirun -n 4 ./wkmgr.py [execname]")
args = parser.parse_args()
if args.verbose:
if args.verbosity > 1:
logger.setLevel(logging.INFO)
if args.verbosity > 0:
logger.setLevel(logging.DEBUG)
inputdir = args.input_dir+"/"
......@@ -93,10 +98,12 @@ clients = comm.gather(data, root=0)
# --- Distribute Settings
data = None
if rank == 0:
data = {"verbose": args.verbose}
data = {"verbosity": args.verbosity}
settings = comm.bcast(data, root=0)
if settings["verbose"]:
if settings["verbosity"] >1:
logger.setLevel(logging.INFO)
if settings["verbosity"] >0:
logger.setLevel(logging.DEBUG)
logger.info("Worker fully initialised.")
if rank == 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment