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: idmtools.entities.itask.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[idmtools.entities.platform_requirements.PlatformRequirements]
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:

Transient assets. Also known as simulation level assets.

reload_from_simulation(simulation: idmtools.entities.simulation.Simulation, **kwargs)

Reloads a python task from a simulation.

Parameters:

simulation – Simulation to reload

Returns:

None

pre_creation(parent: Union[idmtools.entities.simulation.Simulation, idmtools.entities.iworkflow_item.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: idmtools.registry.task_specification.TaskSpecification

PythonTaskSpecification provides the plugin info for PythonTask.

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