2727import enum
2828import random
2929import 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
3131
3232import duet
3333import google .auth
@@ -210,21 +210,19 @@ def __init__(
210210 def __str__ (self ) -> str :
211211 return f'Engine(project_id={ self .project_id !r} )'
212212
213- # TODO(#6271): Deprecate and remove processor_ids before v1.4
214213 def run (
215214 self ,
216215 program : cirq .AbstractCircuit ,
216+ processor_id : str ,
217217 program_id : Optional [str ] = None ,
218218 job_id : Optional [str ] = None ,
219219 param_resolver : cirq .ParamResolver = cirq .ParamResolver ({}),
220220 repetitions : int = 1 ,
221- processor_ids : Sequence [str ] = ('xmonsim' ,),
222221 program_description : Optional [str ] = None ,
223222 program_labels : Optional [Dict [str , str ]] = None ,
224223 job_description : Optional [str ] = None ,
225224 job_labels : Optional [Dict [str , str ]] = None ,
226225 * ,
227- processor_id : str = "" ,
228226 run_name : str = "" ,
229227 device_config_name : str = "" ,
230228 ) -> cirq .Result :
@@ -244,15 +242,11 @@ def run(
244242 and day.
245243 param_resolver: Parameters to run with the program.
246244 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.
250245 program_description: An optional description to set on the program.
251246 program_labels: Optional set of labels to set on the program.
252247 job_description: An optional description to set on the job.
253248 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.
256250 run_name: A unique identifier representing an automation run for the
257251 specified processor. An Automation Run contains a collection of
258252 device configurations for a processor. If specified, `processor_id`
@@ -267,9 +261,7 @@ def run(
267261
268262 Raises:
269263 ValueError: If no gate set is provided.
270- ValueError: If neither `processor_id` or `processor_ids` are set.
271264 ValueError: If only one of `run_name` and `device_config_name` are specified.
272- ValueError: If `processor_ids` has more than one processor id.
273265 ValueError: If either `run_name` and `device_config_name` are set but
274266 `processor_id` is empty.
275267 """
@@ -280,32 +272,29 @@ def run(
280272 job_id = job_id ,
281273 params = [param_resolver ],
282274 repetitions = repetitions ,
283- processor_ids = processor_ids ,
275+ processor_id = processor_id ,
284276 program_description = program_description ,
285277 program_labels = program_labels ,
286278 job_description = job_description ,
287279 job_labels = job_labels ,
288- processor_id = processor_id ,
289280 run_name = run_name ,
290281 device_config_name = device_config_name ,
291282 )
292283 )[0 ]
293284
294- # TODO(#6271): Deprecate and remove processor_ids before v1.4
295285 async def run_sweep_async (
296286 self ,
297287 program : cirq .AbstractCircuit ,
288+ processor_id : str ,
298289 program_id : Optional [str ] = None ,
299290 job_id : Optional [str ] = None ,
300291 params : cirq .Sweepable = None ,
301292 repetitions : int = 1 ,
302- processor_ids : Sequence [str ] = ('xmonsim' ,),
303293 program_description : Optional [str ] = None ,
304294 program_labels : Optional [Dict [str , str ]] = None ,
305295 job_description : Optional [str ] = None ,
306296 job_labels : Optional [Dict [str , str ]] = None ,
307297 * ,
308- processor_id : str = "" ,
309298 run_name : str = "" ,
310299 device_config_name : str = "" ,
311300 ) -> engine_job .EngineJob :
@@ -328,15 +317,11 @@ async def run_sweep_async(
328317 and day.
329318 params: Parameters to run with the program.
330319 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.
334320 program_description: An optional description to set on the program.
335321 program_labels: Optional set of labels to set on the program.
336322 job_description: An optional description to set on the job.
337323 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.
340325 run_name: A unique identifier representing an automation run for the
341326 specified processor. An Automation Run contains a collection of
342327 device configurations for a processor. If specified, `processor_id`
@@ -352,22 +337,12 @@ async def run_sweep_async(
352337
353338 Raises:
354339 ValueError: If no gate set is provided.
355- ValueError: If neither `processor_id` or `processor_ids` are set.
356340 ValueError: If only one of `run_name` and `device_config_name` are specified.
357- ValueError: If `processor_ids` has more than one processor id.
358341 ValueError: If either `run_name` and `device_config_name` are set but
359342 `processor_id` is empty.
360343 """
361344
362345 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-
371346 if not program_id :
372347 program_id = _make_random_id ('prog-' )
373348 if not job_id :
@@ -403,10 +378,9 @@ async def run_sweep_async(
403378 job_id = job_id ,
404379 params = params ,
405380 repetitions = repetitions ,
406- processor_ids = processor_ids ,
381+ processor_id = processor_id ,
407382 description = job_description ,
408383 labels = job_labels ,
409- processor_id = processor_id ,
410384 run_name = run_name ,
411385 device_config_name = device_config_name ,
412386 )
0 commit comments