Batch
Filter
filter_metadata
filter_metadata(
__match_any__: bool = False,
**metadata: MetadataFilterType
) -> Union[LocalBatch, RemoteBatch]
Create a Batch object that has tasks filtered based on the values of metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
__match_any__
|
bool
|
if True, then a task will be included if it matches any of the metadata filters. If False, then a task will be included only if it matches all of the metadata filters. Defaults to False. |
False
|
**metadata
|
MetadataFilterType
|
the metadata to filter on. The keys are the metadata names and the values (as a set) are the values to filter on. The elements in the set can be Real, Decimal, Tuple[Real], or Tuple[Decimal]. |
{}
|
Return
type(self): a Batch object with the filtered tasks, either LocalBatch or RemoteBatch depending on the type of self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
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 |
|
LocalBatch
dataclass
LocalBatch(
source: Optional[Builder],
tasks: OrderedDict[
int, Union[BraketEmulatorTask, BloqadeTask]
],
name: Optional[str] = None,
)
Bases: Serializable
, Filter
report
report() -> Report
Generate analysis report base on currently completed tasks in the LocalBatch.
Return
Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.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 |
|
rerun
rerun(
multiprocessing: bool = False,
num_workers: Optional[int] = None,
**kwargs
)
Rerun all the tasks in the LocalBatch.
Return
Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
RemoteBatch
dataclass
RemoteBatch(
source: Builder,
tasks: Union[
OrderedDict[int, QuEraTask],
OrderedDict[int, BraketTask],
OrderedDict[int, CustomRemoteTaskABC],
],
name: Optional[str] = None,
)
Bases: Serializable
, Filter
total_nshots
property
total_nshots
Total number of shots of all tasks in the RemoteBatch
Return
number of shots
cancel
cancel() -> RemoteBatch
Cancel all the tasks in the Batch.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
fetch
fetch() -> RemoteBatch
Fetch the tasks in the Batch.
Note
Fetching will update the status of tasks, and only pull the results for those tasks that have completed.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
get_completed_tasks
get_completed_tasks() -> RemoteBatch
Create a RemoteBatch object that contain completed tasks from current Batch.
Tasks consider completed with following status codes:
- Completed
- Partial
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
|
get_failed_tasks
get_failed_tasks() -> RemoteBatch
Create a RemoteBatch object that contain failed tasks from current Batch.
failed tasks with following status codes:
- Failed
- Unaccepted
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
|
get_finished_tasks
get_finished_tasks() -> RemoteBatch
Create a RemoteBatch object that contain finished tasks from current Batch.
Tasks consider finished with following status codes:
- Failed
- Unaccepted
- Completed
- Partial
- Cancelled
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 |
|
get_tasks
get_tasks(*status_codes: str) -> RemoteBatch
Get Tasks with specify status_codes.
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
|
pull
pull() -> RemoteBatch
Pull results of the tasks in the Batch.
Note
Pulling will pull the results for the tasks. If a given task(s) has not been completed, wait until it finished.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
remove_failed_tasks
remove_failed_tasks() -> RemoteBatch
Create a RemoteBatch object that contain tasks from current Batch, with failed tasks removed.
failed tasks with following status codes:
- Failed
- Unaccepted
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
|
remove_invalid_tasks
remove_invalid_tasks() -> RemoteBatch
Create a RemoteBatch object that contain tasks from current Batch, with all Unaccepted tasks removed.
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
461 462 463 464 465 466 467 468 469 470 471 |
|
remove_tasks
remove_tasks(
*status_codes: Literal[
"Created",
"Running",
"Completed",
"Failed",
"Cancelled",
"Executing",
"Enqueued",
"Accepted",
"Unaccepted",
"Partial",
"Unsubmitted",
]
) -> RemoteBatch
Remove Tasks with specify status_codes.
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
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 |
|
report
report() -> Report
Generate analysis report base on currently completed tasks in the RemoteBatch.
Return
Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
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 802 803 804 805 |
|
resubmit
resubmit(shuffle_submit_order: bool = True) -> RemoteBatch
Resubmit all the tasks in the RemoteBatch
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
475 476 477 478 479 480 481 482 483 484 485 486 |
|
retrieve
retrieve() -> RemoteBatch
Retrieve missing task results.
Note
Retrieve will update the status of tasks, and only pull the results for those tasks that have completed.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
tasks_metric
tasks_metric() -> pd.DataFrame
Get current tasks status metric
Return
dataframe with ["task id", "status", "shots"]
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
|
Serializable
json
json(**options) -> str
Serialize the object to JSON string.
Return
JSON string
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
37 38 39 40 41 42 43 44 45 46 47 |
|