Safe Haskell | Safe-Infered |
---|
Filtering of jobs for the Ganeti job queue.
- accessOpCodeField :: OpCode -> String -> ErrorResult JSValue
- opCodesOf :: QueuedJob -> [OpCode]
- reasonsOf :: QueuedJob -> [ReasonElem]
- evaluateFilterComparator :: Ord field => Filter field -> (Comparator -> field -> FilterValue -> Maybe Bool) -> Bool
- matchPredicate :: QueuedJob -> JobId -> FilterPredicate -> Bool
- matches :: QueuedJob -> FilterRule -> Bool
- orderFilters :: Set FilterRule -> [FilterRule]
- applyingFilter :: Set FilterRule -> QueuedJob -> Maybe FilterRule
- type RateLimitSlotMap = SlotMap String
- data FilterChainState = FilterChainState {}
- tryFitSlots :: FilterChainState -> CountMap String -> Maybe FilterChainState
- queueRateLimitSlotMap :: Queue -> Set FilterRule -> RateLimitSlotMap
- jobFiltering :: Queue -> Set FilterRule -> [JobWithStat] -> [JobWithStat]
Documentation
accessOpCodeField :: OpCode -> String -> ErrorResult JSValueSource
reasonsOf :: QueuedJob -> [ReasonElem]Source
evaluateFilterComparator :: Ord field => Filter field -> (Comparator -> field -> FilterValue -> Maybe Bool) -> BoolSource
:: QueuedJob | |
-> JobId | the watermark to compare against if the predicate references it |
-> FilterPredicate | |
-> Bool |
Whether a FilterPredicate
is true for a job.
matches :: QueuedJob -> FilterRule -> BoolSource
Whether all predicates of the filter rule are true for the job.
orderFilters :: Set FilterRule -> [FilterRule]Source
applyingFilter :: Set FilterRule -> QueuedJob -> Maybe FilterRuleSource
Finds the first filter whose predicates all match the job and whose
action is not Continue
. This is the applying filter.
type RateLimitSlotMap = SlotMap StringSource
data FilterChainState Source
Eq FilterChainState | |
Ord FilterChainState | |
Show FilterChainState |
tryFitSlots :: FilterChainState -> CountMap String -> Maybe FilterChainStateSource
queueRateLimitSlotMap :: Queue -> Set FilterRule -> RateLimitSlotMapSource
jobFiltering :: Queue -> Set FilterRule -> [JobWithStat] -> [JobWithStat]Source
Implements job filtering as specified in `doc/design-optables.rst`.
Importantly, the filter that *applies* is the first one of which all
predicates match; this is implemented in applyingFilter
.
The initial FilterChainState
is currently not cached across
selectJobsToRun
invocations because the number of running jobs is
typically small (< 100).