﻿# SimPy FilterStore: an earlier incompatible request need not block a later match

Distinguish FilterStore item order from request fulfillment order, and verify machine eligibility before calling a later matching grant a fairness defect.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/simulation-simpy-filterstore-eligibility-not-global-fifo/
Language: en

## A heterogeneous pool has more than a queue length

A factory twin stores machines with different capabilities in a shared pool. The first waiting job needs a large machine, while a later job can use the small machine that becomes available. The later job proceeds, and a report calls this a FIFO violation. The report has ignored request eligibility. Preserve both the requested capability and the identity of the machine granted before judging the order in which waiting jobs receive service.

## Request order is not guaranteed globally

The [FilterStore API](https://simpy.readthedocs.io/en/stable/api_reference/simpy.resources.html) explicitly warns that get requests are not necessarily triggered in issue order. A request only succeeds for an object accepted by its filter. An earlier unmatched request need not prevent a later compatible one from obtaining an available object. Distinguish this request-level behavior from the underlying store’s item-order description. A statement about stored objects cannot be promoted into an unconditional promise about all waiting consumers.

## Inspect the matching predicate and selected object

The pinned [store implementation](https://gitlab.com/team-simpy/simpy/-/raw/4.1.2/src/simpy/resources/store.py) searches the available items for a filter match and removes the matched item when fulfilling the request. Keep predicates understandable in terms of modeled requirements, such as capability or tool compatibility. A permissive predicate can allocate an unsuitable machine even if queue accounting remains correct. Conversely, a predicate that accepts no available machine explains waiting without requiring a scheduler failure. Log the actual matched object rather than only its generic resource class.

## Propose a deliberately incompatible head request

A proposed fixture should enqueue a restrictive request before a compatible flexible request, then make only the latter’s machine type available. Verify the expected later grant and continued waiting of the incompatible request. Add an appropriate machine afterward and inspect the remaining grant. No SimPy matching experiment was executed here. Acceptance should retain request order, predicates, available objects and actual assignments so the observed behavior can be explained without a misleading aggregate FIFO label.

## Add fairness only as an explicit policy

Compatibility matching does not establish a bounded wait for every request. A restrictive job can wait indefinitely if suitable machines never appear or a competing policy repeatedly consumes them. If strict arrival ordering or reservations are required, model that rule explicitly and accept its consequences for idle incompatible capacity. Do not claim that changing the filter alone solves fairness. The desired dispatch policy should state which idle machines may be used and which jobs may block other eligible work.

## Keep compatibility evidence separate from capacity forecasts

The [ClearML eligibility guide](/journal/fg2-clearml-queue-name-agent-gpu-eligibility/) covers another capability-routing boundary; [stack reproducibility](/journal/software-stack-reproducibility/) supports retaining predicates and pool definitions. Correct filtered assignment establishes which modeled object served a job. It does not validate machine availability distributions, real production throughput or the optimality of a matching policy. Those questions require additional evidence after the team can explain why every grant was compatible and why unmatched work remained waiting.
