idmtools.analysis.download_analyzer module¶
-
class
idmtools.analysis.download_analyzer.
DownloadAnalyzer
(filenames=None, output_path='output', **kwargs)¶ Bases:
idmtools.entities.ianalyzer.IAnalyzer
A simple base class that will download the files specified in filenames without further treatment.
Can be used by creating a child class:
class InsetDownloader(DownloadAnalyzer): filenames = ['output/InsetChart.json']
Or by directly calling it:
analyzer = DownloadAnalyzer(filenames=['output/InsetChart.json'])
Examples
# Example DownloadAnalyzer for EMOD Experiment # In this example, we will demonstrate how to create an DownloadAnalyzer to download simulation output files locally # First, import some necessary system and idmtools packages. from idmtools.analysis.analyze_manager import AnalyzeManager from idmtools.analysis.download_analyzer import DownloadAnalyzer from idmtools.core import ItemType from idmtools.core.platform_factory import Platform if __name__ == '__main__': # Set the platform where you want to run your analysis # In this case we are running in BELEGOST, but this can be changed to run 'Local' with Platform('BELEGOST') as platform: # Arg option for analyzer init are uid, working_dir, data in the method map (aka select_simulation_data), # and filenames # In this case, we want to provide a filename to analyze filenames = ['StdOut.txt'] # Initialize the analyser class with the path of the output files to download analyzers = [DownloadAnalyzer(filenames=filenames, output_path='download')] # Set the experiment you want to analyze experiment_id = '40c1b14d-0a04-eb11-a2c7-c4346bcb1553' # comps exp id # Specify the id Type, in this case an Experiment manager = AnalyzeManager(ids=[(experiment_id, ItemType.EXPERIMENT)], analyzers=analyzers) manager.analyze()
-
reduce
(all_data: dict)¶ 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.
-
initialize
()¶ 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__.
-
get_sim_folder
(item)¶ Concatenate the specified top-level output folder with the simulation ID.
- Parameters
item – A simulation output parsing thread.
- Returns
The name of the folder to download this simulation’s output to.
-
map
(data: Dict[str, Any], item: Union[idmtools.entities.iworkflow_item.IWorkflowItem, idmtools.entities.simulation.Simulation])¶ Write the downloaded data to the path
- Parameters
data –
item –
Returns:
-