Batch
Filter ¶
filter_metadata ¶
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 src/bloqade/analog/task/batch.py
LocalBatch dataclass
¶
Bases: Serializable
, Filter
_run ¶
Private method to run tasks in the batch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
multiprocessing | bool | If True, tasks are run in parallel using multiple processes. If False, tasks are run sequentially in a single process. Defaults to False. | False |
num_workers | Optional[int] | The maximum number of processes that can be used to execute the given calls if multiprocessing is True. If None, the number of workers will be the number of processors on the machine. | None |
**kwargs | Arbitrary keyword arguments passed to the task's run method. | {} |
Raises:
Type | Description |
---|---|
ValueError | If num_workers is not None and multiprocessing is False. |
Returns:
Name | Type | Description |
---|---|---|
self | The instance of the batch with tasks run. |
Source code in src/bloqade/analog/task/batch.py
report ¶
Generate analysis report base on currently completed tasks in the LocalBatch.
Return
Report
Source code in src/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 all the tasks in the LocalBatch.
Return
Report
Source code in src/bloqade/analog/task/batch.py
RemoteBatch dataclass
¶
Bases: Serializable
, Filter
total_nshots property
¶
Total number of shots of all tasks in the RemoteBatch
Return
number of shots
_submit ¶
Private method to submit tasks in the RemoteBatch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shuffle_submit_order | bool | If True, tasks are submitted in a random order. If False, tasks are submitted in the order they were added to the batch. Defaults to True. | True |
ignore_submission_error | bool | If True, submission errors are ignored and the method continues to submit the remaining tasks. If False, the method stops at the first submission error. Defaults to False. | False |
**kwargs | Arbitrary keyword arguments. | {} |
Returns:
Name | Type | Description |
---|---|---|
RemoteBatch | RemoteBatch | The RemoteBatch instance with tasks submitted. |
Source code in src/bloqade/analog/task/batch.py
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 |
|
cancel ¶
Cancel all the tasks in the Batch.
Return
self
fetch ¶
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 src/bloqade/analog/task/batch.py
get_completed_tasks ¶
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 src/bloqade/analog/task/batch.py
get_failed_tasks ¶
Create a RemoteBatch object that contain failed tasks from current Batch.
failed tasks with following status codes:
- Failed
- Unaccepted
Return
RemoteBatch
Source code in src/bloqade/analog/task/batch.py
get_finished_tasks ¶
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 src/bloqade/analog/task/batch.py
get_tasks ¶
Get Tasks with specify status_codes.
Return
RemoteBatch
Source code in src/bloqade/analog/task/batch.py
pull ¶
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 src/bloqade/analog/task/batch.py
remove_failed_tasks ¶
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 src/bloqade/analog/task/batch.py
remove_invalid_tasks ¶
Create a RemoteBatch object that contain tasks from current Batch, with all Unaccepted tasks removed.
Return
RemoteBatch
Source code in src/bloqade/analog/task/batch.py
remove_tasks ¶
Remove Tasks with specify status_codes.
Return
RemoteBatch
Source code in src/bloqade/analog/task/batch.py
report ¶
Generate analysis report base on currently completed tasks in the RemoteBatch.
Return
Report
Source code in src/bloqade/analog/task/batch.py
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 |
|
resubmit ¶
Resubmit all the tasks in the RemoteBatch
Return
self
Source code in src/bloqade/analog/task/batch.py
retrieve ¶
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 src/bloqade/analog/task/batch.py
tasks_metric ¶
Get current tasks status metric
Return
dataframe with ["task id", "status", "shots"]