-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add async methods to AbstractEngine and AbstractJob #5555
Conversation
8d70ffc
to
2a36c26
Compare
2a36c26
to
d12b0ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few formatting nits and docstring requests, but the overall change seems reasonable.
cirq-core/cirq/work/sampler.py
Outdated
) -> Sequence[Sequence['cirq.Result']]: | ||
"""Runs the supplied circuits. | ||
|
||
This is an asynchronous version of `run_batch`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document args / return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea here was just to refer to run_batch
rather than repeat the same docs here. I've added a note to make this more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems OK since these are on the same page in the docs site. Would be nice if we could link, but I'm not 100% certain whether cirq.Sampler.run_batch
would auto-link properly with the tfdocs tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Up to you if you want to try linking with cirq.Sampler.run_batch
.
Gonna go ahead and merge. I'll follow up with doc fixes if I can figure out how to get code references to render as links. |
Follow-up to #5555 to fix docs.
Follow-up to quantumlib#5555 to fix docs.
Follow-up to quantumlib#5555 to fix docs.
This adds abstract async
run_*
methods toAbstractEngine
,AbstractProcessor
, andAbstractJob
, withduet.sync
wrappers to preserve the current sync API. This requires a new version of duet to supportduet.sync
on abstract methods.Also modified the underlying
cirq.Sampler
base class to support either implementingrun_sweep
in terms ofrun_sweep_async
or the other way around, depending on whether the underlying sampler supports asynchrony with futures, e.g. if it makes calls to a remote service.