Skip to content

Commit

Permalink
Update batch.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhusion committed Jun 3, 2024
1 parent 8fb631a commit c30b9f1
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/bloqade/task/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
`RemoteBatch`, which handle task execution, reporting, and error management.
"""

import os
import warnings
from decimal import Decimal
from numbers import Real
from collections import OrderedDict
Expand All @@ -13,12 +15,12 @@
import datetime
import sys
from dataclasses import dataclass, field
from typing import Literal
import pandas as pd
import numpy as np

from beartype.typing import Union, Optional, Dict, Any, List
from beartype import beartype
from typing import Literal
from bloqade.builder.typing import LiteralType
from bloqade.serialize import Serializer
from bloqade.task.base import Report
Expand All @@ -32,6 +34,7 @@
from bloqade.submission.ir.task_results import (
QuEraShotStatusCode,
QuEraTaskStatusCode,
QuEraTaskResults,
)

# from bloqade.submission.base import ValidationError
Expand Down Expand Up @@ -229,10 +232,12 @@ def _run(
Private method to run tasks in the batch.
Args:
multiprocessing (bool, optional): If True, tasks are run in parallel using multiple processes.
If False, tasks are run sequentially in a single process. Defaults to False.
num_workers (Optional[int], optional): 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.
multiprocessing (bool, optional):
If True, tasks are run in parallel using multiple processes.
If False, tasks are run sequentially in a single process. Defaults to False.
num_workers (Optional[int], optional): 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.
**kwargs: Arbitrary keyword arguments passed to the task's run method.
Raises:
Expand Down Expand Up @@ -361,9 +366,6 @@ class RemoteBatch(Filter):
)
_resolved_at: Optional[str] = None


def report(self) -> Report:

class SubmissionException(Exception):
pass

Expand Down Expand Up @@ -517,9 +519,13 @@ def _submit(
Args:
shuffle_submit_order (bool, optional): 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.
ignore_submission_error (bool, optional): 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.
If False, tasks are submitted in the order they were added to the batch.
Defaults to True.
ignore_submission_error (bool, optional):
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.
**kwargs: Arbitrary keyword arguments.
Returns:
Expand Down Expand Up @@ -811,7 +817,7 @@ def resolve(self):
for task_number, task in self.tasks.items():
try:
result = task.result()
if result.status == QuEraTaskStatusCode.Complete:
if result.status == QuEraTaskStatusCode.Completed:
continue

if not result or (
Expand Down

0 comments on commit c30b9f1

Please sign in to comment.