diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index 4c21772ff9..ca0768b948 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -44,6 +44,7 @@ from spack import traverse from spack.error import SpackError from spack.reporters import CDash, CDashConfiguration +from spack.reporters.cdash import SPACK_CDASH_TIMEOUT from spack.reporters.cdash import build_stamp as cdash_build_stamp # See https://docs.gitlab.com/ee/ci/yaml/#retry for descriptions of conditions @@ -1500,7 +1501,7 @@ def download_and_extract_artifacts(url, work_dir): request = Request(url, headers=headers) request.get_method = lambda: "GET" - response = opener.open(request) + response = opener.open(request, timeout=SPACK_CDASH_TIMEOUT) response_code = response.getcode() if response_code != 200: @@ -2248,7 +2249,7 @@ def create_buildgroup(self, opener, headers, url, group_name, group_type): request = Request(url, data=enc_data, headers=headers) - response = opener.open(request) + response = opener.open(request, timeout=SPACK_CDASH_TIMEOUT) response_code = response.getcode() if response_code not in [200, 201]: @@ -2294,7 +2295,7 @@ def populate_buildgroup(self, job_names): request = Request(url, data=enc_data, headers=headers) request.get_method = lambda: "PUT" - response = opener.open(request) + response = opener.open(request, timeout=SPACK_CDASH_TIMEOUT) response_code = response.getcode() if response_code != 200: diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py index 502f89d764..0c140a488d 100644 --- a/lib/spack/spack/reporters/cdash.py +++ b/lib/spack/spack/reporters/cdash.py @@ -58,7 +58,8 @@ # Initialize data structures common to each phase's report. CDASH_PHASES = set(MAP_PHASES_TO_CDASH.values()) CDASH_PHASES.add("update") - +# CDash request timeout in seconds +SPACK_CDASH_TIMEOUT = 45 CDashConfiguration = collections.namedtuple( "CDashConfiguration", ["upload_url", "packages", "build", "site", "buildstamp", "track"] @@ -447,7 +448,7 @@ def upload(self, filename): # By default, urllib2 only support GET and POST. # CDash expects this file to be uploaded via PUT. request.get_method = lambda: "PUT" - response = opener.open(request) + response = opener.open(request, timeout=SPACK_CDASH_TIMEOUT) if self.current_package_name not in self.buildIds: resp_value = response.read() if isinstance(resp_value, bytes): diff --git a/lib/spack/spack/test/ci.py b/lib/spack/spack/test/ci.py index 4eef036ddb..f3d47c45e9 100644 --- a/lib/spack/spack/test/ci.py +++ b/lib/spack/spack/test/ci.py @@ -51,7 +51,7 @@ def __init__(self, response_code=200, content_to_read=[]): self._content = content_to_read self._read = [False for c in content_to_read] - def open(self, request): + def open(self, request, data=None, timeout=object()): return self def getcode(self):