adalib.schedules
¶
The Schedules sub-package exposes the core integrations of the notebook schedules in the AdaLab Gallery.
Functions¶
create_schedule ¶
create_schedule(name, schedule, acl_type_view='logged_in', acl_list_view=[], acl_type_logs='logged_in', acl_list_logs=[], acl_type_edit='logged_in', acl_list_edit=[], acl_type_decrypt='logged_in', acl_list_decrypt=[], active=True, aux_files=[{'source': '', 'target': ''}], card_id=None, cleanup=True, inputs={}, concurrent=True, kernel_id=None, notebook_file='', owner_id='', pool='card-runner-low', post_run_script='', pre_run_script='', profile_id=None, options_ids=[], runner_id='', source='lab', timeout=3600, timezone='Etc/UTC')
Create a new notebook schedule.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The schedule's name. |
required |
schedule |
str
|
The schedule time string in cron format. |
required |
acl_type_view |
str
|
The ACL type for viewing the schedule. Defaults to "logged_in". |
'logged_in'
|
acl_list_view |
list[str]
|
The list of users or groups allowed to view the schedule. Defaults to an empty list. |
[]
|
acl_type_logs |
str
|
The ACL type for viewing the schedule including logs. Defaults to "logged_in". |
'logged_in'
|
acl_list_logs |
list[str]
|
The list of users or groups allowed to view the schedule including logs. Defaults to an empty list. |
[]
|
acl_type_edit |
str
|
The ACL type for editing the schedule. Defaults to "logged_in". |
'logged_in'
|
acl_list_edit |
list[str]
|
The list of users or groups allowed to edit the schedule. Defaults to an empty list. |
[]
|
acl_type_decrypt |
str
|
The ACL type for editing the schedule and decrypting its secrets. Defaults to "logged_in". |
'logged_in'
|
acl_list_decrypt |
list[str]
|
The list of users or groups allowed to edit the schedule and decrypt its secrets. Defaults to an empty list. |
[]
|
active |
bool
|
Flag whether the schedule is active. Defaults to True. |
True
|
aux_files |
list[dict]
|
A list of auxiliary files to include in the schedule. |
[{'source': '', 'target': ''}]
|
card_id |
int
|
The ID of the card from which to create the schedule. Defaults to None. |
None
|
cleanup |
bool
|
Flag whether to clean up resources after the schedule. Defaults to True. |
True
|
inputs |
dict
|
A dictionary of input parameters for the schedule. Defaults to an empty dictionary. |
{}
|
concurrent |
bool
|
Flag whether the schedule can run concurrently. Defaults to True. |
True
|
kernel_id |
int
|
The ID of the kernel to be used when running the schedule. Defaults to None. |
None
|
notebook_file |
str
|
The path to the notebook file. Defaults to an empty string. |
''
|
owner_id |
str
|
The user ID of the person to own the schedule. Defaults to an empty string. |
''
|
pool |
str
|
The execution pool. Defaults to "card-runner-low". |
'card-runner-low'
|
post_run_script |
str
|
A post-run script to execute. Defaults to an empty string. |
''
|
pre_run_script |
str
|
A pre-run script to execute. Defaults to an empty string. |
''
|
profile_id |
int
|
The ID of the Lab profile to use when running the notebook. Defaults to None. |
None
|
options_ids |
list[int]
|
A list of Lab option IDs to use when running the notebook. Defaults to an empty list. |
[]
|
runner_id |
str
|
The user ID of the person running the notebook schedule. Defaults to an empty string. |
''
|
source |
str
|
The source of the notebook file. Defaults to "lab". |
'lab'
|
timeout |
int
|
The maximum time (in seconds) before killing the run. Defaults to 3600. |
3600
|
timezone |
str
|
The timezone code for the schedule. Defaults to "Etc/UTC". |
'Etc/UTC'
|
Returns:
Type | Description |
---|---|
int
|
The schedule's ID. |
Source code in adalib/schedules/schedules.py
14 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 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 |
|
delete_run ¶
Delete a specific schedule run.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
run_id |
int
|
The run's ID. |
required |
Returns:
Type | Description |
---|---|
None
|
Nothing. |
Source code in adalib/schedules/schedules.py
delete_schedule ¶
Delete a specific notebook schedule.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
Returns:
Type | Description |
---|---|
None
|
Nothing. |
Source code in adalib/schedules/schedules.py
edit_schedule ¶
edit_schedule(schedule_id, name=None, schedule=None, acl_type_view=None, acl_list_view=None, acl_type_logs=None, acl_list_logs=None, acl_type_edit=None, acl_list_edit=None, acl_type_decrypt=None, acl_list_decrypt=None, active=None, aux_files=None, cleanup=None, inputs=None, concurrent=None, keep_aux_files=True, kernel_id=None, notebook_file=None, owner_id=None, pool=None, post_run_script=None, pre_run_script=None, profile_id=None, options_ids=None, runner_id=None, source='lab', timeout=None, timezone=None)
Edit an existing notebook schedule. Note that unspecified fields will not be changed.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the schedule. Defaults to None |
None
|
schedule |
str
|
The schedule time string in cron format. Defaults to None |
None
|
acl_type_view |
str
|
The ACL type for viewing the schedule. Defaults to None |
None
|
acl_list_view |
list[str]
|
The list of users or groups allowed to view the schedule. Defaults to None |
None
|
acl_type_logs |
str
|
The ACL type for viewing the schedule including logs. Defaults to None |
None
|
acl_list_logs |
list[str]
|
The list of users or groups allowed to view the schedule including logs. Defaults to None |
None
|
acl_type_edit |
str
|
The ACL type for editing the schedule. Defaults to None |
None
|
acl_list_edit |
list[str]
|
The list of users or groups allowed to edit the schedule. Defaults to None |
None
|
acl_type_decrypt |
str
|
The ACL type for editing the schedule and decrypting its secrets. Defaults to None |
None
|
acl_list_decrypt |
list[str]
|
The list of users or groups allowed to edit the schedule and decrypt its secrets. Defaults to None |
None
|
active |
bool
|
Flag whether the schedule is active. Defaults to None |
None
|
aux_files |
list[dict]
|
A list of auxiliary files to include in the schedule. Defaults to None |
None
|
card_id |
int, optional
|
The ID of the card from which to create the schedule. Defaults to None |
required |
cleanup |
bool
|
Flag whether to clean up resources after the schedule. Defaults to None |
None
|
inputs |
dict
|
A dictionary of input parameters for the schedule. Defaults to None |
None
|
concurrent |
bool
|
Flag whether the schedule can run concurrently. Defaults to None |
None
|
keep_aux_files |
bool
|
Flag whether to keep the existing auxiliary files. Defaults to True |
True
|
kernel_id |
int
|
The ID of the kernel to be used when running the schedule. Defaults to None |
None
|
notebook_file |
str
|
The path to the notebook file. Defaults to None |
None
|
owner_id |
str
|
The user ID of the person to own the schedule. Defaults to None |
None
|
pool |
str
|
The execution pool. Defaults to None |
None
|
post_run_script |
str
|
A post-run script to execute. Defaults to None |
None
|
pre_run_script |
str
|
A pre-run script to execute. Defaults to None |
None
|
profile_id |
int
|
The ID of the Lab profile to use when running the notebook. Defaults to None |
None
|
options_ids |
list[int]
|
A list of Lab option IDs to use when running the notebook. Defaults to None |
None
|
runner_id |
str
|
The user ID of the person running the notebook schedule. Defaults to None |
None
|
source |
str
|
The source of the schedule files. Defaults to "lab" |
'lab'
|
timeout |
int
|
The maximum time (in seconds) before killing the run. Defaults to None |
None
|
timezone |
str
|
The timezone code for the schedule. Defaults to None |
None
|
Returns:
Type | Description |
---|---|
None
|
Nothing |
Source code in adalib/schedules/schedules.py
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 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
|
get_all_schedules ¶
Retrieve a list of schedules for all users.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include_inactive |
bool
|
Flag whether inactive schedules should be included. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
list[dict]
|
A list of notebook schedules in dictionary form. |
Source code in adalib/schedules/schedules.py
get_card_schedules ¶
Retrieve a list of schedules for a specific card.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
card_id |
int
|
The card's ID. |
required |
include_inactive |
bool
|
Flag whether inactive schedules should be included. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
list[dict]
|
A list of notebook schedules in dictionary form. |
Source code in adalib/schedules/schedules.py
get_pool_stats ¶
Retrieve statistics about all run pools.
Use the example Jupyter Notebook to test this function or build upon it.
Source code in adalib/schedules/schedules.py
get_run_info ¶
Retrieve information about a specific run.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
run_id |
int
|
The run's ID. |
required |
Returns:
Type | Description |
---|---|
dict
|
Information about the run. |
Source code in adalib/schedules/schedules.py
get_run_logs ¶
Retrieve the execution and system logs of a specific run.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
run_id |
int
|
The run's ID. |
required |
Returns:
Type | Description |
---|---|
dict
|
Information about the run. |
Source code in adalib/schedules/schedules.py
get_runs_overview ¶
Retrieve a list of all schedule runs.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. Defaults to all. |
None
|
owner_id |
int
|
The schedule's owner ID. Defaults to all. |
None
|
Source code in adalib/schedules/schedules.py
get_schedule ¶
Retrieve a specific notebook schedule.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
Returns:
Type | Description |
---|---|
list[dict]
|
A list of notebook schedules in dictionary form. |
Source code in adalib/schedules/schedules.py
get_schedule_id ¶
Find the ID of a specific schedule.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The schedule's name. |
required |
owner_id |
str
|
The schedule's owner ID. |
required |
Returns:
Type | Description |
---|---|
list[int]
|
A list of schedule IDs that match the search parameters. |
Source code in adalib/schedules/schedules.py
get_user_schedules ¶
Retrieve a list of schedules for a specific user.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
str
|
The user's ID. Defaults to the current user. |
''
|
include_inactive |
bool
|
Flag whether inactive schedules should be included. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
list[dict]
|
A list of notebook schedules in dictionary form. |
Source code in adalib/schedules/schedules.py
start_run ¶
Trigger a run of a specific notebook schedule.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
Returns:
Type | Description |
---|---|
int
|
Schedule run's ID |
Source code in adalib/schedules/schedules.py
stop_run ¶
Stop a specific run of a notebook schedule.
Use the example Jupyter Notebook to test this function or build upon it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id |
int
|
The schedule's ID. |
required |
run_id |
int
|
The run's ID. |
required |
Returns:
Type | Description |
---|---|
None
|
Nothing. |