Skip to content

bloqade.analog.ir.routine.quera.CustomSubmissionRoutine

← Module overview

classCustomSubmissionRoutinesource

bloqade.analog.ir.routine.quera.CustomSubmissionRoutine

Bases: RoutineBase

class CustomSubmissionRoutine

Attributes

NameTypeDefaultDescription
RemoteTaskType—TypeVar('RemoteTaskType', bound=CustomRemoteTaskABC)

methodsubmitsource

bloqade.analog.ir.routine.quera.CustomSubmissionRoutine.submit

Signature
def submit(shots: int, url: str, json_body_template: str, method: str = 'POST', args: Tuple[LiteralType] = (), request_options: Dict[str, Any] = {}, use_experimental: bool = False, sleep_time: float = 0.1) -> List[Tuple[NamedTuple, Response]]

Compile to QuEraTaskSpecification and submit to a custom service.

>>> body_template = "{{"token": "my_token", "task": {task_ir}}}"
>>> responses = (
program.quera.custom.submit(
100,
"http://my_custom_service.com",
body_template
)
)

Parameters

NameTypeDefaultDescription
shotsintrequirednumber of shots
urlstrrequiredurl of the custom service
json_body_templatestrrequiredjson body template, must contain '{task_ir}'
methodstr'POST'http method to be used. Defaults to "POST".
argsTuple[LiteralType]()additional arguments to be passed into the
request_optionsDict[str, Any]{}additional options to be passed into the request method,
use_experimentalboolFalseEnable experimental hardware capabilities
sleep_timefloat0.1time to sleep between each request. Defaults to 0.1.

Returns

(List[Tuple[NamedTuple, Response]], List[Tuple[NamedTuple, Response]])List of parameters for each batch in the task and the response from the post request.

Examples

Here is a simple example of how to use this method. Note the body_template has double curly braces on the outside to escape the string formatting.

source

methodrun_asyncsource

bloqade.analog.ir.routine.quera.CustomSubmissionRoutine.run_async

Signature
def run_async(shots: int, RemoteTask: type[RemoteTaskType], args: Tuple[LiteralType, ...] = (), name: Optional[str] = None, use_experimental: bool = False, shuffle: bool = False, **kwargs={}) -> RemoteBatch

Compile to a RemoteBatch, which contain QuEra backend specific tasks, and run_async through QuEra service.

Parameters

NameTypeDefaultDescription
shotsintrequirednumber of shots
RemoteTasktype[RemoteTaskType]required
argsTuple[LiteralType, ...]()additional arguments
nameOptional[str]Nonecustom name of the batch
use_experimentalboolFalse
shuffleboolFalseshuffle the order of jobs
**kwargs—{}

Returns

RemoteBatch

Return

RemoteBatch

source

methodrunsource

bloqade.analog.ir.routine.quera.CustomSubmissionRoutine.run

Signature
def run(shots: int, RemoteTask: type[RemoteTaskType], args: Tuple[LiteralType, ...] = (), name: Optional[str] = None, use_experimental: bool = False, shuffle: bool = False, **kwargs={}) -> RemoteBatch

Run the custom task and return the result.

Parameters

NameTypeDefaultDescription
shotsintrequirednumber of shots
RemoteTasktype[RemoteTaskType]requiredtype of the remote task, must subclass of CustomRemoteTaskABC
argsTuple[LiteralType, ...]()additional arguments for remaining un
nameOptional[str]Nonename of the batch object
use_experimentalboolFalse
shuffleboolFalseshuffle the order of jobs
**kwargs—{}

Returns

RemoteBatch

source