diff --git a/sen2chain/download_eodag.py b/sen2chain/download_eodag.py index 3589c009ff0484bd49d39b4c3dc5afe42a5852f5..f21e75648268284c165505bca70b77ecb6a54879 100644 --- a/sen2chain/download_eodag.py +++ b/sen2chain/download_eodag.py @@ -63,6 +63,7 @@ class S2cEodag: max_cloudcover: int = 100, min_pb: str = 0, max_pb: str = 9999, + retry: int = 4, ): ######### ici faudrait virer le self.productType, qui ne doit pas être global pour le download... if productType == "L1C": @@ -93,15 +94,28 @@ class S2cEodag: self.products = self.dag.search_all(**default_search_criteria) logging.disable(logging.NOTSET) except (ConnectTimeout, MaxRetryError, TimeoutError, ConnectTimeoutError): + if retry > 0: + logger.info(f"Issue with tile search, retrying (#{retry})") + return self.search( + productType, + start, + end, + ref, + min_cloudcover, + max_cloudcover, + min_pb, + max_pb, + retry - 1, + ) logging.disable(logging.NOTSET) logger.exception( "Issue with this tile search for now, should try to increase the timeout for this provider or check your internet connexion" ) - return + return [] except Exception: logging.disable(logging.NOTSET) logger.exception("An error occured check everything") - return + return [] if self.provider == "peps": for p in self.products: