Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@rmshaffer
Copy link
Contributor

@rmshaffer rmshaffer commented Jun 10, 2020

This PR contains no functional changes. It is purely refactoring of authentication and service calls out of the AzureClient class into the existing AzureEnvironment class and a new AzureWorkspace class that implements a new IAzureWorkspace interface.

In a subsequent PR, I plan to add AzureEnvironmentType.Mock, which will use a mock implementation of this new IAzureWorkspace interface. This should enable end-to-end integration testing of most of the functionality without any Azure dependency.

Fixes AB#15335, fixes AB#15316.

rmshaffer and others added 30 commits May 28, 2020 18:03
Co-authored-by: Chris Granade <chgranad@microsoft.com>
{
Logger?.LogError(e, $"Failed to download providers list from Azure Quantum workspace: {e.Message}");
return AzureClientError.WorkspaceNotFound.ToExecutionResult();
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be a different error, as there is a workspace...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we have created the "workspace" object on the client, but downloading the providers list is the first time we actually attempt to communicate with Azure Quantum. For example, if the user has mistyped the workspace name, this is the error they will see. The friendly string displayed is: "No Azure Quantum workspace was found that matches the specified criteria."

{
if (QuantumClient == null || AvailableProviders == null)
if (ActiveWorkspace == null || AvailableProviders == null)
{
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it's the right message that you can't connect to a workspace unless it has Q# providers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The behavior in this case is that the connection to the workspace will succeed, but there will simply be no valid targets to choose from. But it's a good point, and I'll add an output message to make this clear. It would still be possible, for example, to query the jobs list in this case.

using Microsoft.Azure.Quantum.Client;
using Microsoft.Identity.Client;
using Microsoft.Identity.Client.Extensions.Msal;
using Microsoft.Jupyter.Core;
Copy link
Member

Choose a reason for hiding this comment

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

This code looks great.
Wondering if we should move it to be part of the Azure.Quantum.Client package itself. Pretty much the same should be done wherever we try to call Azure Quantum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I had the same thought while I was writing it. There are a few Jupyter dependencies sprinkled in, and I want some of these abstractions in IQ# anyway in order to easily mock them, but a lot of this can and probably should be moved into Azure.Quantum.Client. I'll create a task for this.

Copy link
Member

@anpaz anpaz left a comment

Choose a reason for hiding this comment

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

:shipit:

Base automatically changed from rmshaffer/azure-jobsettings to feature/azure-client June 12, 2020 21:06
@rmshaffer rmshaffer merged commit fba06c9 into feature/azure-client Jun 12, 2020
@rmshaffer rmshaffer deleted the rmshaffer/azure-client-refactoring branch June 12, 2020 21:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants