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](entry.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_entry), error

Returns the artifact associated with the given key.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, enabling 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](entry.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_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 request, enabling 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 after which the reservation should be considered expired if not extended.

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](metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_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 request, enabling cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier under which to store the data.
readerio.OutputReaderThe reader providing the data to be stored.
metadata[Metadata](metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_metadata)Additional metadata to associate with the stored artifact.

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](metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_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 request, enabling cancellation and timeouts.
key[Key](key.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_key)The unique identifier of the artifact to update.
readerio.OutputReaderThe reader providing the new data to overwrite the existing artifact.
metadata[Metadata](metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_metadata)Additional metadata to associate with the updated artifact.

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 request, enabling 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 the reservation could not be released.

GetReservationCache()

@classmethod
def GetReservationCache(
ownerID: string
) - > [ReservationCache](reservationcache.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_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
[ReservationCache](reservationcache.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_reservationcache)The reservation cache associated with the owner ID.

UpdateReservationCache()

@classmethod
def UpdateReservationCache(
ownerID: string,
entry: [ReservationCache](reservationcache.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_reservationcache)
)

Updates the reservation cache for the given owner ID

Parameters

NameTypeDescription
ownerIDstringThe identifier of the owner whose reservation cache is to be updated.
entry[ReservationCache](reservationcache.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_reservationcache)The new reservation cache entry to set for the owner.