Coverage for src/python/ensembl/vep/config/sections/bench/sweep.py: 100%
14 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-18 14:41 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-18 14:41 +0000
1# See the NOTICE file distributed with this work for additional information
2# regarding copyright ownership.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Options for sweeping one numeric annotation setting."""
16from __future__ import annotations
18from typing import ClassVar
20from attrs import define, field
22from ensembl.vep.config.option_spec import option
23from ensembl.vep.config.sections.base import ConfigSection
25__all__ = ["SWEEPABLE_KNOBS", "BenchSweepConfig"]
27SWEEPABLE_KNOBS = ("batch_size", "codon_cache_entries", "mapper_cache_bytes", "zone_map_bytes")
28"""The numeric annotation settings a sweep can vary."""
31@define(frozen=True, kw_only=True, auto_attribs=True)
32class BenchSweepConfig(ConfigSection):
33 """Which setting to sweep, over which values, for which strategies.
35 Attributes:
36 strategies (tuple[str, ...]): Strategies to sweep, or empty for the batch strategies
37 available here -- ``consequence.columnar-staged``, and ``consequence.columnar-kernels``
38 when the native extension is built.
39 sweep_knob (str): The setting to vary.
40 sweep_values (tuple[int, ...]): The values to try, in order.
41 """
43 section_name: ClassVar[str] = "bench_sweep"
45 strategies: tuple[str, ...] = field(
46 default=(), metadata=option("strategies to sweep (default: the batch strategies)", metavar="NAME,...")
47 )
48 sweep_knob: str = field(default="batch_size", metadata=option("setting to vary", choices=SWEEPABLE_KNOBS))
49 sweep_values: tuple[int, ...] = field(
50 default=(32, 64, 128, 256, 512, 1024), metadata=option("values to try", metavar="N,N,...")
51 )