27
27
import enum
28
28
import random
29
29
import string
30
- from typing import Dict , List , Optional , Sequence , Set , TypeVar , Union , TYPE_CHECKING
30
+ from typing import Dict , List , Optional , Set , TypeVar , Union , TYPE_CHECKING
31
31
32
32
import duet
33
33
import google .auth
@@ -210,21 +210,19 @@ def __init__(
210
210
def __str__ (self ) -> str :
211
211
return f'Engine(project_id={ self .project_id !r} )'
212
212
213
- # TODO(#6271): Deprecate and remove processor_ids before v1.4
214
213
def run (
215
214
self ,
216
215
program : cirq .AbstractCircuit ,
216
+ processor_id : str ,
217
217
program_id : Optional [str ] = None ,
218
218
job_id : Optional [str ] = None ,
219
219
param_resolver : cirq .ParamResolver = cirq .ParamResolver ({}),
220
220
repetitions : int = 1 ,
221
- processor_ids : Sequence [str ] = ('xmonsim' ,),
222
221
program_description : Optional [str ] = None ,
223
222
program_labels : Optional [Dict [str , str ]] = None ,
224
223
job_description : Optional [str ] = None ,
225
224
job_labels : Optional [Dict [str , str ]] = None ,
226
225
* ,
227
- processor_id : str = "" ,
228
226
run_name : str = "" ,
229
227
device_config_name : str = "" ,
230
228
) -> cirq .Result :
@@ -244,15 +242,11 @@ def run(
244
242
and day.
245
243
param_resolver: Parameters to run with the program.
246
244
repetitions: The number of repetitions to simulate.
247
- processor_ids: Deprecated list of candidate processor ids to run the program.
248
- Only allowed to contain one processor_id. If the argument `processor_id`
249
- is non-empty, `processor_ids` will be ignored.
250
245
program_description: An optional description to set on the program.
251
246
program_labels: Optional set of labels to set on the program.
252
247
job_description: An optional description to set on the job.
253
248
job_labels: Optional set of labels to set on the job.
254
- processor_id: Processor id for running the program. If not set,
255
- `processor_ids` will be used.
249
+ processor_id: Processor id for running the program.
256
250
run_name: A unique identifier representing an automation run for the
257
251
specified processor. An Automation Run contains a collection of
258
252
device configurations for a processor. If specified, `processor_id`
@@ -267,9 +261,7 @@ def run(
267
261
268
262
Raises:
269
263
ValueError: If no gate set is provided.
270
- ValueError: If neither `processor_id` or `processor_ids` are set.
271
264
ValueError: If only one of `run_name` and `device_config_name` are specified.
272
- ValueError: If `processor_ids` has more than one processor id.
273
265
ValueError: If either `run_name` and `device_config_name` are set but
274
266
`processor_id` is empty.
275
267
"""
@@ -280,32 +272,29 @@ def run(
280
272
job_id = job_id ,
281
273
params = [param_resolver ],
282
274
repetitions = repetitions ,
283
- processor_ids = processor_ids ,
275
+ processor_id = processor_id ,
284
276
program_description = program_description ,
285
277
program_labels = program_labels ,
286
278
job_description = job_description ,
287
279
job_labels = job_labels ,
288
- processor_id = processor_id ,
289
280
run_name = run_name ,
290
281
device_config_name = device_config_name ,
291
282
)
292
283
)[0 ]
293
284
294
- # TODO(#6271): Deprecate and remove processor_ids before v1.4
295
285
async def run_sweep_async (
296
286
self ,
297
287
program : cirq .AbstractCircuit ,
288
+ processor_id : str ,
298
289
program_id : Optional [str ] = None ,
299
290
job_id : Optional [str ] = None ,
300
291
params : cirq .Sweepable = None ,
301
292
repetitions : int = 1 ,
302
- processor_ids : Sequence [str ] = ('xmonsim' ,),
303
293
program_description : Optional [str ] = None ,
304
294
program_labels : Optional [Dict [str , str ]] = None ,
305
295
job_description : Optional [str ] = None ,
306
296
job_labels : Optional [Dict [str , str ]] = None ,
307
297
* ,
308
- processor_id : str = "" ,
309
298
run_name : str = "" ,
310
299
device_config_name : str = "" ,
311
300
) -> engine_job .EngineJob :
@@ -328,15 +317,11 @@ async def run_sweep_async(
328
317
and day.
329
318
params: Parameters to run with the program.
330
319
repetitions: The number of circuit repetitions to run.
331
- processor_ids: Deprecated list of candidate processor ids to run the program.
332
- Only allowed to contain one processor_id. If the argument `processor_id`
333
- is non-empty, `processor_ids` will be ignored.
334
320
program_description: An optional description to set on the program.
335
321
program_labels: Optional set of labels to set on the program.
336
322
job_description: An optional description to set on the job.
337
323
job_labels: Optional set of labels to set on the job.
338
- processor_id: Processor id for running the program. If not set,
339
- `processor_ids` will be used.
324
+ processor_id: Processor id for running the program.
340
325
run_name: A unique identifier representing an automation run for the
341
326
specified processor. An Automation Run contains a collection of
342
327
device configurations for a processor. If specified, `processor_id`
@@ -352,22 +337,12 @@ async def run_sweep_async(
352
337
353
338
Raises:
354
339
ValueError: If no gate set is provided.
355
- ValueError: If neither `processor_id` or `processor_ids` are set.
356
340
ValueError: If only one of `run_name` and `device_config_name` are specified.
357
- ValueError: If `processor_ids` has more than one processor id.
358
341
ValueError: If either `run_name` and `device_config_name` are set but
359
342
`processor_id` is empty.
360
343
"""
361
344
362
345
if self .context .enable_streaming :
363
- # This logic is temporary prior to deprecating the processor_ids parameter.
364
- # TODO(#6271) Remove after deprecating processor_ids elsewhere prior to v1.4.
365
- if processor_ids :
366
- if len (processor_ids ) > 1 :
367
- raise ValueError ("The use of multiple processors is no longer supported." )
368
- if len (processor_ids ) == 1 and not processor_id :
369
- processor_id = processor_ids [0 ]
370
-
371
346
if not program_id :
372
347
program_id = _make_random_id ('prog-' )
373
348
if not job_id :
@@ -403,10 +378,9 @@ async def run_sweep_async(
403
378
job_id = job_id ,
404
379
params = params ,
405
380
repetitions = repetitions ,
406
- processor_ids = processor_ids ,
381
+ processor_id = processor_id ,
407
382
description = job_description ,
408
383
labels = job_labels ,
409
- processor_id = processor_id ,
410
384
run_name = run_name ,
411
385
device_config_name = device_config_name ,
412
386
)
0 commit comments