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](workitemid.md?sid=flyteplugins_go_tasks_pluginmachinery_workqueue_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.
id[WorkItemID](workitemid.md?sid=flyteplugins_go_tasks_pluginmachinery_workqueue_workitemid)The 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](workitemid.md?sid=flyteplugins_go_tasks_pluginmachinery_workqueue_workitemid)
) - > (info WorkItemInfo, found bool, err error)

Retrieves an item by id.

Parameters

NameTypeDescription
id[WorkItemID](workitemid.md?sid=flyteplugins_go_tasks_pluginmachinery_workqueue_workitemid)The 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.