aistore.sdk.presence_poller

View as Markdown

Module Contents

Classes

NameDescription
PresencePollerUtility class for making a best-effort attempt at retrying HEAD calls to an object until it is present in

Data

logger

API

class aistore.sdk.presence_poller.PresencePoller(
session_request_fn: typing.Callable[..., requests.Response],
cold_get_conf: aistore.sdk.retry_config.ColdGetConf
)

Utility class for making a best-effort attempt at retrying HEAD calls to an object until it is present in cluster.

This class provides a way to delay this retry until the object is present.

aistore.sdk.presence_poller.PresencePoller._create_cold_get_retryer(
size: int
) -> tenacity.Retrying

Given an object size, create a retryer. Args: size (int) : Object size in bytes. Returns: tenacity.Retrying determining how to retry the given function.

aistore.sdk.presence_poller.PresencePoller._head_req(
req: requests.PreparedRequest
) -> aistore.sdk.obj.object_attributes.ObjectAttributes

Given a PreparedRequest, send a HEAD to that same object URL. Args: req (PreparedRequest): Initial request for an object.

Returns: Object attributes of the object in the initial request.

aistore.sdk.presence_poller.PresencePoller.wait_for_presence(
req: requests.PreparedRequest
)

Calls HEAD on the object from the given PreparedRequest. Uses the object attributes to make an intelligent guess at when we should re-raise the error and proceed to the next retry, based on the size of the object. This method has no effect besides delaying a higher-level function until presence is confirmed or retries are exhausted.

Parameters:

req
PreparedRequest

Request made to AIS target before receiving initial error.

aistore.sdk.presence_poller.logger = get_logger(__name__)