afnio.tellurio.run
afnio.tellurio.run.RunStatus
Bases: Enum
Represents the status of a Tellurio Run.
It can be one of the following values:
"RUNNING": The Run is active and accepting logs, metrics, and artifacts."COMPLETED": The run has completed successfully without any errors."CRASHED": The run has crashed due to an unhandled exception or error."FAILED": A safeguard/intermediate failure state used when a Run was left unfinished or superseded.
Source code in afnio/tellurio/run.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
afnio.tellurio.run.RunOrg
Represents a Tellurio Run's Organization.
Each Run belongs to a Project,
and each Project belongs to a namespace,
which can be either an Organization or a User (personal Organization).
Source code in afnio/tellurio/run.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
afnio.tellurio.run.RunProject
Represents a Tellurio Run's Project.
Each Run belongs to a Project,
and each Project belongs to a namespace,
which can be either an Organization or a User (personal Organization).
Source code in afnio/tellurio/run.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
afnio.tellurio.run.RunUser
Represents a Tellurio Run's User.
Each Run is associated with a user who created it.
Source code in afnio/tellurio/run.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
afnio.tellurio.run.Run
Represents a Tellurio Run.
Each Run belongs to a Project,
and each Project belongs to a namespace,
which can be either an Organization or a User (personal Organization).
A Run represents a single execution or experiment of an AI agent or
workflow, that you want to track and log metrics for. It provides methods to log
metrics and artifacts, and to mark the Run as completed or crashed. It can also
be used as a context manager to automatically handle completion
and crashing based on exceptions.
Source code in afnio/tellurio/run.py
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 | |
finish(client=None, status=RunStatus.COMPLETED)
Marks the run as "COMPLETED" on the server by sending a PATCH request,
and clears the active run UUID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
TellurioClient | None
|
The client to use for the request. If not provided, the default client will be used. |
None
|
status
|
RunStatus | None
|
The |
COMPLETED
|
Raises:
| Type | Description |
|---|---|
Exception
|
If the PATCH request fails. |
Source code in afnio/tellurio/run.py
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 | |
log(name, value, step=None, client=None)
Log a metric for this run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the metric. |
required |
value
|
Any
|
Value of the metric. Can be any type that is JSON serializable. |
required |
step
|
int | None
|
Step number. If not provided, the backend will auto-compute it. |
None
|
client
|
TellurioClient | None
|
The client to use for the request. If not provided, the default client will be used. |
None
|
Source code in afnio/tellurio/run.py
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 | |
__enter__()
Enter the runtime context related to this object.
Returns self so it can be used as a context manager.
Source code in afnio/tellurio/run.py
234 235 236 237 238 239 240 | |
__exit__(exc_type, exc_val, exc_tb)
Exit the runtime context and finish the run.
If an exception occurred, you may want to set status to "CRASHED"
in the future.
Source code in afnio/tellurio/run.py
242 243 244 245 246 247 248 249 | |
afnio.tellurio.run.init(namespace_slug, project_display_name, name=None, description=None, status=RunStatus.RUNNING, client=None)
Initializes a new Tellurio Run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace_slug
|
str
|
The namespace slug where the project resides. It can be either an organization slug or a user slug. |
required |
project_display_name
|
str
|
The display name of the project. This will be used to retrive or create the project through its slugified version. |
required |
name
|
str | None
|
The name of the run. If not provided, a random name is generated (e.g., "brave_pasta_123"). If the name is provided but already exists, an incremental number is appended to the name (e.g., "test_run_1", "test_run_2"). |
None
|
description
|
str | None
|
A description of the run. |
None
|
status
|
RunStatus | None
|
The status of the run (default: "RUNNING"). |
RUNNING
|
client
|
TellurioClient | None
|
An instance of TellurioClient. If not provided, the default client will be used. |
None
|
Returns:
| Type | Description |
|---|---|
Run
|
A Run object representing the created run. |
Raises:
| Type | Description |
|---|---|
Exception
|
If there is an error during the API requests to create the run or
retrieve/create the |
Source code in afnio/tellurio/run.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |