From 6473fab592984f2991bb232dd676e3f67e9207bf Mon Sep 17 00:00:00 2001 From: David Ormrod Morley Date: Fri, 6 Dec 2024 10:42:40 +0100 Subject: [PATCH] Make warnings on accessing results of failed jobs less chatty SO107 SCMSUITE-8725 --- core/results.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/results.py b/core/results.py index ccb48425..939e7c23 100644 --- a/core/results.py +++ b/core/results.py @@ -80,10 +80,21 @@ def guardian(self, *args, **kwargs): raise ResultsError("Using Results associated with deleted job") elif self.job.status in [JobStatus.CRASHED, JobStatus.FAILED]: - if func.__name__ == "wait": # waiting for crashed of failed job should not trigger any warnings/exceptions + # waiting for crashed of failed job should not trigger any warnings/exceptions + # and neither should checking the status from this job with 'ok', 'check' or 'get_errormsg' + suppress_errors = func.__name__ == "wait" + if not suppress_errors: + for frame in inspect.getouterframes(inspect.currentframe()): + cal, arg = _caller_name_and_arg(frame[0]) + if arg == self.job and cal in ["ok", "check", "get_errormsg"]: + suppress_errors = True + break + + if suppress_errors: cal, arg = _caller_name_and_arg(inspect.currentframe()) if isinstance(arg, Results): return func(self, *args, **kwargs) + if config.ignore_failure: log("WARNING: Trying to obtain results of crashed or failed job {}".format(self.job.name), 3) try: