From 9ebd7fe1182a4d6afa027b88fb3d096408d9a912 Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Mon, 23 Jul 2018 11:33:31 +0100 Subject: _exceptions.py: Modify BstError API to allow optional retry job.py: Changes to the logic surrounding retry attempts and child process return codes element.py, source.py: ElementError and SourceError also implement this change. These exceptions now have an optional parameter of temporary which defaults to false. This will potentially break backwards compatibility where exceptions were previously raised and a retry was intended. To trigger a retry, one must now raise their SourceError or ElementError with temporary=True. This aims to fix #397. --- buildstream/_exceptions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'buildstream/_exceptions.py') diff --git a/buildstream/_exceptions.py b/buildstream/_exceptions.py index 8baf16706..ada697a53 100644 --- a/buildstream/_exceptions.py +++ b/buildstream/_exceptions.py @@ -99,7 +99,7 @@ class ErrorDomain(Enum): # class BstError(Exception): - def __init__(self, message, *, detail=None, domain=None, reason=None): + def __init__(self, message, *, detail=None, domain=None, reason=None, temporary=False): global _last_exception super().__init__(message) @@ -114,6 +114,11 @@ class BstError(Exception): # self.sandbox = None + # When this exception occurred during the handling of a job, indicate + # whether or not there is any point retrying the job. + # + self.temporary = temporary + # Error domain and reason # self.domain = domain -- cgit v1.2.1