bloqade.analog.ir.routine.quera.CustomSubmissionRoutine
classCustomSubmissionRoutine¶source
bloqade.analog.ir.routine.quera.CustomSubmissionRoutine
Bases: RoutineBase
class CustomSubmissionRoutineAttributes
| Name | Type | Default | Description |
|---|---|---|---|
RemoteTaskType | — | TypeVar('RemoteTaskType', bound=CustomRemoteTaskABC) |
methodsubmit¶source
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
| Name | Type | Default | Description |
|---|---|---|---|
shots | int | required | number of shots |
url | str | required | url of the custom service |
json_body_template | str | required | json body template, must contain '{task_ir}' |
method | str | 'POST' | http method to be used. Defaults to "POST". |
args | Tuple[LiteralType] | () | additional arguments to be passed into the |
request_options | Dict[str, Any] | {} | additional options to be passed into the request method, |
use_experimental | bool | False | Enable experimental hardware capabilities |
sleep_time | float | 0.1 | time 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.
sourcemethodrun_async¶source
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={}) -> RemoteBatchCompile to a RemoteBatch, which contain QuEra backend specific tasks, and run_async through QuEra service.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
shots | int | required | number of shots |
RemoteTask | type[RemoteTaskType] | required | |
args | Tuple[LiteralType, ...] | () | additional arguments |
name | Optional[str] | None | custom name of the batch |
use_experimental | bool | False | |
shuffle | bool | False | shuffle the order of jobs |
**kwargs | — | {} |
Returns
RemoteBatch
Return
RemoteBatch
sourcemethodrun¶source
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={}) -> RemoteBatchRun the custom task and return the result.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
shots | int | required | number of shots |
RemoteTask | type[RemoteTaskType] | required | type of the remote task, must subclass of CustomRemoteTaskABC |
args | Tuple[LiteralType, ...] | () | additional arguments for remaining un |
name | Optional[str] | None | name of the batch object |
use_experimental | bool | False | |
shuffle | bool | False | shuffle the order of jobs |
**kwargs | — | {} |
Returns
RemoteBatch