scope_profiler.astro_site
Astro/Starlight content for a catalogue of profiling runs.
scope-profiler site MANIFEST -o DOCS reads a YAML manifest that lists cases
(each a set of profiling files) and writes the pages and chart data of a
catalogue into an Astro project, where the site’s own build turns them into a
website. Nothing here renders HTML: a page is an MDX file of components plus a
JSON data file holding what it shows (the models of
:mod:scope_profiler.report_model, the same ones the HTML report is drawn
from), and charts are the plot-data JSON the HTML report embeds, drawn in the
browser by @scope-profiler/plotly.
The manifest::
title: Profiling cataloguedescription: Runs of my code.base: /my-catalogue # the site's base path: "/" plus the repo namedefaults: {scaling: strong, speedup_x: auto}cases: - id: poisson # default: the slug of the title title: Poisson solver description: Strong scaling of the solver. group: Solvers # optional: nests the case in a sidebar group tags: [cpu, scaling] scaling: strong # strong, weak, both or none metadata: minimal # or "all": publish every metadata field info: {commit: 843a82cd} runs: - {path: data/np1.h5, label: 1 rank} - {path: "data/np*.h5"} # globs, relative to the manifestAttributes
| Name | Description |
|---|---|
COMPONENTS | No description. |
CONTENT_DIR | No description. |
FIGURE_SUFFIXES | No description. |
HOTSPOTS | No description. |
IMAGE_SUFFIXES | No description. |
LANGUAGES | No description. |
MARKER | No description. |
MAX_CHART_BYTES | No description. |
MAX_COPIED_FILE_BYTES | No description. |
MAX_SHOWN_FILE_BYTES | No description. |
METADATA_KEYS | No description. |
PUBLIC_DIR | No description. |
REFERENCE_RUNS | No description. |
SCALING_CHOICES | No description. |
Classes
| Name | Description |
|---|---|
Case | A set of runs shown together; runs is the latest execution's when it has several. |
CodeSpec | Code shown at the bottom of a case: a file of the manifest's tree, a link, or both. |
Execution | One execution of a case that is run again and again (a nightly job): a set of runs. |
Manifest | The parsed catalogue manifest. |
RunSpec | One profiling file of a case. |
SiteError | The manifest is invalid, or the site cannot be written. |
SiteResult | What :func:build_site wrote. |
Functions
| Name | Description |
|---|---|
build_site | Write the catalogue's pages and chart data into the Astro project output. |
load_manifest | Read and validate a catalogue manifest. |
slugify | Lower-case text into a URL- and file-name-safe slug. |
COMPONENTSattributemodule attribute#
COMPONENTS = Path('src/components/report')CONTENT_DIRattributemodule attribute#
CONTENT_DIR = Path('src/content/docs/catalogue')FIGURE_SUFFIXESattributemodule attribute#
FIGURE_SUFFIXES = (*IMAGE_SUFFIXES, '.pdf')HOTSPOTSattributemodule attribute#
HOTSPOTS = 15IMAGE_SUFFIXESattributemodule attribute#
IMAGE_SUFFIXES = ('.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg')LANGUAGESattributemodule attribute#
LANGUAGES = {
'.py': 'python',
'.yml': 'yaml',
'.yaml': 'yaml',
'.json': 'json',
'.toml': 'toml',
'.sh': 'bash',
'.bash': 'bash',
'.md': 'markdown',
'.ini': 'ini',
'.cfg': 'ini',
'.c': 'c',
'.h': 'c',
'.cpp': 'cpp',
'.hpp': 'cpp',
'.f90': 'fortran',
'.f': 'fortran',
'.jl': 'julia',
'.m': 'matlab',
'.sbatch': 'bash',
'.slurm': 'bash'
}MARKERattributemodule attribute#
MARKER = '.scope-profiler-site'MAX_CHART_BYTESattributemodule attribute#
MAX_CHART_BYTES = 8000000MAX_COPIED_FILE_BYTESattributemodule attribute#
MAX_COPIED_FILE_BYTES = 20000000MAX_SHOWN_FILE_BYTESattributemodule attribute#
MAX_SHOWN_FILE_BYTES = 200000METADATA_KEYSattributemodule attribute#
METADATA_KEYS = (
'timestamp',
'platform',
'chip_information',
'python_version',
'scope_profiler_version',
'omp_num_threads',
'mpi_size',
'total_cores',
'num_nodes'
)PUBLIC_DIRattributemodule attribute#
PUBLIC_DIR = Path('public/catalogue')REFERENCE_RUNSattributemodule attribute#
REFERENCE_RUNS = 4SCALING_CHOICESattributemodule attribute#
SCALING_CHOICES = ('strong', 'weak', 'both', 'none')Caseclassdataclass#
class Case(id: str, title: str, runs: tuple[RunSpec, ...], description: str = '', group: str | None = None, tags: tuple[str, ...] = (), scaling: str = 'strong', speedup_x: str = 'auto', info: dict = dict(), include: tuple[str, ...] | None = None, exclude: tuple[str, ...] | None = None, ranks: tuple[int, ...] | None = None, charts: bool = True, metadata: str = 'minimal', files: tuple[Path, ...] = (), executions: tuple[Execution, ...] = (), images: tuple[Path, ...] = (), code: tuple[CodeSpec, ...] = ())A set of runs shown together; runs is the latest execution’s when it has several.
chartsattributeclass attributeinstance attribute#
charts: bool = Truecodeattributeclass attributeinstance attribute#
code: tuple[CodeSpec, ...] = ()descriptionattributeclass attributeinstance attribute#
description: str = ''excludeattributeclass attributeinstance attribute#
exclude: tuple[str, ...] | None = Noneexecutionsattributeclass attributeinstance attribute#
executions: tuple[Execution, ...] = ()filesattributeclass attributeinstance attribute#
files: tuple[Path, ...] = ()groupattributeclass attributeinstance attribute#
group: str | None = Noneidattributeinstance attribute#
id: strimagesattributeclass attributeinstance attribute#
images: tuple[Path, ...] = ()includeattributeclass attributeinstance attribute#
include: tuple[str, ...] | None = Noneinfoattributeclass attributeinstance attribute#
info: dict = field(default_factory=dict)metadataattributeclass attributeinstance attribute#
metadata: str = 'minimal'ranksattributeclass attributeinstance attribute#
ranks: tuple[int, ...] | None = Nonerunsattributeinstance attribute#
runs: tuple[RunSpec, ...]scalingattributeclass attributeinstance attribute#
scaling: str = 'strong'speedup_xattributeclass attributeinstance attribute#
speedup_x: str = 'auto'tagsattributeclass attributeinstance attribute#
tags: tuple[str, ...] = ()titleattributeinstance attribute#
title: strCodeSpecclassdataclass#
class CodeSpec(path: Path | None = None, url: str | None = None, label: str | None = None)Code shown at the bottom of a case: a file of the manifest’s tree, a link, or both.
Executionclassdataclass#
class Execution(id: str, label: str, runs: tuple[RunSpec, ...], date: str | None = None, info: dict = dict())One execution of a case that is run again and again (a nightly job): a set of runs.
Manifestclassdataclass#
class Manifest(title: str, cases: tuple[Case, ...], description: str = '', base: str | None = None)The parsed catalogue manifest.
RunSpecclassdataclass#
class RunSpec(path: Path, label: str | None = None, files: tuple[Path, ...] = (), images: tuple[Path, ...] = ())One profiling file of a case.
SiteErrorclass#
class SiteError(ValueError)Bases: ValueError
The manifest is invalid, or the site cannot be written.
SiteResultclassdataclass#
class SiteResult(files: list[Path], cases: int, runs: int, notes: list[str] = list())What :func:build_site wrote.
build_sitefunction#
def build_site(manifest: Manifest, output: str | Path = 'docs', *, base: str | None = None, charts: bool = True, clean: bool = True) -> SiteResultWrite the catalogue’s pages and chart data into the Astro project output.
Pages go to src/content/docs/catalogue (an MDX file and a JSON data file
per page) and chart data to public/catalogue; both are replaced on every
run, but only when a previous run wrote them (clean=False writes into
them as they are).
base is the site’s base path (/repo on GitHub Pages), which the
links between pages need; it defaults to the manifest’s base. Raises
:class:SiteError without one, for runs that cannot be read, and for
charts=True without scope-profiler[pproc].
load_manifestfunction#
def load_manifest(path: str | Path) -> ManifestRead and validate a catalogue manifest.
Run paths are resolved against the manifest’s directory and globs are
expanded (in natural order, so np2 precedes np10). Every error names
the case and field it comes from.
slugifyfunction#
def slugify(text: str) -> strLower-case text into a URL- and file-name-safe slug.