Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Azure/Azure.Quantum.Client/Machine/QuantumMachineFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable enable

using System;
using Microsoft.Quantum.Runtime;

Expand All @@ -13,9 +15,10 @@ public static class QuantumMachineFactory
/// </summary>
/// <param name="workspace">The Azure Quantum workspace.</param>
/// <param name="targetName">The execution target for job submission.</param>
/// <param name="storageAccountConnectionString">The connection string for the Azure storage account.</param>
/// <param name="storageConnectionString">The connection string for the Azure storage account.</param>
/// <returns>A quantum machine for job submission targeting <c>targetName</c>.</returns>
public static IQuantumMachine? CreateMachine(IWorkspace workspace, string targetName, string storageAccountConnectionString)
public static IQuantumMachine? CreateMachine(
IWorkspace workspace, string targetName, string? storageConnectionString = null)
{
var machineName =
targetName is null
Expand All @@ -26,7 +29,7 @@ targetName is null
? "Microsoft.Quantum.Providers.Honeywell.Targets.HoneywellQuantumMachine, Microsoft.Quantum.Providers.Honeywell"
: null;

Type machineType = null;
Type? machineType = null;
if (machineName != null)
{
// First try to load the signed assembly with the correct version, then try the unsigned one.
Expand All @@ -48,7 +51,7 @@ targetName is null
machineType,
targetName,
workspace,
storageAccountConnectionString);
storageConnectionString);
}
}
}
}
10 changes: 5 additions & 5 deletions src/Simulation/EntryPointDriver.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ let private testWith testNum defaultSimulator =
/// Standard command-line arguments for the "submit" command without specifying a target.
let private submitWithoutTarget =
[ "submit"
"--storage"
"myStorage"
"--subscription"
"mySubscription"
"--resource-group"
Expand Down Expand Up @@ -550,10 +548,10 @@ let ``Submit uses default values`` () =
given (submitWithNothingTarget @ ["--verbose"])
|> yields "The friendly URI for viewing job results is not available yet. Showing the job ID instead.
Target: test.nothing
Storage: myStorage
Subscription: mySubscription
Resource Group: myResourceGroup
Workspace: myWorkspace
Storage:
AAD Token:
Base URI:
Job Name:
Expand All @@ -569,6 +567,8 @@ let ``Submit allows overriding default values`` () =
let given = test 1
given (submitWithNothingTarget @ [
"--verbose"
"--storage"
"myStorage"
"--aad-token"
"myToken"
"--base-uri"
Expand All @@ -580,10 +580,10 @@ let ``Submit allows overriding default values`` () =
])
|> yields "The friendly URI for viewing job results is not available yet. Showing the job ID instead.
Target: test.nothing
Storage: myStorage
Subscription: mySubscription
Resource Group: myResourceGroup
Workspace: myWorkspace
Storage: myStorage
AAD Token: myToken
Base URI: myBaseUri
Job Name: myJobName
Expand Down Expand Up @@ -686,10 +686,10 @@ let ``Shows help text for submit command`` () =

Options:
--target <target> (REQUIRED) The target device ID.
--storage <storage> (REQUIRED) The storage account connection string.
--subscription <subscription> (REQUIRED) The subscription ID.
--resource-group <resource-group> (REQUIRED) The resource group name.
--workspace <workspace> (REQUIRED) The workspace name.
--storage <storage> The storage account connection string.
--aad-token <aad-token> The Azure Active Directory authentication token.
--base-uri <base-uri> The base URI of the Azure Quantum endpoint.
--job-name <job-name> The name of the submitted job.
Expand Down
12 changes: 6 additions & 6 deletions src/Simulation/EntryPointDriver/Azure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ internal sealed class AzureSettings
/// </summary>
public string? Target { get; set; }

/// <summary>
/// The storage account connection string.
/// </summary>
public string? Storage { get; set; }

/// <summary>
/// The subscription ID.
/// </summary>
Expand All @@ -215,6 +210,11 @@ internal sealed class AzureSettings
/// </summary>
public string? Workspace { get; set; }

/// <summary>
/// The storage account connection string.
/// </summary>
public string? Storage { get; set; }

/// <summary>
/// The Azure Active Directory authentication token.
/// </summary>
Expand Down Expand Up @@ -262,10 +262,10 @@ AadToken is null
public override string ToString() =>
string.Join(System.Environment.NewLine,
$"Target: {Target}",
$"Storage: {Storage}",
$"Subscription: {Subscription}",
$"Resource Group: {ResourceGroup}",
$"Workspace: {Workspace}",
$"Storage: {Storage}",
$"AAD Token: {AadToken}",
$"Base URI: {BaseUri}",
$"Job Name: {JobName}",
Expand Down
16 changes: 8 additions & 8 deletions src/Simulation/EntryPointDriver/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public async Task<int> Run(string[] args)
Handler = CommandHandler.Create<ParseResult, AzureSettings>(Submit)
};
AddOptionIfAvailable(submit, TargetOption);
AddOptionIfAvailable(submit, StorageOption);
AddOptionIfAvailable(submit, SubscriptionOption);
AddOptionIfAvailable(submit, ResourceGroupOption);
AddOptionIfAvailable(submit, WorkspaceOption);
AddOptionIfAvailable(submit, StorageOption);
AddOptionIfAvailable(submit, AadTokenOption);
AddOptionIfAvailable(submit, BaseUriOption);
AddOptionIfAvailable(submit, JobNameOption);
Expand Down Expand Up @@ -133,10 +133,10 @@ private async Task<int> Submit(ParseResult parseResult, AzureSettings azureSetti
await Azure.Submit(entryPoint, parseResult, new AzureSettings
{
Target = azureSettings.Target,
Storage = azureSettings.Storage,
Subscription = azureSettings.Subscription,
ResourceGroup = azureSettings.ResourceGroup,
Workspace = azureSettings.Workspace,
Storage = DefaultIfShadowed(StorageOption, azureSettings.Storage),
AadToken = DefaultIfShadowed(AadTokenOption, azureSettings.AadToken),
BaseUri = DefaultIfShadowed(BaseUriOption, azureSettings.BaseUri),
JobName = DefaultIfShadowed(JobNameOption, azureSettings.JobName),
Expand Down Expand Up @@ -211,12 +211,6 @@ internal static class Driver
internal static readonly OptionInfo<string> TargetOption = new OptionInfo<string>(
ImmutableList.Create("--target"), "The target device ID.");

/// <summary>
/// The storage option.
/// </summary>
internal static readonly OptionInfo<string> StorageOption = new OptionInfo<string>(
ImmutableList.Create("--storage"), "The storage account connection string.");

/// <summary>
/// The subscription option.
/// </summary>
Expand All @@ -235,6 +229,12 @@ internal static class Driver
internal static readonly OptionInfo<string> WorkspaceOption = new OptionInfo<string>(
ImmutableList.Create("--workspace"), "The workspace name.");

/// <summary>
/// The storage option.
/// </summary>
internal static readonly OptionInfo<string?> StorageOption = new OptionInfo<string?>(
ImmutableList.Create("--storage"), default, "The storage account connection string.");

/// <summary>
/// The AAD token option.
/// </summary>
Expand Down