Hooks
kedro_aim.framework.hooks.aim_hook
kedro_aim.framework.hooks.aim_hook.AimHook
The hook that is used to integrate Aim with Kedro.
The hook is responsible for:
- Creating the Aim run before the pipeline is run.
- Adding the Aim run to the catlog.
Source code in kedro_aim/framework/hooks/aim_hook.py
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
kedro_aim.framework.hooks.aim_hook.AimHook.after_catalog_created(catalog, conf_catalog, conf_creds, feed_dict, save_version, load_versions)
Hooks to be invoked after a data catalog is created.
Im this hook we go through all the datasets in the catalog an replace the
datasets that are of type AimArtifactDataSet
with a special aim dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
catalog |
DataCatalog
|
The catalog that was created. |
required |
conf_catalog |
Dict[str, Any]
|
The config from which the catalog was created. |
required |
conf_creds |
Dict[str, Any]
|
The credentials conf from which the catalog was created. |
required |
feed_dict |
Dict[str, Any]
|
The feed_dict that was added to the catalog after creation. |
required |
save_version |
str
|
The save_version used in |
required |
load_versions |
str
|
The load_versions used in |
required |
Source code in kedro_aim/framework/hooks/aim_hook.py
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 |
|
kedro_aim.framework.hooks.aim_hook.AimHook.after_context_created(context)
Hooks to be invoked after a KedroContext
is created.
This hook reads the Aim configuration from the aim.yml
from the conf
folder
of the Kedro project and stores it in the aim_config
attribute of the hook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context |
KedroContext
|
The newly created context. |
required |
Source code in kedro_aim/framework/hooks/aim_hook.py
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 |
|
kedro_aim.framework.hooks.aim_hook.AimHook.after_pipeline_run(run_params, pipeline, catalog)
Hook to be invoked after a pipeline runs.
After the pipeline runs, we close the Aim run and add StatusTag.SUCCESS
tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_params |
Dict[str, Any]
|
The params used to run the pipeline. Should have the following schema
|
required |
pipeline |
Pipeline
|
The |
required |
catalog |
DataCatalog
|
The |
required |
Source code in kedro_aim/framework/hooks/aim_hook.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
kedro_aim.framework.hooks.aim_hook.AimHook.before_node_run(node, catalog, inputs, is_async, session_id)
Hook to be invoked before a node runs.
All parameters
that are passed to the node are logged to the run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Node
|
The |
required |
catalog |
DataCatalog
|
A |
required |
inputs |
Dict[str, Any]
|
The dictionary of inputs dataset. The keys are dataset names and the values are the actual loaded input data, not the dataset instance. |
required |
is_async |
bool
|
Whether the node was run in |
required |
session_id |
str
|
The id of the session. |
required |
Source code in kedro_aim/framework/hooks/aim_hook.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
kedro_aim.framework.hooks.aim_hook.AimHook.before_pipeline_run(run_params, pipeline, catalog)
Hook to be invoked before a pipeline runs.
Before the pipeline runs, we create the Aim run and add it to the catalog
under the name run
. This allows us to access the run in the pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_params |
Dict[str, Any]
|
The params used to run the pipeline. Should have the following schema
|
required |
pipeline |
Pipeline
|
The |
required |
catalog |
DataCatalog
|
The |
required |
Source code in kedro_aim/framework/hooks/aim_hook.py
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
kedro_aim.framework.hooks.aim_hook.AimHook.on_pipeline_error(error, run_params, pipeline, catalog)
Hook to be invoked if a pipeline run throws an uncaught Exception.
In this case, we close the run and add a StatusTag.FAILURE
tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error |
Exception
|
The uncaught exception thrown during the pipeline run. |
required |
run_params |
Dict[str, Any]
|
The params used to run the pipeline. Should have the following schema
|
required |
pipeline |
Pipeline
|
The |
required |
catalog |
DataCatalog
|
The |
required |
Source code in kedro_aim/framework/hooks/aim_hook.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
kedro_aim.framework.hooks.aim_hook.StatusTag
Bases: str
, Enum
Enumeration of the status tags that can be used to tag metrics.
Source code in kedro_aim/framework/hooks/aim_hook.py
21 22 23 24 25 |
|
kedro_aim.framework.hooks.utils
kedro_aim.framework.hooks.utils.check_aim_enabled(pipeline_name, aim_config)
Check if Aim is enabled for the given pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_name |
str
|
Name of the pipeline. |
required |
aim_config |
KedroAimConfig
|
Kedro-Aim configuration. |
required |
Returns:
Type | Description |
---|---|
bool
|
A boolean indicating whether Aim is enabled for the given pipeline. |
Source code in kedro_aim/framework/hooks/utils.py
4 5 6 7 8 9 10 11 12 13 14 |
|