idmtools_models.json_configured_task module

class idmtools_models.json_configured_task.JSONConfiguredTask(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[Simulation, IWorkflowItem]], NoReturn]] = <factory>, _ITask__post_creation_hooks: List[Callable[[Union[Simulation, IWorkflowItem]], NoReturn]] = <factory>, common_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, transient_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, _task_log: logging.Logger = <factory>, parameters: dict = <factory>, envelope: str = None, config_file_name: str = 'config.json', is_config_common: bool = False, command_line_argument: str = None, command_line_argument_no_filename: bool = True)

Bases: idmtools.entities.itask.ITask

Defines an extensible simple task that implements functionality through optional supplied use hooks

parameters: dict
envelope: str = None
config_file_name: str = 'config.json'
is_config_common: bool = False
command_line_argument: str = None
command_line_argument_no_filename: bool = True
gather_common_assets()idmtools.assets.asset_collection.AssetCollection

Gather assets common across an Experiment(Set of Simulations)

Returns

Common AssetCollection

gather_transient_assets()idmtools.assets.asset_collection.AssetCollection

Gather assets that are unique to this simulation/worktiem

Returns

Simulation/workitem level AssetCollection

set_parameter(key: Union[str, int, float], value: Union[str, int, float, Dict[Union[str, int, float], Any]])

Update a parameter. The type hinting encourages JSON supported types

Parameters
  • key – Config

  • value

Returns:

get_parameter(key: Union[str, int, float]) → Union[str, int, float, Dict[Union[str, int, float], Any]]

Returns a parameter value

Parameters

key – Key of parameter

Returns

Value of parameter

Raises

KeyError

update_parameters(values: Dict[Union[str, int, float], Union[str, int, float, Dict[Union[str, int, float], Any]]])

Perform bulk update from another dictionary

Parameters

values

Returns:

reload_from_simulation(simulation: idmtools.entities.simulation.Simulation, config_file_name: Optional[str] = None, envelope: Optional[str] = None, **kwargs)

Reload from Simulation. To do this, the process is

  1. First check for a configfile name from arguments, then tags, or the default name

  2. Load the json config file

  3. Check if we got an envelope argument from parameters or the simulation tags, or on the task object

Parameters
  • simulation – Simulation object with metadata to load info from

  • config_file_name – Optional name of config file

  • envelope – Optional name of envelope

Returns

Populates the config with config from object

pre_creation(parent: Union[Simulation, WorkflowItem])

Optional Hook called at the time of creation of task. Can be used to setup simulation and experiment level hooks :param parent:

Returns:

static set_parameter_sweep_callback(simulation: idmtools.entities.simulation.Simulation, param: str, value: Any) → Dict[str, Any]
classmethod set_parameter_partial(parameter: str)
class idmtools_models.json_configured_task.JSONConfiguredTaskSpecification

Bases: idmtools.registry.task_specification.TaskSpecification

get(configuration: dict)idmtools_models.json_configured_task.JSONConfiguredTask

Get instance of JSONConfiguredTask with configuration specified

Parameters

configuration – Configuration for configuration

Returns

JSONConfiguredTask with configuration

get_description() → str

Get description for plugin

Returns

Description of plugin

get_example_urls() → List[str]

Get list of urls with examples for JSONConfiguredTask

Returns

List of urls that point to examples relating to JSONConfiguredTask

get_type() → Type[idmtools_models.json_configured_task.JSONConfiguredTask]

Get task type provided by plugin

Returns

JSONConfiguredTask