idmtools_models.python.python_task module

idmtools python task.

Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.

class idmtools_models.python.python_task.PythonTask(command: ~typing.Union[str, ~idmtools.entities.command_line.CommandLine] = <property object>, platform_requirements: ~typing.Set[~idmtools.entities.platform_requirements.PlatformRequirements] = <factory>, _ITask__pre_creation_hooks: ~typing.List[~typing.Callable[[~typing.Union[Simulation, IWorkflowItem], IPlatform], ~typing.NoReturn]] = <factory>, _ITask__post_creation_hooks: ~typing.List[~typing.Callable[[~typing.Union[Simulation, IWorkflowItem], IPlatform], ~typing.NoReturn]] = <factory>, common_assets: ~idmtools.assets.asset_collection.AssetCollection = <factory>, transient_assets: ~idmtools.assets.asset_collection.AssetCollection = <factory>, script_path: str = None, python_path: str = 'python')

Bases: ITask

PythonTask makes running python scripts a bit easier through idmtools.

Notes

TODO - Link examples here

script_path: str = None
python_path: str = 'python'
platform_requirements: Set[PlatformRequirements]
gather_common_assets() 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() AssetCollection

Gather transient assets. Generally this is the simulation level assets.

Returns:

Transient assets. Also known as simulation level assets.

reload_from_simulation(simulation: Simulation, **kwargs)

Reloads a python task from a simulation.

Parameters:

simulation – Simulation to reload

Returns:

None

pre_creation(parent: Union[Simulation, IWorkflowItem], platform: IPlatform)

Called before creation of parent.

Parameters:
  • parent – Parent

  • platform – Platform Python Task is being executed on

Returns:

None

Raises:

ValueError if script name is not provided

__init__(command: ~typing.Union[str, ~idmtools.entities.command_line.CommandLine] = <property object>, platform_requirements: ~typing.Set[~idmtools.entities.platform_requirements.PlatformRequirements] = <factory>, _ITask__pre_creation_hooks: ~typing.List[~typing.Callable[[~typing.Union[Simulation, IWorkflowItem], IPlatform], ~typing.NoReturn]] = <factory>, _ITask__post_creation_hooks: ~typing.List[~typing.Callable[[~typing.Union[Simulation, IWorkflowItem], IPlatform], ~typing.NoReturn]] = <factory>, common_assets: ~idmtools.assets.asset_collection.AssetCollection = <factory>, transient_assets: ~idmtools.assets.asset_collection.AssetCollection = <factory>, script_path: str = None, python_path: str = 'python') None
class idmtools_models.python.python_task.PythonTaskSpecification

Bases: TaskSpecification

PythonTaskSpecification provides the plugin info for PythonTask.

get(configuration: dict) 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[PythonTask]

Get Type for Plugin.

Returns:

PythonTask

get_version() str

Returns the version of the plugin.

Returns:

Plugin Version