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: 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[[Simulation | IWorkflowItem, IPlatform], ~typing.NoReturn]] = <factory>, _ITask__post_creation_hooks: ~typing.List[~typing.Callable[[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')[source]#

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[source]#

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[source]#

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)[source]#

Reloads a python task from a simulation.

Parameters:

simulation – Simulation to reload

Returns:

None

pre_creation(parent: Simulation | IWorkflowItem, platform: IPlatform)[source]#

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: 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[[Simulation | IWorkflowItem, IPlatform], ~typing.NoReturn]] = <factory>, _ITask__post_creation_hooks: ~typing.List[~typing.Callable[[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[source]#

Bases: TaskSpecification

PythonTaskSpecification provides the plugin info for PythonTask.

get(configuration: dict) PythonTask[source]#

Get instance of Python Task with specified configuration.

Parameters:

configuration – Configuration for task

Returns:

Python task

get_description() str[source]#

Description of the plugin.

Returns:

Description string

get_example_urls() List[str][source]#

Return List of urls that have examples using PythonTask.

Returns:

List of urls(str) that point to examples

get_type() Type[PythonTask][source]#

Get Type for Plugin.

Returns:

PythonTask

get_version() str[source]#

Returns the version of the plugin.

Returns:

Plugin Version