idmtools_platform_local.local_platform module

idmtools local platform.

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

class idmtools_platform_local.local_platform.LocalPlatform(*args, **kwargs)[source]

Bases: IPlatform

Represents the platform allowing to run simulations locally.

host_data_directory: str = '/home/docs/.local_data'

Directory where data for local platform such as files and postgres data will be stored

network: str = 'idmtools'

Name of the docker network to use

redis_image: str = 'redis:5.0.9-alpine'

What redis image should we use

redis_port: int = 6379

Port for redis to bind to

runtime: str | None = None

Runtime. Defaults to runc, but can be set to nvidia-docker

redis_mem_limit: str = '128m'

Memory limit for redis

redis_mem_reservation: str = '64m'

How much memory should redis preallocate

postgres_image: str = 'postgres:11.9'

Postgres image to use

postgres_mem_limit: str = '64m'

Postgres memory limit

postgres_mem_reservation: str = '32m'

How much memory should postgres reserve

postgres_port: str | None = 5432

What port should postgres listen to

workers_mem_limit: str = '16g'

Memory limit for workers

workers_mem_reservation: str = '128m'

How much memory should the workers pre-allocate

workers_image: str = None

Workers image to use. Defaults to version compatible with current idmtools version

workers_ui_port: int = 5000

Workers UI port

heartbeat_timeout: int = 15

Heartbeat timeout

default_timeout: int = 45

Default timeout when talking to local platform

launch_created_experiments_in_browser: bool = False

Launch experiments created in the browser

auto_remove_worker_containers: bool = True

allows user to specify auto removal of docker worker containers

enable_singularity_support: bool = False

Enables singularity support. This requires elevated privileges on docker and should only be used when using singularity within workflows. This feature is in BETA so it may be unstable

cleanup(delete_data: bool = False, shallow_delete: bool = False, tear_down_brokers: bool = False)[source]

Cleanup the platform.

If delete data is true, the local platform data is deleted. If shallow delete is true, just the data within the local platform data directory is deleted. If tear down brokers is true, the task brokers talking to the server are destroyed.

Parameters:
  • delete_data – Should data be deleted

  • shallow_delete – Should just the files be deleted

  • tear_down_brokers – Should we destroy our brokers

post_setstate()[source]

Post set-state.

__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, host_data_directory: str = '/home/docs/.local_data', network: str = 'idmtools', redis_image: str = 'redis:5.0.9-alpine', redis_port: int = 6379, runtime: str | None = None, redis_mem_limit: str = '128m', redis_mem_reservation: str = '64m', postgres_image: str = 'postgres:11.9', postgres_mem_limit: str = '64m', postgres_mem_reservation: str = '32m', postgres_port: str | None = 5432, workers_mem_limit: str = '16g', workers_mem_reservation: str = '128m', workers_image: str = None, workers_ui_port: int = 5000, heartbeat_timeout: int = 15, default_timeout: int = 45, launch_created_experiments_in_browser: bool = False, auto_remove_worker_containers: bool = True, enable_singularity_support: bool = False) None