summaryrefslogtreecommitdiff
path: root/bootstrap.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-07-16 21:43:44 -0700
committerScott Gasch <[email protected]>2021-07-16 21:43:44 -0700
commit1574e8a3a8982fab9278ad534f9427d464e4bffb (patch)
treeec6e6428ce43f2af64598f2023de3f7d784c5fe3 /bootstrap.py
parent0e451d3b3bf899b3d9ac0c38e3c3cd9d9be170ba (diff)
Various
Diffstat (limited to 'bootstrap.py')
-rw-r--r--bootstrap.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 3c886ef..3b03b3a 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -12,7 +12,7 @@ import traceback
from argparse_utils import ActionNoYes
import config
-
+import logging_utils
logger = logging.getLogger(__name__)
@@ -48,9 +48,14 @@ def initialize(entry_point):
@functools.wraps(entry_point)
def initialize_wrapper(*args, **kwargs):
sys.excepthook = handle_uncaught_exception
- config.parse(entry_point.__globals__['__file__'])
+ if (
+ '__globals__' in entry_point.__dict__ and
+ '__file__' in entry_point.__globals__
+ ):
+ config.parse(entry_point.__globals__['__file__'])
+ else:
+ config.parse(None)
- import logging_utils
logging_utils.initialize_logging(logging.getLogger())
config.late_logging()
@@ -58,8 +63,8 @@ def initialize(entry_point):
logger.debug(f'Starting {entry_point.__name__} (program entry point)')
ret = None
- import timer
- with timer.Timer() as t:
+ import stopwatch
+ with stopwatch.Timer() as t:
ret = entry_point(*args, **kwargs)
logger.debug(
f'{entry_point.__name__} (program entry point) returned {ret}.'
@@ -67,13 +72,13 @@ def initialize(entry_point):
walltime = t()
(utime, stime, cutime, cstime, elapsed_time) = os.times()
- logger.debug(f'\n'
+ logger.debug('\n'
f'user: {utime}s\n'
f'system: {stime}s\n'
f'child user: {cutime}s\n'
f'child system: {cstime}s\n'
- f'elapsed: {elapsed_time}s\n'
- f'walltime: {walltime}s\n')
+ f'machine uptime: {elapsed_time}s\n'
+ f'walltime: {walltime}s')
if ret != 0:
logger.info(f'Exit {ret}')
else: