Module clients.h2o_engine.client
Classes
H2OEngineClient
H2OEngineClient manages H2O engines.
Initializes H2OEngineClient. Do not initialize manually, use h2o_engine_manager.login() instead.
Args
connection_config:ConnectionConfig- AIEM connection configuration object.
default_workspace_id:str- The default workspace ID which will client use to manipulate with H2O engines.
verify_ssl- Set to False to disable SSL certificate verification.
ssl_ca_cert- Path to a CA cert bundle with certificates of trusted CAs.
Methods
calculate_h2o_engine_size_compressed_dataset
Calculate recommended engine size based on the dimensions of the compressed dataset and given engine size limits.
Args
rows_count- number of rows of the compressed dataset
columns_count- number of columns of the compressed dataset
limits- H2OEngine size limits
Returns: recommended H2OEngine size
calculate_h2o_engine_size_raw_dataset
Calculate recommended engine size based on the raw size of the expected raw dataset size and given engine size limits.
Args
dataset_size_bytes- raw size of the expected raw dataset size in bytes. Supports quantity suffixes. Examples values: "1000", "1Mi", "20Gi", "20G".
limits- H2OEngine size limits
Returns: recommended H2OEngine size
create_engine
Creates H2O engine and initiates launch.
Args
engine_id:str, optionalThe ID to use for the H2O engine, which will become the final component of the engine's resource name. If left unspecified, the client will generate a random value. This value must:
- contain 1-63 characters
- contain only lowercase alphanumeric characters or hyphen ('-')
- start with an alphabetic character
- end with an alphanumeric character
node_count:int, optional- Number of nodes of the H2O cluster. If not specified, a default value will be set by server.
cpu:int, optional- The amount of CPU units per node allocated for the engine. If not specified, a default value will be set by server.
gpu:int, optional- Number of nvidia.com/gpu Kubernetes resource units per node. If not specified, a default value will be set by server.
memory_bytes:str, optionalThe amount of memory per node. Quantity of bytes. Example
8G,16Gi. If not specified, a default value will be set by server. Detailed syntax:- [quantity] = [number][suffix]
- [suffix] = [binarySI] | [decimalSI]
- [binarySI] = Ki | Mi | Gi | Ti | Pi
- [decimalSI] = k | M | G | T | P
max_idle_duration:str, optional- Maximum time an engine can be idle. When exceeded, the engine will terminate. Must be specified as a number with
ssuffix. Example3600s. If not specified, a default value will be set by server. max_running_duration:str, optional- Maximum time na engine can be running. When exceeded, the engine will terminate. Must be specified as a number with
ssuffix. Example36000s. If not specified, a default value will be set by server. workspace_id:str, optional- The workspace ID where the engine is to be created. Defaults to client's workspace_id default value.
display_name:str- Human-readable name of the H2OEngine. Must contain at most 63 characters. Does not have to be unique.
annotations:Dict[str, str], optionalAdditional arbitrary metadata associated with the H2OEngine. Defaults to . Annotations are key/value pairs. The key must:
- be 63 characters or less
- begin and end with an alphanumeric character ([a-z0-9A-Z])
- with dashes (-), underscores (_), dots (.), and alphanumerics between
- regex used for validation is:
^[A-Za-z0-9]([-A-Za-z0-9_.]61[A-Za-z0-9])?$
validate_only:bool, optional- If set to True, server will validate the request, but no engine will be created. Defaults to False.
profile:str- The resource name of the H2OEngineProfile that is used by this H2OEngine. Format is
workspaces/*/h2oEngineProfiles/*. h2o_engine_version- H2OEngineVersion assigned to H2OEngine. Format: "workspaces//h2oEngineVersions/".
Returns
H2OEngine- H2O engine.
generate_engine_id
get_engine
list_all_engines
Returns a list of all engines within a parent workspace.
Args
workspace_id:str, optional- ID of the workspace. Defaults to client's default value (
defaultif not set). order_by:str, optional- Identical to the list_engines function order_by parameter.
filter:str, optional- Identical to the list_engines function filter parameter.
Returns
List[H2OEngine]- A list of H2O engines.
list_engines
Returns a list of engines within a parent workspace.
Args
workspace_id:str, optional- ID of the workspace. Defaults to H2OEngineClient's default value (
defaultif not set). page_size:int, optional- Maximum number of H2OEngines to return in a response. If unspecified (or set to 0), at most 50 H2OEngines will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
page_token:str, optional- Leave unset to receive the initial page. To list any subsequent pages use the value of 'next_page_token' returned from the H2OEnginesPage.
order_by:str, optionalUsed to specify the sorting order. When unset, H2OEngines are ordered by their time of creation in descending order. This is equivalent to "create_time desc". When specified, the value must be a comma separated list of supported fields. The supported fields are:
- name
- cpu
- gpu
- memory_bytes
- creator
- create_time
- update_time
- delete_time
- display_name
- max_idle_duration
- max_running_duration
- uid
The default sorting order is ascending. For example: "name" and "name asc" are equivalent values. To specify descending order for a field, append a " desc" suffix. For example: "name desc". Redundant space characters are insignificant. For example these values are all equal:
- " name, cpu desc"
- "name, cpu desc"
- "name , cpu desc "
Undefined (empty) time is interpreted as a zero time (0s since epoch, i.e. 1970-01-01T00:00:00Z). Undefined (empty) duration is interpreted as a zero duration (0 seconds).
filter:str, optionalUsed to filter H2OEngines. When unset, no filtering is applied. When specified, the filter string must follow this formatting rules:
- filter expression: [term] AND [term] AND [term] …
- term: [filter_field] [operator] [value]
- filter_field: (name|state|cpu|gpu|memory_bytes|creator|create_time|update_time|delete_time|reconciling|uid|display_name|max_idle_duration|max_running_duration|uid)
- operator: (=|!=|<=|<|>=|>)
- value: ([text]|[string])
- text: free-form set of characters without whitespace (WS) or . (DOT) within it. (e.g.
28,abc,@5_6_7$) - string: a quoted string. Text may contain whitespace (WS) or . (DOT) within it. (e.g.
"28","abc","@5_6_7$"," foo . ")
Filter expression is case sensitive. Additional constraints:
- You MUST use separator
<space>AND<space>between terms. - String value MUST NOT contain
<space>AND<space>.
Each field may support only some operators:
- string fields (name, creator, uid) support: =, !=, <=, <, >=, >
- number fields (cpu, gpu, memory_bytes) support: =, !=, <=, <, >=, >
- bool fields (reconciling) support: =, !=
- enum fields (state) support: =, !=
- time fields (create_time) support: =, !=, <=, <, >=, >
Each field may expect values in a specified format:
- string fields expect: text or string. For example
foo,"f oo". For examplef oois invalid. - number fields expect: numbers (can be wrapped in parentheses). For example:
28,-100,56.8,"666" - integer number fields expect: integers. For example:
cpu = 10.5is invalid. - bool fields expect:
trueorfalseliterals. For example:reconciling = trueis valid.reconciling = 1orreconciling = TRUEis invalid. - enum fields expect: enum's string representation. For example
state = STATE_RUNNINGis valid.state = RUNNINGorstate = state_runningis invalid. - time fields expect: RFC-3339 formatted string. UTC offsets are supported. For example
2012-04-21T11:30:00-04:00is valid.2012-04-21is invalid.
Valid filter expression examples:
state = STATE_RUNNING AND cpu <= 5 AND gpu != 0 AND create_time > 2012-04-21T11:30:00-04:00state=STATE_RUNNING AND cpu<=5(there may be no whitespace between term parts:[filter_field][operator][value])
Invalid filter expression examples:
state = STATE_RUNNING AND cpu <= 5(invalid separator between terms)state = STATE_RUNNING OR cpu <= 5(unsupported logical operator)(state = STATE_RUNNING) AND (cpu <= 5)(unsupported parentheses)
Returns
H2OEnginesPage- A list of H2O engines together with a next_page_token for the next page.
- Submit and view feedback for this page
- Send feedback about AI Engine Manager to cloud-feedback@h2o.ai