session
mlte/session/session.py
Session state management for the MLTE library.
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
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 |
|
MLTE_ARTIFACT_STORE_URI_VAR = 'MLTE_ARTIFACT_STORE_URI'
class-attribute
instance-attribute
Environment variable to get the artifact store URI from, if needed.
MLTE_CONTEXT_VERSION_VAR = 'MLTE_CONTEXT_VERSION'
class-attribute
instance-attribute
Environment variables to get model and version from, if needed.
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
106 107 108 109 110 111 112 |
|
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
152 153 154 155 156 157 158 |
|
reset_session()
Used to reset session if needed.
Source code in mlte/session/session.py
119 120 121 122 |
|
session()
Return the package global session.
Source code in mlte/session/session.py
125 126 127 |
|
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
130 131 132 133 134 135 136 137 138 139 140 |
|
set_store(artifact_store_uri)
Set the global MLTE context artifact store URI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_store_uri
|
str
|
The artifact store URI string |
required |
Source code in mlte/session/session.py
143 144 145 146 147 148 149 |
|