idmtools_platform_container.container_platform module#

Here we implement the ContainerPlatform object.

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

class idmtools_platform_container.container_platform.ContainerPlatform(*args, **kwargs)[source]#

Bases: FilePlatform

Container Platform definition.

docker_image: str = None#
data_mount: str = None#
user_mounts: dict = None#
container_prefix: str = None#
force_start: bool = False#
new_container: bool = False#
include_stopped: bool = False#
debug: bool = False#
container_id: str = None#
validate_container(container_id: str) str[source]#

Validate the container. :param container_id: container id

Returns:

Container short id

run_items(items: IEntity | List[IEntity], **kwargs)[source]#

Run items on the platform. :param items: Runnable items :param kwargs: additional arguments

Returns:

None

submit_job(item: Experiment | Simulation, dry_run: bool = False, **kwargs) NoReturn[source]#

Submit a Process job in a docker container. :param item: Experiment or Simulation :param dry_run: True/False :param kwargs: keyword arguments used to expand functionality

Returns:

Any

check_container(**kwargs) str[source]#

Check the container status. :param kwargs: keyword arguments used to expand functionality

Returns:

container id

start_container(**kwargs) str[source]#

Execute a command in a container. :param kwargs: keyword arguments used to expand functionality

Returns:

container id

convert_scripts_to_linux(experiment: Experiment, **kwargs) NoReturn[source]#

Convert the scripts to Linux format. :param experiment: Experiment :param kwargs: keyword arguments used to expand functionality

Returns:

No return

submit_experiment(experiment: Experiment, **kwargs) NoReturn[source]#

Submit an experiment to the container. :param experiment: Experiment :param kwargs: keyword arguments used to expand functionality

Returns:

No return

build_binding_volumes() Dict[source]#

Build the binding volumes for the container. :returns: bindings in dict format

get_mounts() List[source]#

Build the mounts of the container. :returns: List of mounts (Dict)

validate_mount(container: str | Container) bool[source]#

Compare the mounts of the container with the platform. :param container: a container object or id.

Returns:

True/False

get_container_directory(item: Suite | Experiment | Simulation) str[source]#

Get the container corresponding directory of an item. :param item: Suite, Experiment or Simulation

Returns:

string Path

retrieve_match_containers(image: str | None = None) List[source]#

Find the containers that match math the image. :param image: docker image

Returns:

list of containers

__init__(_uid: str = None, _IItem__pre_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _IItem__post_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _platform_defaults: ~typing.List[~idmtools.entities.iplatform_default.IPlatformDefault] = <factory>, _config_block: str = None, job_directory: str = None, max_job: int = 4, run_sequence: bool = True, sym_link: bool = True, retries: int = 1, modules: list = <factory>, extra_packages: list = <factory>, docker_image: str = None, data_mount: str = None, user_mounts: dict = None, container_prefix: str = None, force_start: bool = False, new_container: bool = False, include_stopped: bool = False, debug: bool = False, container_id: str = None) None#