diff --git a/docs/run/run-jobs-batch.mdx b/docs/run/run-jobs-batch.mdx index 15de86b4031..cc4d9b38e92 100644 --- a/docs/run/run-jobs-batch.mdx +++ b/docs/run/run-jobs-batch.mdx @@ -20,10 +20,18 @@ Batch mode can shorten processing time if all jobs can be provided at the outset The following example shows how you can divide up a long list of circuits into multiple jobs and run them as a batch to take advantage of the parallel processing. ```python +from qiskit_ibm_runtime import SamplerV2 as Sampler, Batch + +max_circuits = 100 +all_partitioned_circuits = [] +for i in range(0, len(circuits), max_circuits): + all_partitioned_circuits.append(circuits[i : i + max_circuits]) jobs = [] -with Batch(backend) as batch: - estimator = Estimator(batch) - # calls within this context are part of the batch. - for obs_set in observable_sets: - jobs.append(estimator.run(circuits, observables=obs_set)) +start_idx = 0 + +with Batch(backend=backend): + sampler = Sampler() + for partitioned_circuits in all_partitioned_circuits: + job = sampler.run(partitioned_circuits) + jobs.append(job) ```