-
Notifications
You must be signed in to change notification settings - Fork 57
Description
The PlanetaryComputer API has been especially finicky for me today, giving the opportunity to try upping the default timeout and max_retries on a search. But these are not having a discernible effect.
It looks like timeout can be set either as a keyword to client.open() or as an input to StacApiIO(), could these be in conflict?
pystac-client/pystac_client/client.py
Lines 102 to 103 in 7cb5fd2
| stac_io: StacApiIO | None = None, | |
| timeout: Timeout | None = None, |
pystac-client/pystac_client/stac_api_io.py
Lines 48 to 49 in 7cb5fd2
| timeout: Timeout | None = None, | |
| max_retries: int | Retry | None = 5, |
I was also expecting these two settings to work together (e.g. if we exceed a timeout, a retry will be triggered up to max_retries). But maybe retries are only attempted for specific return codes? Or maybe they only apply to client.search() and not subsequent commands like retrieving the item_collection?
Example:
import pystac_client
from pystac_client.stac_api_io import StacApiIO
url = 'https://planetarycomputer.microsoft.com/api/stac/v1'
client = pystac_client.Client.open(
url=url, stac_io=StacApiIO(max_retries=5), timeout=60,
)%%time
# This code occasionally fails with "APIError: The request exceeded the maximum allowed time, please try again. If the issue persists, please contact [email protected]."
# fast
results = client.search(
collections=["cop-dem-glo-30"],
bbox=[-107.989298, 38.143321, -106.13571, 39.389549],
)
# sporadic timeout at 30s
ic = results.item_collection() I came across this related over in pystac, but I'm still confused
stac-utils/pystac#1353