RunManager
Run Manager for organising simulation runs, results, and checkpoints.
This module provides a RunManager class that handles: - Unique run identification using UUIDs - Directory structure creation and management - Metadata tracking and persistence - Status tracking throughout simulation lifecycle - Checkpoint association with runs - Run indexing and lookup capabilities
RunManager
Manages simulation runs with unique identification, metadata, and organization.
This class provides a comprehensive system for organising simulation runs, tracking their status, managing outputs, and associating checkpoints.
Source code in june/run_manager.py
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 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 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
|
__init__(base_runs_dir='runs', auto_create=True)
Initialise the RunManager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_runs_dir
|
Union[str, Path]
|
Base directory where all runs will be stored |
'runs'
|
auto_create
|
bool
|
Whether to automatically create the base directory |
True
|
Source code in june/run_manager.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
add_checkpoint(checkpoint_name, checkpoint_path=None)
Associate a checkpoint with this run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
checkpoint_name
|
str
|
Name/identifier of the checkpoint |
required |
checkpoint_path
|
Optional[str]
|
Optional path to the checkpoint files (Default value = None) |
None
|
Source code in june/run_manager.py
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 |
|
cleanup_old_runs(keep_count=10, older_than_days=None)
Clean up old runs, keeping only the most recent ones.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keep_count
|
int
|
Number of recent runs to keep (Default value = 10) |
10
|
older_than_days
|
Optional[int]
|
Only delete runs older than this many days (Default value = None) |
None
|
Source code in june/run_manager.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
|
create_child_run(parent_run_id, description=None, tags=None, copy_checkpoints=True, **kwargs)
Create a new run that is a child of an existing run.
This is useful for resumed runs where you want to maintain the relationship to the original run while creating a new run directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_run_id
|
str
|
The run ID of the parent run |
required |
description
|
Optional[str]
|
Human-readable description of the child run (Default value = None) |
None
|
tags
|
Optional[List[str]]
|
List of tags for categorising the run (Default value = None) |
None
|
copy_checkpoints
|
bool
|
Whether to copy checkpoints from parent run (Default value = True) |
True
|
**kwargs
|
Additional metadata to store |
{}
|
Source code in june/run_manager.py
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 |
|
create_run(description=None, tags=None, run_id=None, **kwargs)
Create a new run with unique identifier and directory structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description
|
Optional[str]
|
Human-readable description of the run (Default value = None) |
None
|
tags
|
Optional[List[str]]
|
List of tags for categorising the run (Default value = None) |
None
|
run_id
|
Optional[str]
|
Optional specific run ID (generates UUID if not provided) (Default value = None) |
None
|
**kwargs
|
Additional metadata to store |
{}
|
Source code in june/run_manager.py
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 |
|
get_checkpoints_dir()
Get the checkpoints directory for the current run.
For child runs (resumed runs), this returns the parent's checkpoint directory since checkpoints should remain in their original location.
Source code in june/run_manager.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
get_latest_run()
Get the ID of the most recent run.
Source code in june/run_manager.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
|
get_logs_dir()
Get the logs directory for the current run.
Source code in june/run_manager.py
332 333 334 335 336 337 338 |
|
get_results_dir()
Get the results directory for the current run.
Source code in june/run_manager.py
300 301 302 303 304 305 306 |
|
list_runs(limit=None, status_filter=None)
List recent runs with optional filtering.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
Optional[int]
|
Maximum number of runs to return (Default value = None) |
None
|
status_filter
|
Optional[str]
|
Filter by specific status (Default value = None) |
None
|
Source code in june/run_manager.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
|
load_run(run_id)
Load an existing run by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
str
|
The run ID to load |
required |
Source code in june/run_manager.py
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 |
|
save_config(config_data, filename='config.yaml')
Save configuration data to the run directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_data
|
Any
|
Configuration data to save |
required |
filename
|
str
|
Name of the config file (Default value = "config.yaml") |
'config.yaml'
|
Source code in june/run_manager.py
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 |
|
save_run_params(params)
Save run parameters to run_params.json.
Args:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params
|
Dict[str, Any]
|
|
required |
Source code in june/run_manager.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
update_status(status, **kwargs)
Update the run status and optional additional metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
status
|
str
|
New status from RunStatus enum |
required |
**kwargs
|
Additional metadata to update |
{}
|
Source code in june/run_manager.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
RunStatus
Enumeration of possible run statuses.
Source code in june/run_manager.py
26 27 28 29 30 31 32 33 |
|