session
Session info when using the MLTE library: context (model and version), stores and credentials.
Session
The Session data structure encapsulates package-wide state.
The primary function of the Session data structure is to provide convenient access to the MLTE context for application developers.
Source code in mlte/session/session.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
ENV_CURRENT_PASS_VAR = 'MLTE_CURRENT_PASS'
class-attribute
instance-attribute
Environment variables to get model, version, store_uri and credentials from, if needed.
__init__()
Constructors, just resets all vars.
Source code in mlte/session/session.py
30 31 32 | |
create_context()
Creates the currently configured context in the currently configured session. Fails if either is not set. Does nothing if already created.
Source code in mlte/session/session.py
122 123 124 125 126 | |
reset()
Resets all internal state to defaults.
Source code in mlte/session/session.py
34 35 36 37 38 39 40 41 42 43 | |
add_catalog_store(catalog_store_uri, id)
Adds a global MLTE catalog store URI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog_store_uri
|
str
|
The catalog store URI string |
required |
Source code in mlte/session/session.py
172 173 174 175 176 177 178 179 | |
get_session()
Return the package global session.
Source code in mlte/session/session.py
138 139 140 | |
print_custom_list_entries(list_name)
Prints custom list entries in a user-friendly way.
Source code in mlte/session/session.py
182 183 184 185 186 187 188 | |
reset_session()
Used to reset session if needed.
Source code in mlte/session/session.py
133 134 135 | |
set_context(model_id, version_id, lazy=True)
Set the global MLTE context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_id
|
str
|
The model identifier |
required |
version_id
|
str
|
The version identifier |
required |
lazy
|
bool
|
Whether to wait to create the context until an artifact is written (True), or to eagerly create it immediately (False). |
True
|
Source code in mlte/session/session.py
143 144 145 146 147 148 149 150 151 152 | |
set_credentials(user, password=None)
Set the global MLTE credentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
str
|
The user |
required |
password
|
str | None
|
The password (can be ommitted if only user is being set) |
None
|
Source code in mlte/session/session.py
163 164 165 166 167 168 169 | |
set_store(store_uri)
Set the global MLTE stores from the given URI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_uri
|
str
|
The store URI string |
required |
Source code in mlte/session/session.py
155 156 157 158 159 160 | |