iqm.cpc.core.observation.observation_handler.load_observations_by_rules

iqm.cpc.core.observation.observation_handler.load_observations_by_rules#

iqm.cpc.core.observation.observation_handler.load_observations_by_rules(load_rules, dut_label, default_storage)#

Load observations resolved by the given rules, keyed by whichever dut fields they resolve to.

Unlike populating an ObservationHandler with every known dut field, this only touches the dut fields that the given load_rules themselves surface from the DB, so it works without any prior knowledge of which dut fields exist for the DUT. As a consequence, a rule that isn’t a CacheableLoadRule (e.g. Fail, LatestFromStash) never contributes any dut field to resolve against, since there’s no cached query result to discover them from. If load_rules contains no CacheableLoadRule at all, a warning is logged and no observations are returned.

Parameters:
  • load_rules (Sequence[RuleType]) – Loading rules to resolve, tried in order per dut field.

  • dut_label (str) – DUT to resolve the rule for.

  • default_storage (StorageInterface) – Default storage to use for loading observations in case the rules do not pin a storage backend.

Returns:

Mapping from resolved dut field paths to their observations.

Return type:

dict[str, ObservationBase]