idmtools.entities.itask module¶
-
class
idmtools.entities.itask.
ITask
(command: Union[str, idmtools.entities.command_line.CommandLine] = None, platform_requirements: Set[idmtools.entities.platform_requirements.PlatformRequirements] = <factory>, _ITask__pre_creation_hooks: List[Callable[[Union[ForwardRef('Simulation'), ForwardRef('IWorkflowItem')]], NoReturn]] = <factory>, _ITask__post_creation_hooks: List[Callable[[Union[ForwardRef('Simulation'), ForwardRef('IWorkflowItem')]], NoReturn]] = <factory>, common_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, transient_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, _task_log: logging.Logger = <factory>)¶ Bases:
object
-
command
: Union[str, idmtools.entities.command_line.CommandLine] = None¶ The Command to run
-
platform_requirements
: Set[PlatformRequirements]¶
-
common_assets
: AssetCollection¶ Common(Experiment-level) assets
-
transient_assets
: AssetCollection¶ Transient(Simulation-level) assets
-
property
metadata_fields
¶ Collect all metadata fields
Returns: set of metadata filed names
-
add_pre_creation_hook
(hook: Callable[[Union[Simulation, IWorkflowItem]], NoReturn])¶ Called before a simulation is created on a platform. Each hook receives either a Simulation or WorkflowTask
- Parameters
hook – Function to call on event
- Returns
None
-
add_post_creation_hook
(hook: Callable[[Union[Simulation, IWorkflowItem]], NoReturn])¶ Called after a simulation has been created on a platform. Each hook receives either a Simulation or WorkflowTask
- Parameters
hook – Function to call on event
Returns:
-
add_platform_requirement
(requirement: Union[idmtools.entities.platform_requirements.PlatformRequirements, str]) → NoReturn¶ Adds a platform requirements to a task :param requirement: Requirement to add task
- Returns
None
-
pre_creation
(parent: Union[Simulation, IWorkflowItem])¶ Optional Hook called at the time of creation of task. Can be used to setup simulation and experiment level hooks :param parent:
Returns:
-
post_creation
(parent: Union[Simulation, IWorkflowItem])¶ Optional Hook called at the after creation task. Can be used to setup simulation and experiment level hooks :param parent:
Returns:
-
abstract
gather_common_assets
() → idmtools.assets.asset_collection.AssetCollection¶ Function called at runtime to gather all assets in the collection.
-
abstract
gather_transient_assets
() → idmtools.assets.asset_collection.AssetCollection¶ Function called at runtime to gather all assets in the collection
-
gather_all_assets
() → idmtools.assets.asset_collection.AssetCollection¶ Collect all common and transient assets
Returns: new AssetCollection
-
copy_simulation
(base_simulation: Simulation) → Simulation¶ - Called when copying a simulation for batching. Override you your task has specific concerns when copying
simulations.
-
reload_from_simulation
(simulation: Simulation)¶ Optional hook that is called when loading simulations from a platform
-
to_simulation
()¶ Convert task to simulation
Returns: new simulation
-
pre_getstate
()¶ Return default values for
pickle_ignore_fields()
. Call before pickling.Returns: dict
-
post_setstate
()¶
-
property
pickle_ignore_fields
¶
-
to_dict
() → Dict¶ Select metadata fields and make a new dict
Returns: dict
-