utils.rc.dtos.env

Module Contents

Classes

EnvType

str(object='') -> str

Env

Attributes

logger

EnvDataMap

utils.rc.dtos.env.logger
class utils.rc.dtos.env.EnvType

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

EXTRA_SMALL = 'EXTRA_SMALL'
SMALL = 'SMALL'
MEDIUM = 'MEDIUM'
LARGE = 'LARGE'
CPU_LARGE = 'CPU_LARGE'
MAX_LARGE = 'MAX_LARGE'
EXTRA_MAX_LARGE = 'EXTRA_MAX_LARGE'
SUPER_LARGE = 'SUPER_LARGE'
CUSTOM = 'CUSTOM'
utils.rc.dtos.env.EnvDataMap
class utils.rc.dtos.env.Env(data={})
static getEnvTypeInfo()

Return all the supported environment types with cpu and memory

Returns:

Map of all the environments with related info

Return type:

Map

static createEnv(name: str, description: str, envType: EnvType, diskInGbs: int = 20, requirements: str = '', gpus: int = 0, cores: int = 0, memInGBs: int = 0, validate_reqs: bool = True, evergreen: bool = None, inactivity_in_hours: int = 0, async_flag: bool = False) Env

Creates the environments, it takes few minutes to create it

Parameters:
  • name (str) – name of the environment

  • description (str) – description of the environment

  • envType (EnvType) – type of environment, See getEnvTypeInfo() method to list all supported types. Type of the environment

  • cpu (depicts the memory and)

  • diskInGbs (int, optional) – . Defaults to 20.

  • requirements (str, optional) – Python pip requirements to be installed eg. tsfresh==0.21.0 pandas==1.14.0. Defaults to “”.

  • gpus – (int, optional): If gpu is required, send it as 1

  • cores – (int, optional): If env type is custom, it represents number of cores needed

  • memInGBs – (int, optional): If env type is custom, it represents number of memInGBs needed

  • evergreen – (bool, optional): Shutdown strategy

  • inactivity_in_hours – (int, optional): Env will shut down automatically after so specified inactive hours

Returns:

Created environment

Return type:

Env

static getResourcesFromEnvType(envType: EnvType)
static updateEnv(envId: str, description: str = None, envType: EnvType = None, diskInGbs: int = None, requirements: str = None, gpus: int = 0, cores: int = 0, memInGBs: int = 0, evergreen: bool = None, inactivity_in_hours: int = 0, async_flag: bool = False) Env

Updates the existing environment, it might take few minutes to do the updation

Parameters:
  • envId (str) – id of the environment

  • description (str, optional) – new description. Defaults to None.

  • envType (EnvType, optional) – new env type. Defaults to None.

  • diskInGbs (int, optional) – . Defaults to None.

  • requirements (str, optional) – new requirements. Defaults to None.

  • gpus – (int, optional): If gpu is required, send it as 1

  • cores – (int, optional): If env type is custom, it represents number of cores needed

  • memInGBs – (int, optional): If env type is custom, it represents number of memInGBs needed

  • evergreen – (bool, optional): Shutdown strategy

  • inactivity_in_hours – (int, optional): To change shutdown strategy and will only be updated upon passing a value greater than 0

Returns:

updated environment object

Return type:

Env

static getEnvByName(name: str) Env

Get the environment by the name

Parameters:

name (str) – name of the environment

Returns:

Environment object

Return type:

Env

static getEnvById(envId: str) Env

Get the environment by the id

Parameters:

envId (str) – id of the environment

Returns:

Environment object

Return type:

Env

static deleteEnvById(envId: str)

Deletes the environment by the id

Parameters:

envId (str) – id of the environment

static getAllEnvs()

Get all the environments associated with your tenant

Returns:

all the environments

Return type:

Map

pollStatus(timeout: int = 300, interval: int = 3) dict

Polls the environment status until launchStatus is SUCCESS or FAILED, or until timeout.