Quera
CustomSubmissionRoutine
Bases: RoutineBase
run
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:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
RemoteTask
|
type
|
type of the remote task, must subclass of CustomRemoteTaskABC |
required |
args
|
Tuple
|
additional arguments for remaining un |
()
|
name
|
str
|
name of the batch object |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
run_async
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:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple
|
additional arguments |
()
|
name
|
str
|
custom name of the batch |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
submit
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
url
|
str
|
url of the custom service |
required |
json_body_template
|
str
|
json body template, must contain '{task_ir}' |
required |
method
|
str
|
http method to be used. Defaults to "POST". |
'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
|
Enable experimental hardware capabilities |
False
|
sleep_time
|
float
|
time to sleep between each request. Defaults to 0.1. |
0.1
|
Returns:
Type | Description |
---|---|
List[Tuple[NamedTuple, Response]]
|
List[Tuple[NamedTuple, Response]]: List of parameters for each batch in |
List[Tuple[NamedTuple, Response]]
|
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.
>>> body_template = "{{"token": "my_token", "task": {task_ir}}}"
>>> responses = (
program.quera.custom.submit(
100,
"http://my_custom_service.com",
body_template
)
)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 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 |
|
QuEraHardwareRoutine
Bases: RoutineBase
run_async
run_async(
shots: int,
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:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple
|
additional arguments |
()
|
name
|
str
|
custom name of the batch |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|