idmtools.core.interfaces.iitem module#
IItem is the base of all items that have ids such as AssetCollections, Experiments, etc.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- idmtools.core.interfaces.iitem.get_id_generator()[source]#
Retrieves the type of id generator specified in .ini config as well as corresponding plugin.
- Returns:
specified id generation plugin in .ini config (uuid, item_sequence, etc) plugin: id generation plugin that is used to determine ids for items. See setup.py > entry_points > idmtools_hooks for full names of plugin options
- Return type:
id_gen
- class idmtools.core.interfaces.iitem.IItem(_uid: str = None, _IItem__pre_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _IItem__post_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>)[source]#
Bases:
object
IItem represents items that have identifiable ids.
In addition, IItem facilities pre and post creation hooks through the __pre_creation_hooks, __post_creation_hooks, add_pre_creation_hook, add_post_creation_hook
- property uid#
UID Of the object.
If not id is set, uses the hash of the object.
- Returns:
ID
- property id#
Alias for uid.
- Returns:
UID of object
Notes
What is relation to uid?
- property pickle_ignore_fields#
Get list of fields that will be ignored when pickling.
- Returns:
Set of fields that are ignored when pickling the item
- property metadata_fields#
Get list of fields that have metadata.
- Returns:
Set of fields that have metadata
- pre_creation(platform: IPlatform) None [source]#
Called before the actual creation of the entity.
- Parameters:
platform – Platform item is being created on
- Returns:
None
- post_creation(platform: IPlatform) None [source]#
Called after the actual creation of the entity.
- Parameters:
platform – Platform item was created on
- Returns:
None
- add_pre_creation_hook(hook: Callable[[IItem, IPlatform], None])[source]#
Adds a hook function to be called before an item is created.
- Parameters:
hook – Hook function. This should have two arguments, the item and the platform
- Returns:
None
- add_post_creation_hook(hook: Callable[[IItem, IPlatform], None])[source]#
Adds a hook function to be called after an item is created.
- Parameters:
hook – Hook function. This should have two arguments, the item and the platform
- Returns:
None
- post_setstate()[source]#
Function called after restoring the state if additional initialization is required.