k4bench.analysis.dataflow¶
k4bench.analysis.dataflow ¶
What each algorithm of a k4run job read and wrote: {label}_dataflow.json.
The k4run benchmark builds the file after each job (:func:build_dataflow)
from what the job recorded, and :func:load_dataflow reads it back as a
:class:DataFlow, whose :meth:DataFlow.graph joins the algorithms by the
collections one writes and a later one reads.
Where each algorithm's collections come from
- A Gaudi algorithm, k4FWCore's included: the keys of the data handles it
declared, which the k4BenchAuditor records (
inputsandoutputsin_components.json). These are exact. The k4FWCore Reader declares one output per collection of its input file. - A Marlin processor run by a
MarlinProcessorWrapper: its LCIO collection parameters. Marlin marks a parameter registered as an input or output collection with its LCIO type, andMarlin -xlists those for every processor type; the collection names are the parameter's value in the job options, or its default where the job leaves it unset. The wrapper's EDM4hep-to-LCIO and LCIO-to-EDM4hep converters come from the job options. - The k4FWCore Writer, which reads whatever its keep/drop rules
(
IOSvc.outputCommands) select from the event store.
Limitations
- A Marlin processor that takes a collection name as a plain string parameter, rather than registering it as a collection, declares nothing: what it reads and writes is missing, and a collection only it writes has no producer.
- A declared collection need not be one the algorithm uses: a Marlin input whose default the job never set is listed all the same.
- The converters are modelled, not observed: one converting everything
(
convertAll) is taken to convert every collection the other store holds at that point, under itscollNameMappingname, unless the target store already holds one of that name. - Gaudi handles carry a key, not a type; only LCIO collections have a type.
- Algorithms are in the order the auditor first saw them, which is the order they were initialized and, in a sequential job, the order they run.
- A run whose auditor predates recording data handles has none: its Gaudi
algorithms' reads and writes are unknown (
None).
Collection
dataclass
¶
Collection(name: str, store: str, type: str | None = None, parameter: str | None = None, explicit: bool | None = None)
One collection an algorithm reads or writes.
Converter
dataclass
¶
A k4MarlinWrapper converter run before (EDM4hep to LCIO) or after (LCIO to EDM4hep) its processor.
Algorithm
dataclass
¶
Algorithm(name: str, type: str, impl: str, framework: str, inputs: tuple[Collection, ...] | None, outputs: tuple[Collection, ...] | None, converters: tuple[Converter, ...] = (), output_commands: tuple[str, ...] | None = None)
One algorithm, with what it read and wrote; None where unknown.
Link
dataclass
¶
One collection passed from a producer to a consumer.
Graph
dataclass
¶
Graph(edges: Mapping[tuple[str, str], tuple[Link, ...]], unresolved: tuple[tuple[str, Collection], ...])
Algorithms joined by the collections one writes and another reads.
DataFlow
dataclass
¶
DataFlow(algorithms: tuple[Algorithm, ...], handles_recorded: bool, marlin_recorded: bool)
One label's _dataflow.json.
graph ¶
graph() -> Graph
Replay the job in order: each read is linked to the latest earlier write of that collection in that store, a converter carrying collections from one store to the other, and the Writer reading what its rules keep. A read with no earlier write falls back to any algorithm that writes that collection directly.
Source code in k4bench/analysis/dataflow.py
parse_joboptions ¶
{owner: {property: value}} of a JobOptionsSvc dump. Values that are
Python literals are parsed; others, such as tool references, kept as text.
Source code in k4bench/analysis/dataflow.py
marlin_collection_parameters ¶
{processor type: {parameter: {direction, type, default}}} for the
LCIO collection parameters Marlin -x lists in xml.
Source code in k4bench/analysis/dataflow.py
build_dataflow ¶
build_dataflow(components: Mapping, joboptions: str, marlin_xml: str | None, *, reader_collections: Iterable[str] | None = None) -> dict
The _dataflow.json document of one job.
components is the job's parsed _components.json, joboptions its
resolved job options and marlin_xml Marlin -x of its stack (None
when the job ran no Marlin processor, and an unreadable one counts as
none). reader_collections stands in for
the Reader's outputs where the auditor recorded no data handles.
Source code in k4bench/analysis/dataflow.py
load_dataflow ¶
load_dataflow(run_dir: str | Path) -> dict[str, DataFlow]
Every label's data flow in run_dir; empty when it has none.
Source code in k4bench/analysis/dataflow.py
read_marlin_processors ¶
The run's Marlin -x dump, or None when it has none.