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')[source]#

Bases: IMetadataOperations

platform: SlurmPlatform#
platform_type: Type = None#
metadata_filename: str = 'metadata.json'#
get_metadata_filepath(item: Suite | Experiment | Simulation) Path[source]#

Retrieve item’s metadata file path. :param item: idmtools entity (Suite, Experiment and Simulation)

Returns:

item’s metadata file path

get(item: Suite | Experiment | Simulation) Dict[source]#

Obtain item’s metadata. :param item: idmtools entity (Suite, Experiment and Simulation)

Returns:

key/value dict of metadata from the given item

dump(item: Suite | Experiment | Simulation) None[source]#

Save item’s metadata to a file. :param item: idmtools entity (Suite, Experiment and Simulation)

Returns:

None

load(item: Suite | Experiment | Simulation) Dict[source]#

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: Path | str) Dict[source]#

Obtain the metadata for the given filepath. :param metadata_filepath: str

Returns:

key/value dict of metadata from the given filepath

update(item: Suite | Experiment | Simulation, metadata: Dict = {}, replace=True) None[source]#

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: Suite | Experiment | Simulation) None[source]#

Clear the item’s metadata file. :param item: clear the item’s metadata file

Returns:

None

get_children(item: Suite | Experiment | SlurmSuite | SlurmExperiment) List[Dict][source]#

Fetch item’s children. :param item: idmtools entity (Suite, SlurmSuite, Experiment, SlurmExperiment)

Returns:

Lis of metadata

get_all(item_type: ItemType, item_id: str = '') List[Dict][source]#

Obtain all the metadata for a given item type. :param item_type: the type of metadata to search for matches (simulation, experiment, suite, etc.) :param item_id: item id

Returns:

list of metadata with given item type

filter(item_type: ItemType, property_filter: Dict | None = None, tag_filter: Dict | None = None, meta_items: List[Dict] | None = None, ignore_none=True) List[Dict][source]#

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#