args = config.add_commandline_args(
f'Bootstrap ({__file__})',
args = config.add_commandline_args(
f'Bootstrap ({__file__})',
Top-level exception handler for exceptions that make it past any exception
handlers in the python code being run. Logs the error and stacktrace then
maybe attaches a debugger.
Top-level exception handler for exceptions that make it past any exception
handlers in the python code being run. Logs the error and stacktrace then
maybe attaches a debugger.
# stdin or stderr is redirected, just do the normal thing
original_hook(exc_type, exc_value, exc_tb)
else:
# a terminal is attached and stderr is not redirected, maybe debug.
import traceback
# stdin or stderr is redirected, just do the normal thing
original_hook(exc_type, exc_value, exc_tb)
else:
# a terminal is attached and stderr is not redirected, maybe debug.
import traceback
traceback.print_exception(exc_type, exc_value, exc_tb)
if config.config['debug_unhandled_exceptions']:
import pdb
traceback.print_exception(exc_type, exc_value, exc_tb)
if config.config['debug_unhandled_exceptions']:
import pdb
self.module_by_filename_cache = {}
self.repopulate_modules_by_filename()
self.tree = collect.trie.Trie()
self.module_by_filename_cache = {}
self.repopulate_modules_by_filename()
self.tree = collect.trie.Trie()
path = self.tree_node_by_module.get(loading_module, [])
path.extend([loaded_module])
path = self.tree_node_by_module.get(loading_module, [])
path.extend([loaded_module])
@functools.wraps(entry_point)
def initialize_wrapper(*args, **kwargs):
# Hook top level unhandled exceptions, maybe invoke debugger.
@functools.wraps(entry_point)
def initialize_wrapper(*args, **kwargs):
# Hook top level unhandled exceptions, maybe invoke debugger.
random_seed = config.config['set_random_seed']
if random_seed is not None:
random_seed = random_seed[0]
random_seed = config.config['set_random_seed']
if random_seed is not None:
random_seed = random_seed[0]
with stopwatch.Timer() as t:
ret = entry_point(*args, **kwargs)
logger.debug(
with stopwatch.Timer() as t:
ret = entry_point(*args, **kwargs)
logger.debug(
walltime = t()
(utime, stime, cutime, cstime, elapsed_time) = os.times()
walltime = t()
(utime, stime, cutime, cstime, elapsed_time) = os.times()
- 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'machine uptime: {elapsed_time}s\n'
- f'walltime: {walltime}s')
+ 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'machine uptime: {elapsed_time}s\n'
+ f'walltime: {walltime}s'
+ )
# If it doesn't return cleanly, call attention to the return value.
if ret is not None and ret != 0:
# If it doesn't return cleanly, call attention to the return value.
if ret is not None and ret != 0: