Conversation
Introduce `merge` method to `ProgramSetQuantumTaskResult` that combines multiple results into one.
|
If this is approved before #1249, we can merge this cleanly into the |
| return num_ps * num_obs | ||
|
|
||
|
|
||
| def _buffer_result( |
There was a problem hiding this comment.
Can we add a description to this function? The other ones are straightforward but this has more complexity and _buffer_result is a bit vague.
And other minor changes
| start = 0 | ||
| for binding_idx, binding in enumerate(program_set.entries): | ||
| count = _count_executables(binding) | ||
| program = programs[binding_idx] |
There was a problem hiding this comment.
Why don't we just calculate the ir on the fly here? I.e. _binding_to_program(binding)? Feel like you don't need programs variable above.
| for b in program_set.entries | ||
| ], | ||
| deviceParameters=None, # TODO: find a way to fill this in | ||
| createdAt=min(m.createdAt for m in metas if m.createdAt), |
There was a problem hiding this comment.
This apparently fails on local sim, i.e. when this list is empty?
ValueError: min() iterable argument is empty
There was a problem hiding this comment.
This is only really intended for AwsDevice; the local simulator doesn't actually need splitting
There was a problem hiding this comment.
Hm....it might still be nice for validating / emulator usage, or use in other routines? Is it easy enough to catch?
| ], | ||
| deviceParameters=None, # TODO: find a way to fill this in | ||
| createdAt=min(m.createdAt for m in metas if m.createdAt), | ||
| endedAt=max(m.endedAt for m in metas if m.endedAt), |
Introduce
mergemethod toProgramSetQuantumTaskResultthat combines multiple results into one.Issue #, if available:
Description of changes:
Testing done:
Merge Checklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.