Skip to main content

Client

Client represents the default cache client that allows the memoization data in Flyte

Methods​


Get()​

@classmethod
def Get(
ctx: context.Context,
key: [Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)
) - > Entry, error

Returns the artifact associated with the given key.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier for the artifact to retrieve.

Returns​

TypeDescription
Entry, errorThe artifact entry and an error, if any.

GetOrExtendReservation()​

@classmethod
def GetOrExtendReservation(
ctx: context.Context,
key: [Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key),
ownerID: string,
heartbeatInterval: time.Duration
) - > *cacheservice.Reservation, error

Tries to retrieve a (valid) reservation for the given key, creating a new one using the specified owner ID if none was found or updating an existing one if it has expired.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier for the reservation.
ownerIDstringThe identifier of the owner requesting or extending the reservation.
heartbeatIntervaltime.DurationThe duration for which the reservation should be valid before requiring an extension.

Returns​

TypeDescription
*cacheservice.Reservation, errorThe reservation object and an error, if any.

Put()​

@classmethod
def Put(
ctx: context.Context,
key: [Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key),
reader: io.OutputReader,
metadata: Metadata
) - > [Status](status.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_status), error

Stores the given data using the specified key, creating artifact entries as required. To update an existing artifact, use Update instead.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier for the data to store.
readerio.OutputReaderThe reader providing the data to be stored.
metadataMetadataAdditional metadata to associate with the stored data.

Returns​

TypeDescription
[Status](status.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_status), errorThe status of the put operation and an error, if any.

Update()​

@classmethod
def Update(
ctx: context.Context,
key: [Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key),
reader: io.OutputReader,
metadata: Metadata
) - > [Status](status.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_status), error

Updates existing data stored at the specified key, overwriting artifact entries with the new data provided. To create a new (non-existent) artifact, use Put instead.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier for the data to update.
readerio.OutputReaderThe reader providing the new data to overwrite the existing data.
metadataMetadataAdditional metadata to associate with the updated data.

Returns​

TypeDescription
[Status](status.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_status), errorThe status of the update operation and an error, if any.

ReleaseReservation()​

@classmethod
def ReleaseReservation(
ctx: context.Context,
key: [Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key),
ownerID: string
) - > error

Releases an acquired reservation for the given key and owner ID.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier of the reservation to release.
ownerIDstringThe identifier of the owner who acquired the reservation.

Returns​

TypeDescription
errorAn error, if any, during the release operation.

GetReservationCache()​

@classmethod
def GetReservationCache(
ownerID: string
) - > ReservationCache

Checks the reservation cache for the given owner ID.

Parameters​

NameTypeDescription
ownerIDstringThe identifier of the owner whose reservation cache is to be retrieved.

Returns​

TypeDescription
ReservationCacheThe reservation cache associated with the owner ID.

UpdateReservationCache()​

@classmethod
def UpdateReservationCache(
ownerID: string,
entry: ReservationCache
)

Updates the reservation cache for the given owner ID.

Parameters​

NameTypeDescription
ownerIDstringThe identifier of the owner whose reservation cache is to be updated.
entryReservationCacheThe new reservation cache entry to set for the owner.