From c8868f1922c91fb7d8635ed88a06159857a7cae6 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Wed, 30 Jun 2021 14:16:15 -0400 Subject: ci: only write to broken-specs list on SpackError (#24618) ci: only write to broken-specs list on SpackError Only write to the broken-specs list when `spack install` raises a SpackError, instead of writing to this list unnecessarily when infrastructure-related problems prevent a develop job from completing successfully. --- lib/spack/spack/cmd/ci.py | 5 ++--- lib/spack/spack/main.py | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/ci.py b/lib/spack/spack/cmd/ci.py index bc0c1685ae..804cd3ab80 100644 --- a/lib/spack/spack/cmd/ci.py +++ b/lib/spack/spack/cmd/ci.py @@ -14,11 +14,10 @@ import tempfile from six.moves.urllib.parse import urlencode import llnl.util.tty as tty - import spack.binary_distribution as bindist import spack.ci as spack_ci -import spack.config as cfg import spack.cmd.buildcache as buildcache +import spack.config as cfg import spack.environment as ev import spack.hash_types as ht import spack.mirror @@ -492,7 +491,7 @@ def ci_rebuild(args): # If a spec fails to build in a spack develop pipeline, we add it to a # list of known broken full hashes. This allows spack PR pipelines to # avoid wasting compute cycles attempting to build those hashes. - if install_exit_code != 0 and spack_is_develop_pipeline: + if install_exit_code == 1 and spack_is_develop_pipeline: tty.debug('Install failed on develop') if 'broken-specs-url' in gitlab_ci: broken_specs_url = gitlab_ci['broken-specs-url'] diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 18a95bb969..c088f068f6 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -10,35 +10,36 @@ after the system path is set up. """ from __future__ import print_function -import sys -import re +import argparse +import inspect import os import os.path -import inspect import pstats -import argparse +import re +import signal +import sys import traceback import warnings -from six import StringIO import archspec.cpu +from six import StringIO + import llnl.util.filesystem as fs import llnl.util.tty as tty import llnl.util.tty.color as color -from llnl.util.tty.log import log_output - import spack import spack.architecture -import spack.config import spack.cmd +import spack.config import spack.environment as ev import spack.modules import spack.paths import spack.repo import spack.store import spack.util.debug -import spack.util.path import spack.util.executable as exe +import spack.util.path +from llnl.util.tty.log import log_output from spack.error import SpackError #: names of profile statistics @@ -774,22 +775,24 @@ def main(argv=None): tty.debug(e) e.die() # gracefully die on any SpackErrors - except Exception as e: - if spack.config.get('config:debug'): - raise - tty.die(e) - except KeyboardInterrupt: if spack.config.get('config:debug'): raise sys.stderr.write('\n') - tty.die("Keyboard interrupt.") + tty.error("Keyboard interrupt.") + return signal.SIGINT.value except SystemExit as e: if spack.config.get('config:debug'): traceback.print_exc() return e.code + except Exception as e: + if spack.config.get('config:debug'): + raise + tty.error(e) + return 3 + class SpackCommandError(Exception): """Raised when SpackCommand execution fails.""" -- cgit v1.2.3-70-g09d2