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: 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>, image_name: str = None, build: bool = False, build_path: str | None = None, Dockerfile: str | None = None, pull_before_build: bool = True, use_nvidia_run: bool = False, _DockerTask__image_built: bool = False)[source]

Bases: ITask

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

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

Gather common(experiment-level) assets from task.

Returns:

AssetCollection containing all the common assets

gather_transient_assets() AssetCollection[source]

Gather transient(simulation-level) assets from task.

Returns:

AssetCollection

build_image(spinner=None, **extra_build_args)[source]

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

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

Bases: TaskSpecification

DockerTaskSpecification provides the task plugin to idmtools for DockerTask.

get(configuration: dict) DockerTask[source]

Get instance of DockerTask with configuration provided.

Parameters:

configuration – configuration for DockerTask

Returns:

DockerTask with configuration

get_description() str[source]

Get description of plugin.

Returns:

Plugin description

get_type() Type[DockerTask][source]

Get type of task provided by plugin.

Returns:

DockerTask