This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Validate and load packages for Azure execution targets #152
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
89282df
Updates to IQ# syntax highlighting
rmshaffer f53eb9c
Validate targets and load provider packages
rmshaffer 75a8e35
Update Python interface for Azure commands
rmshaffer 1787ea4
Merge branch 'feature/azure-client' into rmshaffer/azure-targets
rmshaffer 52098e6
Simplify AzureExecutionTarget class
rmshaffer a33a2c9
Changes for JobNotCompleted case
rmshaffer d47fddd
Simplify property syntax
5215155
Add simple tests for AzureExecutionTarget class
rmshaffer c63a006
Add status message while loading provider package
rmshaffer 1c7d83f
Merge branch 'feature/azure-client' into rmshaffer/azure-targets
rmshaffer 944cec0
Merge branch 'feature/azure-client' into rmshaffer/azure-targets
rmshaffer b8e680b
Merge branch 'feature/azure-client' into rmshaffer/azure-targets
rmshaffer 43c07ae
Add documentation to AzureExecutionTarget.GetProvider
rmshaffer 2552632
Merge branch 'feature/azure-client' into rmshaffer/azure-targets
rmshaffer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable enable | ||
|
|
||
| using System; | ||
|
|
||
| namespace Microsoft.Quantum.IQSharp.AzureClient | ||
| { | ||
| internal enum AzureProvider { IonQ, Honeywell, QCI } | ||
|
|
||
| internal class AzureExecutionTarget | ||
| { | ||
| public string TargetName { get; private set; } | ||
| public string PackageName => $"Microsoft.Quantum.Providers.{GetProvider(TargetName)}"; | ||
|
|
||
| public static bool IsValid(string targetName) => GetProvider(targetName) != null; | ||
|
|
||
| public static AzureExecutionTarget? Create(string targetName) => | ||
| IsValid(targetName) | ||
| ? new AzureExecutionTarget() { TargetName = targetName } | ||
| : null; | ||
|
|
||
| /// <summary> | ||
| /// Gets the Azure Quantum provider corresponding to the given execution target. | ||
| /// </summary> | ||
| /// <param name="targetName">The Azure Quantum execution target name.</param> | ||
| /// <returns>The <see cref="AzureProvider"/> enum value representing the provider.</returns> | ||
| /// <remarks> | ||
| /// Valid target names are structured as "provider.target". | ||
| /// For example, "ionq.simulator" or "honeywell.qpu". | ||
| /// </remarks> | ||
| private static AzureProvider? GetProvider(string targetName) | ||
cesarzc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| var parts = targetName.Split('.', 2); | ||
| if (Enum.TryParse(parts[0], true, out AzureProvider provider)) | ||
| { | ||
| return provider; | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.