Skip to content

WorkItem

QuantConnect.Lean.Engine.DataFeeds.WorkScheduling.WorkItem

WorkItem(
    work: Callable[[int], bool],
    weight_func: Callable[[], int],
)

Bases: Object

Class to represent a work item

Creates a new instance

Parameters:

Name Type Description Default
work Callable[[int], bool]

The work function, takes an int, the amount of work to do and returns a bool, false if this work item is finished

required
weight_func Callable[[], int]

The function used to determine the current weight

required

weight

weight: int

The current weight

work

work: Callable[[int], bool]

The work function to execute

compare

compare(obj: WorkItem, other: WorkItem) -> int

Compares two work items based on their weights

update_weight

update_weight() -> int

Updates the weight of this work item