idmtools.entities.ianalyzer module¶
Defines our IAnalyzer interface used as base of all other analyzers.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.entities.ianalyzer.IAnalyzer(uid=None, working_dir: Optional[str] = None, parse: bool = True, filenames: Optional[List[str]] = None)¶
Bases:
object
An abstract base class carrying the lowest level analyzer interfaces called by
ExperimentManager
.- abstract __init__(uid=None, working_dir: Optional[str] = None, parse: bool = True, filenames: Optional[List[str]] = None)¶
A constructor.
- Parameters:
uid – The unique id identifying this analyzer.
working_dir – A working directory to place files.
parse – True to leverage the
OutputParser
; False to get the raw data in theselect_simulation_data()
.filenames – The files for the analyzer to download.
- property filenames¶
Returns user filenames.
- Returns:
filenames
- initialize() NoReturn ¶
Call once after the analyzer has been added to the
AnalyzeManager
.Add everything depending on the working directory or unique ID here instead of in __init__.
- per_group(items: IItemList) NoReturn ¶
Call once before running the apply on the items.
- Parameters:
items – Objects with attributes of type
ItemId
. IDs of one or more higher-level hierarchical objects can be obtained from these IDs in order to perform tasks with them.- Returns:
None
- filter(item: Union[IWorkflowItem, Simulation]) bool ¶
Decide whether the analyzer should process a simulation/work item.
- Parameters:
item – An
IItem
to be considered for processing with this analyzer.- Returns:
A Boolean indicating whether simulation/work item should be analyzed by this analyzer.
- abstract map(data: Dict[str, Any], item: Union[IWorkflowItem, Simulation]) Any ¶
In parallel for each simulation/work item, consume raw data from filenames and emit selected data.
- Parameters:
data – A dictionary associating filename with content for simulation data.
item –
IItem
object that the passed data is associated with.
- Returns:
Selected data for the given simulation/work item.
- abstract reduce(all_data: Dict[Union[IWorkflowItem, Simulation], Any]) Any ¶
Combine the
map()
data for a set of items into an aggregate result.- Parameters:
all_data – A dictionary with entries for the item ID and selected data.
- class idmtools.entities.ianalyzer.BaseAnalyzer(uid=None, working_dir: Optional[str] = None, parse: bool = True, filenames: Optional[List[str]] = None)¶
Bases:
idmtools.entities.ianalyzer.IAnalyzer
BaseAnalyzer to allow using previously used dtk-tools analyzers within idmtools.
- __init__(uid=None, working_dir: Optional[str] = None, parse: bool = True, filenames: Optional[List[str]] = None)¶
Constructor for Base Analyzer.
- Parameters:
uid – The unique id identifying this analyzer.
working_dir – A working directory to place files.
parse – True to leverage the
OutputParser
; False to get the raw data in theselect_simulation_data()
.filenames – The files for the analyzer to download.