idmtools_models.python.python_task module¶
-
class
idmtools_models.python.python_task.PythonTask(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>, script_path: str = None, python_path: str = 'python')¶ Bases:
idmtools.entities.itask.ITask-
script_path: str = None¶
-
python_path: str = 'python'¶
-
platform_requirements: Set[idmtools.entities.platform_requirements.PlatformRequirements]¶
-
property
command¶ Update executable with new python_path Returns: re-build command
-
retrieve_python_dependencies()¶ Retrieve the Pypi libraries associated with the given model script. .. rubric:: Notes
This function scan recursively through the whole directory where the model file is contained. This function relies on pipreqs being installed on the system to provide dependencies list.
- Returns
List of libraries required by the script
-
gather_common_assets() → idmtools.assets.asset_collection.AssetCollection¶ Get the common assets. This should be a set of assets that are common to all tasks in an experiment
- Returns
AssetCollection
-
gather_transient_assets() → idmtools.assets.asset_collection.AssetCollection¶ Gather transient assets. Generally this is the simulation level assets
Returns:
-
reload_from_simulation(simulation: idmtools.entities.simulation.Simulation, **kwargs)¶ Reloads a python task from a simulation
- Parameters
simulation – Simulation to reload
Returns:
-
pre_creation(parent: Union[idmtools.entities.simulation.Simulation, idmtools.entities.iworkflow_item.IWorkflowItem])¶ Called before creation of parent
- Parameters
parent – Parent
- Returns
None
- Raise:
ValueError if script name is not provided
-
-
class
idmtools_models.python.python_task.PythonTaskSpecification¶ Bases:
idmtools.registry.task_specification.TaskSpecification-
get(configuration: dict) → idmtools_models.python.python_task.PythonTask¶ Get instance of Python Task with specified configuration
- Parameters
configuration – Configuration for task
- Returns
Python task
-
get_description() → str¶ Description of the plugin
- Returns
Description string
-
get_example_urls() → List[str]¶ Return List of urls that have examples using PythonTask
- Returns
List of urls(str) that point to examples
-
get_type() → Type[idmtools_models.python.python_task.PythonTask]¶ Get Type for Plugin
- Returns
PythonTask
-
get_version() → str¶ Returns the version of the plugin
- Returns
Plugin Version
-