emodpy.emod_task module¶
-
emodpy.emod_task.
logger
= <Logger emodpy.emod_task (DEBUG)>¶ Note that these 3 functions could be member functions of EMODTask but Python modules are already pretty good at being ‘static classes’.
-
emodpy.emod_task.
add_ep4_from_path
(task, ep4_path)¶
-
emodpy.emod_task.
default_ep4_fn
(task)¶
-
class
emodpy.emod_task.
EMODTask
(command: Union[str, idmtools.entities.command_line.CommandLine] = <property object>, platform_requirements: Set[idmtools.entities.platform_requirements.PlatformRequirements] = <factory>, _ITask__pre_creation_hooks: List[Callable[[Union[Simulation, IWorkflowItem], IPlatform], NoReturn]] = <factory>, _ITask__post_creation_hooks: List[Callable[[Union[Simulation, IWorkflowItem], IPlatform], NoReturn]] = <factory>, common_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, transient_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, eradication_path: str = None, demographics: emodpy.emod_file.DemographicsFiles = <factory>, migrations: emodpy.emod_file.MigrationFiles = <factory>, reporters: emodpy.reporters.base.Reporters = <factory>, climate: emodpy.emod_file.ClimateFiles = <factory>, config: dict = <factory>, config_file_name: str = 'config.json', campaign: emodpy.emod_campaign.EMODCampaign = <factory>, simulation_demographics: emodpy.emod_file.DemographicsFiles = <factory>, simulation_migrations: emodpy.emod_file.MigrationFiles = <factory>, use_embedded_python: bool = True, is_linux: bool = False, implicit_configs: list = <factory>, use_singularity: bool = False, sif_filename: str = None)¶ Bases:
idmtools.entities.itask.ITask
EMODTask allows easy running and configuration of EMOD Experiments and Simulations
-
demographics
: emodpy.emod_file.DemographicsFiles¶ Common Demographics
-
migrations
: emodpy.emod_file.MigrationFiles¶ Common Migrations
-
reporters
: emodpy.reporters.base.Reporters¶ Common Reports
-
climate
: emodpy.emod_file.ClimateFiles¶ Common Climate
-
campaign
: emodpy.emod_campaign.EMODCampaign¶ Campaign configuration
-
simulation_demographics
: emodpy.emod_file.DemographicsFiles¶ Simulation level demographics such as overlays
-
simulation_migrations
: emodpy.emod_file.MigrationFiles¶ Simulation level migrations
-
create_campaign_from_callback
(builder)¶
-
create_demog_from_callback
(builder, from_sweep=False)¶
-
classmethod
from_default2
(eradication_path, schema_path, param_custom_cb, config_path='new_config.json', campaign_builder=None, ep4_custom_cb=<function default_ep4_fn>, demog_builder=None, plugin_report=None, serial_pop_files=None, **kwargs) → emodpy.emod_task.EMODTask¶ Create a task from emod-api Defaults
- Parameters
config_path – /path/to/new_config.json
eradication_path – Path to Eradication binary
param_custom_cb – Function that sets parameters for config
ep4_custom_cb – Function that sets EP4 assets
plugin_report – Custom reports file
- Returns
EMODTask
-
classmethod
from_files
(eradication_path=None, config_path=None, campaign_path=None, demographics_paths=None, ep4_path=None, custom_reports_path=None, asset_path=None, **kwargs)¶ Load custom EMOD files when creating
EMODTask
.- Parameters
asset_path – If an asset path is passed, the climate, dlls, and migrations will be searched there
eradication_path – The eradication.exe path.
config_path – The custom configuration file.
campaign_path – The custom campaign file.
demographics_paths – The custom demographics files (single file or a list).
custom_reports_path – Custom reports file
Returns: An initialized experiment
-
load_files
(config_path=None, campaign_path=None, custom_reports_path=None, demographics_paths=None, asset_path=None) → NoReturn¶ Load files in the experiment/base_simulation.
- Parameters
asset_path – Path to find assets
config_path – Configuration file path
campaign_path – Campaign file path
demographics_paths – Demographics file path
custom_reports_path – Path for the custom reports file
-
pre_creation
(parent: Union[idmtools.entities.simulation.Simulation, idmtools.entities.iworkflow_item.IWorkflowItem], platform: idmtools.entities.iplatform.IPlatform)¶ Call before a task is executed. This ensures our configuration is properly done
-
set_command_line
() → NoReturn¶ Build and set the command line object.
Returns:
-
set_sif
(path_to_sif) → NoReturn¶ Set the Singularity Image File.
Returns:
-
gather_common_assets
() → idmtools.assets.asset_collection.AssetCollection¶ Gather Experiment Level Assets Returns:
-
gather_transient_assets
() → idmtools.assets.asset_collection.AssetCollection¶ Gather assets that are per simulation Returns:
-
copy_simulation
(base_simulation: idmtools.entities.simulation.Simulation) → idmtools.entities.simulation.Simulation¶ Called when making copies of a simulation.
Here we deep copy parts of the simulation to ensure we don’t accidentally update objects :param base_simulation: Base Simulation
Returns:
-
set_parameter
(name: str, value: any) → dict¶ Set a value in the EMOD config.json file. This will be deprecated in the future in favour of emod_api.config.
- Parameters
name – Name of parameter to set
value – Value to set
- Returns
Tags to set
-
static
set_parameter_sweep_callback
(simulation: idmtools.entities.simulation.Simulation, param: str, value: Any) → Dict[str, Any]¶ Convenience callback for sweeps
- Parameters
simulation – Simulation we are updating
param – Parameter
value – Value
- Returns
Tags to set on simulation
-
classmethod
set_parameter_partial
(parameter: str)¶ Convenience callback for sweeps
- Parameters
parameter – Parameter to set
Returns:
-
get_parameter
(name: str, default: Optional[Any] = None)¶ Get a parameter in the simulation.
- Parameters
name – The name of the parameter.
default – Optional, the default value.
- Returns
The value of the parameter.
-
update_parameters
(params)¶ Bulk update the configuration parameter values. This will be deprecated in the future in favour of emod_api.config.
- Parameters
params – A dictionary with new values.
- Returns
None
-
reload_from_simulation
(simulation: idmtools.entities.simulation.Simulation)¶ Optional hook that is called when loading simulations from a platform
-
-
class
emodpy.emod_task.
EMODTaskSpecification
¶ Bases:
idmtools.registry.task_specification.TaskSpecification
-
get
(configuration: dict) → emodpy.emod_task.EMODTask¶ Return an EMODTask object using provided configuration :param configuration: Configuration for Task
- Returns
EMODTask for configuration
-
get_example_urls
() → List[str]¶ Return a list of examples. This is used by the examples cli command to allow users to quickly load examples locally
- Returns
List of urls to examples
-
get_type
() → Type[emodpy.emod_task.EMODTask]¶ Returns the Task type defined by specification
Returns:
-