backtraces with --backtrace (#33478)
* backtraces without --debug Currently `--debug` is too verbose and not-`--debug` gives to little context about where exceptions are coming from. So, instead, it'd be nice to have `spack --backtrace` and `SPACK_BACKTRACE=1` as methods to get something inbetween: no verbose debug messages, but always a full backtrace. This is useful for CI, where we don't want to drown in debug messages when installing deps, but we do want to get details where something goes wrong if it goes wrong. * completion
This commit is contained in:
parent
6c32c6fbdb
commit
7d99fbcafd
@ -527,6 +527,12 @@ def make_argument_parser(**kwargs):
|
|||||||
default="SPACK_STACKTRACE" in os.environ,
|
default="SPACK_STACKTRACE" in os.environ,
|
||||||
help="add stacktraces to all printed statements",
|
help="add stacktraces to all printed statements",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--backtrace",
|
||||||
|
action="store_true",
|
||||||
|
default="SPACK_BACKTRACE" in os.environ,
|
||||||
|
help="always show backtraces for exceptions",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-V", "--version", action="store_true", help="show version number and exit"
|
"-V", "--version", action="store_true", help="show version number and exit"
|
||||||
)
|
)
|
||||||
@ -561,8 +567,10 @@ def setup_main_options(args):
|
|||||||
# debug must be set first so that it can even affect behavior of
|
# debug must be set first so that it can even affect behavior of
|
||||||
# errors raised by spack.config.
|
# errors raised by spack.config.
|
||||||
|
|
||||||
|
if args.debug or args.backtrace:
|
||||||
|
spack.error.debug = True
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
spack.error.debug = args.debug
|
|
||||||
spack.util.debug.register_interrupt_handler()
|
spack.util.debug.register_interrupt_handler()
|
||||||
spack.config.set("config:debug", True, scope="command_line")
|
spack.config.set("config:debug", True, scope="command_line")
|
||||||
spack.util.environment.tracing_enabled = True
|
spack.util.environment.tracing_enabled = True
|
||||||
|
@ -335,7 +335,7 @@ _spacktivate() {
|
|||||||
_spack() {
|
_spack() {
|
||||||
if $list_options
|
if $list_options
|
||||||
then
|
then
|
||||||
SPACK_COMPREPLY="-h --help -H --all-help --color -c --config -C --config-scope -d --debug --timestamp --pdb -e --env -D --env-dir -E --no-env --use-env-repo -k --insecure -l --enable-locks -L --disable-locks -m --mock -b --bootstrap -p --profile --sorted-profile --lines -v --verbose --stacktrace -V --version --print-shell-vars"
|
SPACK_COMPREPLY="-h --help -H --all-help --color -c --config -C --config-scope -d --debug --timestamp --pdb -e --env -D --env-dir -E --no-env --use-env-repo -k --insecure -l --enable-locks -L --disable-locks -m --mock -b --bootstrap -p --profile --sorted-profile --lines -v --verbose --stacktrace --backtrace -V --version --print-shell-vars"
|
||||||
else
|
else
|
||||||
SPACK_COMPREPLY="activate add arch audit blame bootstrap build-env buildcache cd change checksum ci clean clone commands compiler compilers concretize config containerize create deactivate debug dependencies dependents deprecate dev-build develop diff docs edit env extensions external fetch find gc gpg graph help info install license list load location log-parse maintainers make-installer mark mirror module patch pkg providers pydoc python reindex remove rm repo resource restage solve spec stage style tags test test-env tutorial undevelop uninstall unit-test unload url verify versions view"
|
SPACK_COMPREPLY="activate add arch audit blame bootstrap build-env buildcache cd change checksum ci clean clone commands compiler compilers concretize config containerize create deactivate debug dependencies dependents deprecate dev-build develop diff docs edit env extensions external fetch find gc gpg graph help info install license list load location log-parse maintainers make-installer mark mirror module patch pkg providers pydoc python reindex remove rm repo resource restage solve spec stage style tags test test-env tutorial undevelop uninstall unit-test unload url verify versions view"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user