Skip to content

Workspace.get_targets() returns list of Targets - #125

Closed
Guen Prawiroatmodjo (guenp) wants to merge 9 commits into
mainfrom
guenp/get-targets-queue-time
Closed

Guen Prawiroatmodjo (guenp) wants to merge 9 commits into
mainfrom
guenp/get-targets-queue-time

Conversation

@guenp

@guenp Guen Prawiroatmodjo (guenp) commented Aug 12, 2021 •

Copy link
Copy Markdown
  • Workspace.get_targets returns list of available targets
  • Add target status info to Target
  • Add Target.refresh() method to update queue time/availability

Example usage:

[In]
# Get all workspace targets
workspace.get_targets()
[Out]
[<Target name="ionq.qpu", avg. queue time=5722 s, Available>,
 <Target name="ionq.simulator", avg. queue time=1 s, Available>,
 <Target name="honeywell.hqs-lt-s1", avg. queue time=0 s, Unavailable>,
 <Target name="honeywell.hqs-lt-s1-apival", avg. queue time=1 s, Available>,
 <Target name="honeywell.hqs-lt-s1-sim", avg. queue time=0 s, Available>]
[In]
# Get a single target
workspace.get_target("ionq.qpu")
[Out]
<Target name="ionq.qpu", avg. queue time=5722 s, Available>
# Refresh the queue time and availability
target.refresh()

@anpaz Andres Paz (anpaz) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to create a Target class instead of using a dict for the values returned by get_targets?

@guenp

Copy link
Copy Markdown
Author

Andres Paz (@anpaz), we already have a Target class (for the pass-through). We could indeed adapt that class to include the availability, queue time and status and return a list of instances. e.g.
workspace.get_targets() would return [<IonQ target="ionq.simulator">, <Honeywell target="honeywell.hqs-lt-s1-apival">, ...]

@guenp Guen Prawiroatmodjo (guenp) changed the title Add id, current_availability and average_queue_time to Workspace.get_targets Workspace.get_targets() returns list of Targets Aug 17, 2021
@guenp

Copy link
Copy Markdown
Author

Andres Paz (@anpaz) I made the changes we discussed. Note that for now, only QC targets are supported; QIO targets are not returned. If we want to support QIO targets or solvers we may want to create a follow up PR. Some options: 1. add a Workspace.get_solvers() method 2. create dedicated Microsoft target class with hard-coded input and output types 3. add a new API route (if it does not yet exist) that returns the valid input/output data formats and encoding info for a given provider/target and dynamically generate Targets.

@guenp

Copy link
Copy Markdown
Author

Closing this in favor of #129

@guenp
Guen Prawiroatmodjo (guenp) deleted the guenp/get-targets-queue-time branch August 20, 2021 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants