Skip to content

Commit

Permalink
fix(core): polling times and typing update (#1440)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato authored Dec 11, 2024
1 parent 7e502af commit 3c2fcc7
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 41 deletions.
8 changes: 4 additions & 4 deletions eodag/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2007,8 +2007,8 @@ def download_all(
search_result: SearchResult,
downloaded_callback: Optional[DownloadedCallback] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> List[str]:
"""Download all products resulting from a search.
Expand Down Expand Up @@ -2170,8 +2170,8 @@ def download(
self,
product: EOProduct,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> str:
"""Download a single product.
Expand Down
4 changes: 2 additions & 2 deletions eodag/api/product/_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ def register_downloader(
def download(
self,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> str:
"""Download the EO product using the provided download plugin and the
Expand Down
8 changes: 4 additions & 4 deletions eodag/plugins/apis/ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def download(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> Optional[str]:
"""Download data from ECMWF MARS"""
Expand Down Expand Up @@ -268,8 +268,8 @@ def download_all(
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
downloaded_callback: Optional[DownloadedCallback] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> List[str]:
"""
Expand Down
8 changes: 4 additions & 4 deletions eodag/plugins/apis/usgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ def download(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> Optional[str]:
"""Download data from USGS catalogues"""
Expand Down Expand Up @@ -467,8 +467,8 @@ def download_all(
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
downloaded_callback: Optional[DownloadedCallback] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> List[str]:
"""
Expand Down
12 changes: 6 additions & 6 deletions eodag/plugins/download/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ def download(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> Optional[str]:
"""Download method for AWS S3 API.
Expand Down Expand Up @@ -649,8 +649,8 @@ def _stream_download_dict(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> StreamResponse:
r"""
Expand Down Expand Up @@ -1330,8 +1330,8 @@ def download_all(
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
downloaded_callback: Optional[DownloadedCallback] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> List[str]:
"""
Expand Down
14 changes: 7 additions & 7 deletions eodag/plugins/download/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def download(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> Optional[str]:
r"""
Expand Down Expand Up @@ -142,8 +142,8 @@ def _stream_download_dict(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> StreamResponse:
r"""
Expand Down Expand Up @@ -448,8 +448,8 @@ def download_all(
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
downloaded_callback: Optional[DownloadedCallback] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> List[str]:
"""
Expand Down Expand Up @@ -590,7 +590,7 @@ def download_all(
return paths

def _order_download_retry(
self, product: EOProduct, wait: int, timeout: int
self, product: EOProduct, wait: float, timeout: float
) -> Callable[[Callable[..., T]], Callable[..., T]]:
"""
Order download retry decorator.
Expand Down
20 changes: 10 additions & 10 deletions eodag/plugins/download/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ def download(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> Optional[str]:
"""Download a product using HTTP protocol.
Expand Down Expand Up @@ -632,8 +632,8 @@ def download_request(
product: EOProduct,
auth: AuthBase,
progress_callback: ProgressCallback,
wait: int,
timeout: int,
wait: float,
timeout: float,
**kwargs: Unpack[DownloadConf],
) -> None:
chunks = self._stream_download(product, auth, progress_callback, **kwargs)
Expand Down Expand Up @@ -759,8 +759,8 @@ def _stream_download_dict(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> StreamResponse:
r"""
Expand Down Expand Up @@ -924,8 +924,8 @@ def order(
self,
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
) -> None:
"""
Order product and poll to check its status
Expand Down Expand Up @@ -1404,8 +1404,8 @@ def download_all(
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
downloaded_callback: Optional[DownloadedCallback] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
):
"""
Expand Down
4 changes: 2 additions & 2 deletions eodag/plugins/download/s3rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def download(
product: EOProduct,
auth: Optional[Union[AuthBase, Dict[str, str]]] = None,
progress_callback: Optional[ProgressCallback] = None,
wait: int = DEFAULT_DOWNLOAD_WAIT,
timeout: int = DEFAULT_DOWNLOAD_TIMEOUT,
wait: float = DEFAULT_DOWNLOAD_WAIT,
timeout: float = DEFAULT_DOWNLOAD_TIMEOUT,
**kwargs: Unpack[DownloadConf],
) -> Optional[str]:
"""Download method for S3 REST API.
Expand Down
4 changes: 2 additions & 2 deletions eodag/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
REQ_RETRY_STATUS_FORCELIST = [401, 429, 500, 502, 503, 504]

# default wait times in minutes
DEFAULT_DOWNLOAD_WAIT = 2 # in minutes
DEFAULT_DOWNLOAD_TIMEOUT = 20 # in minutes
DEFAULT_DOWNLOAD_WAIT = 0.2 # in minutes
DEFAULT_DOWNLOAD_TIMEOUT = 10 # in minutes

JSONPATH_MATCH = re.compile(r"^[\{\(]*\$(\..*)*$")
WORKABLE_JSONPATH_MATCH = re.compile(r"^\$(\.[a-zA-Z0-9-_:\.\[\]\"\(\)=\?\*]+)*$")
Expand Down

0 comments on commit 3c2fcc7

Please sign in to comment.