Skip to main content

IndexedWorkQueue

Represents the indexed queue semantics. An indexed work queue is a work queue that additionally keeps track of the final processing results of work items.

Methods​


Queue()​

@classmethod
def Queue(
ctx: context.Context,
id: WorkItemID,
once: [WorkItem](workitem.md?sid=flyteplugins_go_tasks_pluginmachinery_workqueue_workitem)
) - > error

Queues the item to be processed. If the item is already in the cache or has been processed before (and is still in-memory), it'll not be added again.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation or timeouts.
idWorkItemIDThe unique identifier for the work item.
once[WorkItem](workitem.md?sid=flyteplugins_go_tasks_pluginmachinery_workqueue_workitem)The work item to be queued for processing.

Returns​

TypeDescription
errorAn error if the item could not be queued.

Get()​

@classmethod
def Get(
id: WorkItemID
) - > (info WorkItemInfo, found bool, err error)

Retrieves an item by id.

Parameters​

NameTypeDescription
idWorkItemIDThe unique identifier of the work item to retrieve.

Returns​

TypeDescription
(info WorkItemInfo, found bool, err error)Returns the WorkItemInfo if found, a boolean indicating if the item was found, and an error if any occurred during retrieval.

Start()​

@classmethod
def Start(
ctx: context.Context
) - > error

Start must be called before queuing items into the queue.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation or timeouts.

Returns​

TypeDescription
errorAn error if the queue could not be started.