idmtools.entities.iplatform module¶
- 
class 
idmtools.entities.iplatform.IPlatform(*args, **kwargs)¶ Bases:
idmtools.core.interfaces.iitem.IItem,idmtools.core.cache_enabled.CacheEnabledInterface defining a platform. A platform needs to implement basic operation such as:
Creating experiment
Creating simulation
Commissioning
File handling
- 
platform_type_map: Dict[Type, idmtools.core.enums.ItemType] = None¶ 
- 
supported_types: Set[idmtools.core.enums.ItemType]¶ 
- 
static 
get_caller()¶ Trace the stack and find the caller.
- Returns
 The direct caller.
- 
validate_inputs_types() → NoReturn¶ Validate user inputs and case attributes with the correct data types.
- Returns
 None
- 
get_item(item_id: Union[str, uuid.UUID], item_type: idmtools.core.enums.ItemType = None, force: bool = False, raw: bool = False, **kwargs) → Any¶ Retrieve an object from the platform. This function is cached; force allows you to force the refresh of the cache. If no object_type is passed, the function will try all the types (experiment, suite, simulation).
- Parameters
 item_id – The ID of the object to retrieve.
item_type – The type of the object to be retrieved.
force – If True, force the object fetching from the platform.
raw – Return either an idmtools object or a platform object.
- Returns
 The object found on the platform or None.
- Raises
 ValueError – If the item type is not supported
- 
get_children(item_id: uuid.UUID, item_type: idmtools.core.enums.ItemType, force: bool = False, raw: bool = False, item: Any = None, **kwargs) → Any¶ Retrieve the children of a given object.
- Parameters
 item_id – The ID of the object for which we want the children.
force – If True, force the object fetching from the platform.
raw – Return either an idmtools object or a platform object.
item_type – Pass the type of the object for quicker retrieval.
item – optional platform or idm item to use instead of loading
- Returns
 The children of the object or None.
- 
get_children_by_object(parent: idmtools.core.interfaces.ientity.IEntity) → List[idmtools.core.interfaces.ientity.IEntity]¶ Returns a list of children for an entity
- Parameters
 parent – Parent object
- Returns
 List of children
- 
get_parent_by_object(child: idmtools.core.interfaces.ientity.IEntity) → idmtools.core.interfaces.ientity.IEntity¶ Parent of object
- Parameters
 child – Child object to find parent for
- Returns
 Returns parent object
- 
get_parent(item_id: uuid.UUID, item_type: idmtools.core.enums.ItemType = None, force: bool = False, raw: bool = False, **kwargs)¶ Retrieve the parent of a given object.
- Parameters
 item_id – The ID of the object for which we want the parent.
force – If True, force the object fetching from the platform.
raw – Return either an idmtools object or a platform object.
item_type – Pass the type of the object for quicker retrieval.
- Returns
 The parent of the object or None.
- 
get_cache_key(force, item_id, item_type, kwargs, raw, prefix='p')¶ 
- 
create_items(items: Union[List[idmtools.core.interfaces.ientity.IEntity], idmtools.core.interfaces.ientity.IEntity]) → List[idmtools.core.interfaces.ientity.IEntity]¶ Create items (simulations, experiments, or suites) on the platform. The function will batch the items based on type and call the self._create_batch for creation :param items: The list of items to create.
- Returns
 List of item IDs created.
- 
run_items(items: Union[idmtools.core.interfaces.ientity.IEntity, List[idmtools.core.interfaces.ientity.IEntity]], **kwargs)¶ Run items on the platform. :param items:
Returns:
- 
flatten_item(item: idmtools.core.interfaces.ientity.IEntity) → List[idmtools.core.interfaces.ientity.IEntity]¶ Flatten an item: resolve the children until getting to the leaves. For example, for an experiment, will return all the simulations. For a suite, will return all the simulations contained in the suites experiments.
- Parameters
 item – Which item to flatten
- Returns
 List of leaves
- 
refresh_status(item: idmtools.core.interfaces.ientity.IEntity) → NoReturn¶ Populate the platform item and specified item with its status.
- Parameters
 item – The item to check status for.
- 
get_files(item: idmtools.core.interfaces.ientity.IEntity, files: Union[Set[str], List[str]], output: str = None, **kwargs) → Union[Dict[str, Dict[str, bytearray]], Dict[str, bytearray]]¶ Get files for a platform entity
- Parameters
 item – Item to fetch files for
files – List of file names to get
output – save files to
**kwargs – Platform arguments
- Returns
 For simulations, this returns a dictionary with filename as key and values being binary data from file or a dict.
For experiments, this returns a dictionary with key as sim id and then the values as a dict of the simulations described above
- 
get_files_by_id(item_id: uuid.UUID, item_type: idmtools.core.enums.ItemType, files: Union[Set[str], List[str]], output: str = None) → Union[Dict[str, Dict[str, bytearray]], Dict[str, bytearray]]¶ Get files by item id (UUID) :param item_id: COMPS Item, say, Simulation Id or WorkItem Id :param item_type: Item Type :param files: List of files to retrieve :param output: save files to
Returns: dict with key/value: file_name/file_content
- 
are_requirements_met(requirements: Set[idmtools.entities.platform_requirements.PlatformRequirements]) → bool¶ Does the platform support the list of requirements
- Parameters
 requirements – Requirements
- Returns
 True if all the requirements are supported
- 
is_task_supported(task: idmtools.entities.itask.ITask) → bool¶ Is a task supported on this platform. This depends on the task properly setting its requirements. See
idmtools.entities.itask.ITask.platform_requirementsandidmtools.entities.platform_requirements.PlatformRequirements- Parameters
 task – Task to check support of
- Returns
 True if the task is supported, False otherwise.
- 
wait_till_done(item: Union[idmtools.entities.experiment.Experiment, idmtools.entities.iworkflow_item.IWorkflowItem, idmtools.entities.suite.Suite], timeout: int = 86400, refresh_interval: int = 5, progress: bool = True)¶ Wait for the experiment to be done.
- Parameters
 item – Experiment/Workitem to wait on
refresh_interval – How long to wait between polling.
timeout – How long to wait before failing.
progress – Should we display progress
See also
idmtools.entities.iplatform.IPlatform.wait_till_done_progress()idmtools.entities.iplatform.IPlatform.__wait_until_done_progress_callback()idmtools.entities.iplatform.IPlatform.__wait_till_callback()
- 
wait_till_done_progress(item: Union[idmtools.entities.experiment.Experiment, idmtools.entities.iworkflow_item.IWorkflowItem, idmtools.entities.suite.Suite], timeout: int = 86400, refresh_interval: int = 5)¶ Wait on an item to complete with progress bar
- Parameters
 item – Item to monitor
timeout – Timeout on waiting
refresh_interval – How often to refresh
- Returns
 None
See also
idmtools.entities.iplatform.IPlatform.__wait_until_done_progress_callback()idmtools.entities.iplatform.IPlatform.wait_till_done()idmtools.entities.iplatform.IPlatform.__wait_till_callback()
Retrieve all related objects :param item: SSMTWorkItem :param relation_type: Depends or Create
Returns: dict with key the object type
- 
is_regather_assets_on_modify() → bool¶ Return default behaviour for platform when rerunning experiment and gathering assets
- Returns
 True or false