Skip to main content

sc_crawler.archive_rules

Archive rules: the records replaced by another record or deliberately dropped.

A record gets the ARCHIVED status only through the archive_rules listed here, which are applied by the pull and sync commands on every run:

  • Each old → new pair is one ArchiveRule: a rename or re-key is one rule, a split is one rule per successor with the same match, a merge is one rule per old record with the same successor. A dropped record has one rule with an empty successor and a reason.
  • match is the primary key of the record to archive, or a subset of its columns to archive every record with those values (a dict column such as config matches only when the whole dict is equal). successor gives the new values of the same columns. Give enum columns by the value of the member (e.g. spot for allocation), not by its name as stored in the database (SPOT).
  • Child records, i.e. records referencing an archived record in their primary key (e.g. the zones and prices of a regionregionA geographic area where a cloud vendor runs its data centers, such as Frankfurt or Northern Virginia, made up of one or more availability zones. A server type is offered in some regions only, and its price can differ by region; a region's ID, such as eu-central-1, is unique only within its vendor.Glossary, or the scores of a benchmark), are archived as well without their own rules. Add a rule for a child record only when its successor does not follow from the rules of its parents (e.g. the Hetzner zones below).
  • Never remove a rule that has archived records. Rules removed from here are kept as INACTIVE in the archive_rule table.

The methods matching and applying the rules are on ScModel and ArchiveRule, e.g. archived_by tracing which rules archived a record.

Use ARCHIVED only for our own decisions about the identity of a record, see Status on how it differs from INACTIVE and RETIRED.

Attributes:

attr archive_rules archive_rules.py:73–112⁠ (opens in a new tab)​

archive_rules: List[ArchiveRule] = [*[ArchiveRule(table_name='region', match={'vendor_id': 'hcloud', 'region_id': old}, successor={'vendor_id': 'hcloud', 'region_id': new}, reason=_HCLOUD_REASON) for old, new in _HCLOUD_DATACENTER_TO_LOCATION.items()], *[ArchiveRule(table_name='zone', match={'vendor_id': 'hcloud', 'region_id': old, 'zone_id': old}, successor={'vendor_id': 'hcloud', 'region_id': new, 'zone_id': new}, reason=_HCLOUD_REASON) for old, new in _HCLOUD_DATACENTER_TO_LOCATION.items()], *[ArchiveRule(table_name='server', match={'vendor_id': 'gcp', 'server_id': old}, successor={'vendor_id': 'gcp', 'server_id': new}, reason='Same machine as its successor: GCP renamed it and keeps the old name as an alias.') for old, new in _GCP_RENAMED_MACHINE_TYPES.items()], ArchiveRule(table_name='benchmark', match={'benchmark_id': 'app:static_web'}, successor={'benchmark_id': 'static_web:rps'}, reason='Replaced by the benchmarks of the static_web framework.')]

All archive rules, applied by the pull and sync commands.