Coverage for src/python/ensembl/vep/config/sections/bench/matrix.py: 100%

12 statements  

« 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 timing strategies and cache configurations against each other.""" 

15 

16from __future__ import annotations 

17 

18from typing import ClassVar 

19 

20from attrs import define, field 

21 

22from ensembl.vep.config.option_spec import option 

23from ensembl.vep.config.sections.base import ConfigSection 

24 

25__all__ = ["BenchMatrixConfig"] 

26 

27 

28@define(frozen=True, kw_only=True, auto_attribs=True) 

29class BenchMatrixConfig(ConfigSection): 

30 """Which strategies, crossed with which cache sets. 

31 

32 Attributes: 

33 strategies (tuple[str, ...]): Strategies to time, or empty for every registered 

34 ``consequence.*`` strategy. ``consequence.linear`` is always timed first, as the 

35 reference the speed-up column is against. 

36 caches (tuple[str, ...]): Cache sets to cross every strategy with: ``none``, or a 

37 ``+``-joined set of ``zonemap``, ``codon`` and ``mapper``. Each configuration gets 

38 fresh caches, so none is timed against another's warmed ones. 

39 batch_size (int): Chunk size for the batch timing. 

40 """ 

41 

42 section_name: ClassVar[str] = "bench_matrix" 

43 

44 strategies: tuple[str, ...] = field( 

45 default=(), 

46 metadata=option("strategies to time (default: every consequence strategy)", metavar="NAME,..."), 

47 ) 

48 caches: tuple[str, ...] = field( 

49 default=("none", "zonemap", "zonemap+codon"), 

50 metadata=option("cache sets to cross each strategy with", metavar="SET,..."), 

51 ) 

52 batch_size: int = field(default=256, metadata=option("chunk size for the batch timing", metavar="N"))