idmtools_platform_slurm.platform_operations.json_metadata_operations module¶
Here we implement the JSON Metadata operations.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools_platform_slurm.platform_operations.json_metadata_operations.JSONMetadataOperations(platform: 'SlurmPlatform', platform_type: Type = None, metadata_filename: str = 'metadata.json')¶
Bases:
IMetadataOperations
- platform: SlurmPlatform¶
- get_metadata_filepath(item: Union[Suite, Experiment, Simulation]) Path ¶
Retrieve item’s metadata file path. :param item: idmtools entity (Suite, Experiment and Simulation)
- Returns:
item’s metadata file path
- get(item: Union[Suite, Experiment, Simulation]) Dict ¶
Obtain item’s metadata. :param item: idmtools entity (Suite, Experiment and Simulation)
- Returns:
key/value dict of metadata from the given item
- dump(item: Union[Suite, Experiment, Simulation]) None ¶
Save item’s metadata to a file. :param item: idmtools entity (Suite, Experiment and Simulation)
- Returns:
None
- load(item: Union[Suite, Experiment, Simulation]) Dict ¶
Obtain item’s metadata file. :param item: idmtools entity (Suite, Experiment and Simulation)
- Returns:
key/value dict of metadata from the given item
- load_from_file(metadata_filepath: Union[Path, str]) Dict ¶
Obtain the metadata for the given filepath. :param metadata_filepath: str
- Returns:
key/value dict of metadata from the given filepath
- update(item: Union[Suite, Experiment, Simulation], metadata: Dict = {}, replace=True) None ¶
Update or replace item’s metadata file. :param item: idmtools entity (Suite, Experiment and Simulation.) :param metadata: dict to be updated or replaced :param replace: True/False
- Returns:
None
- clear(item: Union[Suite, Experiment, Simulation]) None ¶
Clear the item’s metadata file. :param item: clear the item’s metadata file
- Returns:
None
- get_children(item: Union[Suite, Experiment]) List[Dict] ¶
Fetch item’s children. :param item: idmtools entity (Suite, SlurmSuite, Experiment, SlurmExperiment)
- Returns:
Lis of metadata
- get_all(item_type: ItemType) List[Dict] ¶
Obtain all the metadata for a given item type. :param item_type: the type of metadata to search for matches (simulation, experiment, suite, etc)
- Returns:
list of metadata with given item type
- filter(item_type: ItemType, property_filter: Optional[Dict] = None, tag_filter: Optional[Dict] = None, meta_items: Optional[List[Dict]] = None, ignore_none=True) List[Dict] ¶
Obtain all items that match the given properties key/value pairs passed. The two filters are applied on item with ‘AND’ logical checking. :param item_type: the type of items to search for matches (simulation, experiment, suite, etc) :param property_filter: a dict of metadata key/value pairs for exact match searching :param tag_filter: a dict of metadata key/value pairs for exact match searching :param meta_items: list of metadata :param ignore_none: True/False (ignore None value or not)
- Returns:
a list of metadata matching the properties key/value with given item type
- __init__(platform: SlurmPlatform, platform_type: Type = None, metadata_filename: str = 'metadata.json') None ¶