idmtools.core.docker_task module

DockerTask provides a utility to run docker images.

This is currently only used by idmtools_local_platform.

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

class idmtools.core.docker_task.DockerTask(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>, image_name: str = None, build: bool = False, build_path: ~typing.Optional[str] = None, Dockerfile: ~typing.Optional[str] = None, pull_before_build: bool = True, use_nvidia_run: bool = False, _DockerTask__image_built: bool = False)

Bases: ITask

Provides a task to run or optionally build a docker container.

image_name: str = None
build: bool = False
build_path: Optional[str] = None
Dockerfile: Optional[str] = None
pull_before_build: bool = True
use_nvidia_run: bool = False
gather_common_assets() AssetCollection

Gather common(experiment-level) assets from task.

Returns:

AssetCollection containing all the common assets

gather_transient_assets() AssetCollection

Gather transient(simulation-level) assets from task.

Returns:

AssetCollection

build_image(spinner=None, **extra_build_args)

Build our docker image.

Parameters:
  • spinner – Should we display a CLI spinner

  • **extra_build_args – Extra build arguments to pass to docker

Returns:

None

reload_from_simulation(simulation: Simulation)

Method to reload task details from simulation object. Currently we do not do this for docker task.

Parameters:

simulation – Simulation to load data from

Returns:

None

__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>, image_name: str = None, build: bool = False, build_path: ~typing.Optional[str] = None, Dockerfile: ~typing.Optional[str] = None, pull_before_build: bool = True, use_nvidia_run: bool = False, _DockerTask__image_built: bool = False) None
class idmtools.core.docker_task.DockerTaskSpecification

Bases: TaskSpecification

DockerTaskSpecification provides the task plugin to idmtools for DockerTask.

get(configuration: dict) DockerTask

Get instance of DockerTask with configuration provided.

Parameters:

configuration – configuration for DockerTask

Returns:

DockerTask with configuration

get_description() str

Get description of plugin.

Returns:

Plugin description

get_type() Type[DockerTask]

Get type of task provided by plugin.

Returns:

DockerTask