From 1dcc7a2653cce091f94989716d34de7ec8b3b8f4 Mon Sep 17 00:00:00 2001 From: Roman Snytsar Date: Wed, 2 Dec 2020 07:54:05 -0800 Subject: [PATCH 01/20] C# QIO API --- Simulation.sln | 353 +++--------------- ...icrosoft.Azure.Quantum.Optimization.csproj | 16 + src/Azure/ShippingSample/Program.cs | 129 +++++++ .../ShippingSample/ShippingSample.csproj | 13 + src/Azure/ShippingSample/Workspace.cs | 22 ++ 5 files changed, 238 insertions(+), 295 deletions(-) create mode 100644 src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj create mode 100644 src/Azure/ShippingSample/Program.cs create mode 100644 src/Azure/ShippingSample/ShippingSample.csproj create mode 100644 src/Azure/ShippingSample/Workspace.cs diff --git a/Simulation.sln b/Simulation.sln index 9a65f34a9db..dca923850c5 100644 --- a/Simulation.sln +++ b/Simulation.sln @@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Sim EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simulation", "simulation", "{34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Core", "src\Simulation\QSharpCore\Microsoft.Quantum.QSharp.Core.csproj", "{A6C5BA7A-DF6F-476F-9106-95905932B810}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Core", "src\Simulation\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj", "{A6C5BA7A-DF6F-476F-9106-95905932B810}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xunit", "xunit", "{34117E2A-DEDC-4274-AAA4-3C61ACF86284}" EndProject @@ -27,17 +27,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Xunit", " EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generation", "generation", "{A567C185-A429-418B-AFDE-6F1785BA4A77}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.CSharpGeneration", "src\Simulation\CSharpGeneration.Tests\Tests.CSharpGeneration.fsproj", "{10D7C395-4F79-4DAF-9289-A4B8FAF6183A}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.CsharpGeneration", "src\Simulation\CsharpGeneration.Tests\Tests.CsharpGeneration.fsproj", "{10D7C395-4F79-4DAF-9289-A4B8FAF6183A}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.RoslynWrapper", "src\Simulation\RoslynWrapper\Microsoft.Quantum.RoslynWrapper.fsproj", "{618FBF9D-4EF3-435D-9728-81C726236668}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.RoslynWrapper", "src\Simulation\RoslynWrapper.Tests\Tests.RoslynWrapper.fsproj", "{48206BD6-48DD-4442-A395-3A6594E4C9C6}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.CSharpGeneration", "src\Simulation\CSharpGeneration\Microsoft.Quantum.CSharpGeneration.fsproj", "{B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.CsharpGeneration", "src\Simulation\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj", "{B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{09C842CB-930C-4C7D-AD5F-E30DE4A55820}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSharpExe", "src\Simulation\Simulators.Tests\TestProjects\QSharpExe\QSharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}" EndProject @@ -65,53 +65,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QCIExe", "src\Simulation\Si EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TargetedExe", "src\Simulation\Simulators.Tests\TestProjects\TargetedExe\TargetedExe.csproj", "{D292BF18-3956-4827-820E-254C3F81EF09}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Foundation", "src\Simulation\QSharpFoundation\Microsoft.Quantum.QSharp.Foundation.csproj", "{DB45AD73-4D91-43F3-85CC-C63614A96FB0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntrinsicTests", "src\Simulation\Simulators.Tests\TestProjects\IntrinsicTests\IntrinsicTests.csproj", "{D5D41201-101F-4C0D-B6A0-201D8FC3AB91}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Type2.Core", "src\Simulation\Type2Core\Microsoft.Quantum.Type2.Core.csproj", "{AF6CD304-8E03-433D-AAA2-6E0094B53071}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Optimization", "src\Azure\Azure.Quantum.Optimization\Microsoft.Azure.Quantum.Optimization.csproj", "{C8F4C061-3947-4448-97DD-C39C40C3999F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators.Type2", "src\Simulation\Simulators.Type2.Tests\Tests.Microsoft.Quantum.Simulators.Type2.csproj", "{ED3D7040-4B3F-4217-A75E-9DF63DD84707}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntrinsicTests", "src\Simulation\Simulators.Tests\TestProjects\IntrinsicTests\IntrinsicTests.csproj", "{4EF958CA-B4A6-4E5F-924A-100B5615BEC3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators.Type1", "src\Simulation\Simulators.Type1.Tests\Tests.Microsoft.Quantum.Simulators.Type1.csproj", "{EB6E3DBD-C884-4241-9BC4-8281191D1F53}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Type1.Core", "src\Simulation\Type1Core\Microsoft.Quantum.Type1.Core.csproj", "{E1A463D7-2E23-4134-BE04-1EFF7A546813}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "targeting", "targeting", "{93409CC3-8DF9-45FA-AE21-16A19FDEF650}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Targets.Interfaces", "src\Simulation\TargetDefinitions\Interfaces\Microsoft.Quantum.Targets.Interfaces.csproj", "{789C86D9-CE77-40DA-BDDD-979436952512}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Type3.Core", "src\Simulation\Type3Core\Microsoft.Quantum.Type3.Core.csproj", "{7E24885B-D86D-477E-A840-06FA53C33FE1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators.Type3", "src\Simulation\Simulators.Type3.Tests\Tests.Microsoft.Quantum.Simulators.Type3.csproj", "{7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{020356B7-C3FC-4100-AE37-97E5D8288D1D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Qir", "Qir", "{F6C2D4C0-12DC-40E3-9C86-FA5308D9B567}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7F7BB60A-5DCB-469E-8546-1BE9E3CAC833}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FullstateSimulator", "FullstateSimulator", "{EAC5EAE7-D1B3-4726-AFDB-73000E62176A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-test-simulator", "src\Qir\Tests\FullstateSimulator\qsharp\qir-test-simulator.csproj", "{C7531119-9730-497A-9D11-8BBB3761B726}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QIR-dynamic", "QIR-dynamic", "{3DFACF7F-D5C2-455B-AB8A-26908DEF7E2D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-test-random", "src\Qir\Tests\QIR-dynamic\qsharp\qir-test-random.csproj", "{5DBF6402-D9CD-4470-A309-3755CFDA42CF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QIR-static", "QIR-static", "{54000816-122C-4AA0-9FE9-B0ABB9547232}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-gen", "src\Qir\Tests\QIR-static\qsharp\qir-gen.csproj", "{33ED37AB-61B1-4A49-9952-58D19AA8EF30}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QIR-tracer", "QIR-tracer", "{522EAA31-6317-42D5-831F-C39313DF03A0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tracer-qir", "src\Qir\Tests\QIR-tracer\qsharp\tracer-qir.csproj", "{002174F4-BFA8-4675-908D-0E9C32ED951A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{AAFB81D3-BC87-404D-BA64-AF40B2D2E45A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StandaloneInputReference", "StandaloneInputReference", "{A7DB7367-9FD6-4164-8263-A05077BE54AB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-standalone-input-reference", "src\Qir\Samples\StandaloneInputReference\qsharp\qir-standalone-input-reference.csproj", "{D7D34736-A719-4B45-A33F-2723F59EC29D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShippingSample", "src\Azure\ShippingSample\ShippingSample.csproj", "{E8B1A54F-4BEB-454E-9C1B-5B642518CE13}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -525,230 +483,54 @@ Global {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|x64.ActiveCfg = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|x64.Build.0 = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|Any CPU.Build.0 = Release|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|x64.ActiveCfg = Release|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|x64.Build.0 = Release|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|x64.ActiveCfg = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|x64.Build.0 = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|Any CPU.Build.0 = Release|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|x64.ActiveCfg = Release|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|x64.Build.0 = Release|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|x64.ActiveCfg = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|x64.Build.0 = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|Any CPU.Build.0 = Release|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|x64.ActiveCfg = Release|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|x64.Build.0 = Release|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|x64.ActiveCfg = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|x64.Build.0 = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|Any CPU.Build.0 = Release|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|x64.ActiveCfg = Release|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|x64.Build.0 = Release|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|x64.ActiveCfg = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|x64.Build.0 = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|Any CPU.Build.0 = Release|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|x64.ActiveCfg = Release|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|x64.Build.0 = Release|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|x64.ActiveCfg = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|x64.Build.0 = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|Any CPU.Build.0 = Release|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|x64.ActiveCfg = Release|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|x64.Build.0 = Release|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|Any CPU.Build.0 = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|x64.ActiveCfg = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|x64.Build.0 = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Release|Any CPU.ActiveCfg = Release|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Release|Any CPU.Build.0 = Release|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Release|x64.ActiveCfg = Release|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.Release|x64.Build.0 = Release|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|x64.ActiveCfg = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|x64.Build.0 = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|Any CPU.Build.0 = Release|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|x64.ActiveCfg = Release|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|x64.Build.0 = Release|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|x64.ActiveCfg = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|x64.Build.0 = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|Any CPU.Build.0 = Release|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|x64.ActiveCfg = Release|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|x64.Build.0 = Release|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|x64.ActiveCfg = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|x64.Build.0 = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Release|Any CPU.Build.0 = Release|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Release|x64.ActiveCfg = Release|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.Release|x64.Build.0 = Release|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|x64.ActiveCfg = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|x64.Build.0 = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|Any CPU.Build.0 = Release|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|x64.ActiveCfg = Release|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|x64.Build.0 = Release|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|Any CPU.Build.0 = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|x64.ActiveCfg = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|x64.Build.0 = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|Any CPU.Build.0 = Release|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|x64.ActiveCfg = Release|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|x64.Build.0 = Release|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|x64.ActiveCfg = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|x64.Build.0 = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|Any CPU.Build.0 = Release|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|x64.ActiveCfg = Release|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|x64.Build.0 = Release|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|x64.ActiveCfg = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|x64.Build.0 = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|Any CPU.Build.0 = Release|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|x64.ActiveCfg = Release|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|x64.Build.0 = Release|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|x64.ActiveCfg = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|x64.Build.0 = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|Any CPU.Build.0 = Release|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|x64.ActiveCfg = Release|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|x64.Build.0 = Release|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|x64.ActiveCfg = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|x64.Build.0 = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|Any CPU.Build.0 = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|x64.ActiveCfg = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|x64.Build.0 = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|x64.ActiveCfg = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|x64.Build.0 = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|Any CPU.Build.0 = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|x64.ActiveCfg = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|x64.Build.0 = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -780,28 +562,9 @@ Global {55833C6C-6E91-4413-9F77-96B3A09666B8} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} {C015FF41-9A51-4AF0-AEFC-2547D596B10A} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} {D292BF18-3956-4827-820E-254C3F81EF09} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {DB45AD73-4D91-43F3-85CC-C63614A96FB0} = {03736C2E-DB2A-46A9-B7B2-C1216BDECB4F} - {AF6CD304-8E03-433D-AAA2-6E0094B53071} = {93409CC3-8DF9-45FA-AE21-16A19FDEF650} - {ED3D7040-4B3F-4217-A75E-9DF63DD84707} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {4EF958CA-B4A6-4E5F-924A-100B5615BEC3} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {EB6E3DBD-C884-4241-9BC4-8281191D1F53} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {E1A463D7-2E23-4134-BE04-1EFF7A546813} = {93409CC3-8DF9-45FA-AE21-16A19FDEF650} - {789C86D9-CE77-40DA-BDDD-979436952512} = {93409CC3-8DF9-45FA-AE21-16A19FDEF650} - {7E24885B-D86D-477E-A840-06FA53C33FE1} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {F6C2D4C0-12DC-40E3-9C86-FA5308D9B567} = {020356B7-C3FC-4100-AE37-97E5D8288D1D} - {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} = {F6C2D4C0-12DC-40E3-9C86-FA5308D9B567} - {EAC5EAE7-D1B3-4726-AFDB-73000E62176A} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} - {C7531119-9730-497A-9D11-8BBB3761B726} = {EAC5EAE7-D1B3-4726-AFDB-73000E62176A} - {3DFACF7F-D5C2-455B-AB8A-26908DEF7E2D} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} - {5DBF6402-D9CD-4470-A309-3755CFDA42CF} = {3DFACF7F-D5C2-455B-AB8A-26908DEF7E2D} - {54000816-122C-4AA0-9FE9-B0ABB9547232} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} - {33ED37AB-61B1-4A49-9952-58D19AA8EF30} = {54000816-122C-4AA0-9FE9-B0ABB9547232} - {522EAA31-6317-42D5-831F-C39313DF03A0} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} - {002174F4-BFA8-4675-908D-0E9C32ED951A} = {522EAA31-6317-42D5-831F-C39313DF03A0} - {AAFB81D3-BC87-404D-BA64-AF40B2D2E45A} = {F6C2D4C0-12DC-40E3-9C86-FA5308D9B567} - {A7DB7367-9FD6-4164-8263-A05077BE54AB} = {AAFB81D3-BC87-404D-BA64-AF40B2D2E45A} - {D7D34736-A719-4B45-A33F-2723F59EC29D} = {A7DB7367-9FD6-4164-8263-A05077BE54AB} + {D5D41201-101F-4C0D-B6A0-201D8FC3AB91} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {C8F4C061-3947-4448-97DD-C39C40C3999F} = {37CDC768-16D4-4574-8553-07D99D0A72F7} + {E8B1A54F-4BEB-454E-9C1B-5B642518CE13} = {37CDC768-16D4-4574-8553-07D99D0A72F7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821} diff --git a/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj b/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj new file mode 100644 index 00000000000..6725e90a3cc --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj @@ -0,0 +1,16 @@ + + + + + + netstandard2.1 + x64 + Client library for Azure Quantum Optimization. + + + + + + + + diff --git a/src/Azure/ShippingSample/Program.cs b/src/Azure/ShippingSample/Program.cs new file mode 100644 index 00000000000..35dae4a3fa5 --- /dev/null +++ b/src/Azure/ShippingSample/Program.cs @@ -0,0 +1,129 @@ +using System.Collections.Generic; + +namespace ShippingSample +{ + using System; + using System.Linq; + using Microsoft.Azure.Quantum.Optimization; + using Newtonsoft.Json; + + partial class Program + { + static void Main(string[] args) + { + var workspace = CreateWorkspace(); + + // This array contains a list of the weights of the containers + var containerWeights = new int[] { 1, 5, 9, 21, 35, 5, 3, 5, 10, 11 }; + + // Create a problem for the list of containers: + var problem = CreateProblemForContainerWeights(containerWeights); + + // Submit problem to Azure Quantum using the ParallelTempering solver: + // Instantiate a solver to solve the problem. + var solver = new ParallelTemperingSolver(workspace, timeout: 100); + + // Optimize the problem + Console.Out.WriteLine("Submitting problem..."); + var startTime = DateTime.Now; + var result = solver.Optimize(problem); + var timeElapsed = DateTime.Now.Subtract(startTime); + Console.Out.WriteLine("Result in {0} seconds:\n{0}", timeElapsed.TotalSeconds, result); + + // Print out a summary of the results: + PrintResultSummary(result, containerWeights); + + // Improving the Cost Function + // The cost function we"ve built works well so far, but let"s take a closer look at the `Problem` that was generated: + Console.Out.WriteLine("The original problem has {0} terms for {1} containers:", problem.Terms.Count(), containerWeights.Length); + Console.Out.WriteLine(JsonConvert.SerializeObject(problem.Terms)); + + // Check that this creates a smaller problem + // Create the simplified problem + var simplifiedProblem = CreateSimplifiedProblemForContainerWeights(containerWeights); + Console.Out.WriteLine("The simplified problem has {0} terms", simplifiedProblem.Terms.Count()); + + // Optimize the problem + Console.Out.WriteLine("Submitting simplified problem..."); + startTime = DateTime.Now; + var simplifiedResult = solver.Optimize(simplifiedProblem); + var timeElapsedSimplified = DateTime.Now.Subtract(startTime); + Console.Out.WriteLine("Result in {0} seconds:\n{1}", timeElapsedSimplified.TotalSeconds, simplifiedResult); + PrintResultSummary(simplifiedResult, containerWeights); + } + static void PrintResultSummary(Result result, int[] containerWeights) + { + // Print a summary of the result + int shipAWeight = 0; + int shipBWeight = 0; + foreach (var container in result.Configuration) + { + int containerIndex = Int32.Parse(container.Key); + int containerAssignment = container.Value; + + int containerWeight = containerWeights[containerIndex]; + + string ship = String.Empty; + if (containerAssignment == 1) + { + ship = "A"; + shipAWeight += containerWeight; + } + else + { + ship = "B"; + shipBWeight += containerWeight; + } + + Console.Out.WriteLine("Container {0} with weight {1} was placed on Ship {2}", containerIndex, containerWeight, ship); + } + + Console.Out.WriteLine("Total weights: \n\tShip A: {0} tonnes \n\tShip B: {1} tonnes", shipAWeight, shipBWeight); + } + + // Take an array of container weights and return a Problem object that represents the cost function + static Problem CreateProblemForContainerWeights(int[] containerWeights) + { + // Create an Ising-type problem + var problem = new Problem("Ship-Sample-Problem") + { + ProblemType = ProblemType.ising + }; + + // Expand the squared summation + for (int i = 0; i < containerWeights.Length; i++) + for (int j = 0; j < containerWeights.Length; j++) + { + // Skip the terms where i == j as they form constant terms in an Ising problem and can be disregarded: + // w_i∗w_j∗x_i∗x_j = w_i​*w_j∗(x_i)^2 = w_i∗w_j​​ + // for x_i = x_j, x_i ∈ {1, -1} + if (i != j) + { + problem.Add(i, j, containerWeights[i] * containerWeights[j]); + } + } + + return problem; + } + + // We can reduce the number of terms by removing duplicates + // In code, this means a small modification to the createProblemForContainerWeights function: + static Problem CreateSimplifiedProblemForContainerWeights(int[] containerWeights) + { + var terms = new List(); + + // Expand the squared summation + for (int i = 0; i < containerWeights.Length - 1; i++) + for (int j = i + 1; j < containerWeights.Length; j++) + { + terms.Add(new Term(i, j, containerWeights[i] * containerWeights[j])); + } + + // Return an Ising-type problem + return new Problem("Ship-Sample-Problem-Simplified", terms) + { + ProblemType = ProblemType.ising + }; + } + } +} diff --git a/src/Azure/ShippingSample/ShippingSample.csproj b/src/Azure/ShippingSample/ShippingSample.csproj new file mode 100644 index 00000000000..a6925311795 --- /dev/null +++ b/src/Azure/ShippingSample/ShippingSample.csproj @@ -0,0 +1,13 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + diff --git a/src/Azure/ShippingSample/Workspace.cs b/src/Azure/ShippingSample/Workspace.cs new file mode 100644 index 00000000000..f263cd8d46a --- /dev/null +++ b/src/Azure/ShippingSample/Workspace.cs @@ -0,0 +1,22 @@ +using System; +using Microsoft.Azure.Quantum; + +namespace ShippingSample +{ + partial class Program + { + static Workspace CreateWorkspace() + { + // Instantiate Workspace object which allows you to connect to the Workspace you"ve previously deployed in Azure. + // Be sure to fill in the settings below which can be retrieved by running "az quantum workspace show" in the terminal. + // Copy the settings for your workspace below + var workspace = new Workspace( + subscriptionId: "", // add your subscription_id + resourceGroupName: "", // add your resource_group + workspaceName: "", // add your workspace name + baseUri: new Uri("https://westus.quantum.azure.com/")); + + return workspace; + } + } +} From a84430aafd42a0f2ca35c6065f35551aca5e02d8 Mon Sep 17 00:00:00 2001 From: Roman Snytsar Date: Wed, 2 Dec 2020 07:55:16 -0800 Subject: [PATCH 02/20] QIO implementation --- .../Azure.Quantum.Optimization/Problem.cs | 110 +++++++ .../Azure.Quantum.Optimization/Result.cs | 25 ++ .../Azure.Quantum.Optimization/Solver.cs | 269 ++++++++++++++++++ src/Azure/Azure.Quantum.Optimization/Term.cs | 40 +++ 4 files changed, 444 insertions(+) create mode 100644 src/Azure/Azure.Quantum.Optimization/Problem.cs create mode 100644 src/Azure/Azure.Quantum.Optimization/Result.cs create mode 100644 src/Azure/Azure.Quantum.Optimization/Solver.cs create mode 100644 src/Azure/Azure.Quantum.Optimization/Term.cs diff --git a/src/Azure/Azure.Quantum.Optimization/Problem.cs b/src/Azure/Azure.Quantum.Optimization/Problem.cs new file mode 100644 index 00000000000..0e24e5dd140 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization/Problem.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Microsoft.Azure.Quantum.Optimization +{ + public enum ProblemType : int + { + pubo = 0, + ising = 1 + } + + public class Problem + { + [JsonIgnore] + public string Name + { get; private set; } + + [JsonProperty(PropertyName = "version")] + public string Version + { get => (initialConfiguration == null) ? "1.0" : "1.1"; } + + [JsonProperty(PropertyName = "type")] + [JsonConverter(typeof(StringEnumConverter))] + public ProblemType ProblemType + { get; set; } + + [JsonProperty(PropertyName = "terms")] + public IEnumerable Terms + { get => terms; } + + HashSet terms; + Dictionary initialConfiguration; + + public Problem(string name) + { + this.Name = name; + + terms = new HashSet(); + } + public Problem(string name, IEnumerable collection) + : this(name) + { + AddRange(collection); + } + + public Problem(string name, IEnumerable collection, Dictionary initialConfiguration) + : this(name, collection) + { + this.initialConfiguration = initialConfiguration; + } + + public void Add(Term term) + { + terms.Add(term); + } + + public void Add(int i, float c) + { + terms.Add(new Term( new int[] { i }, c)); + } + + public void Add(int i, int j, float c) + { + terms.Add(new Term( new int[] { i, j }, c)); + } + + public void Add(int i, int j, int k, float c) + { + terms.Add(new Term( new int[] { i, j, k }, c)); + } + + public void AddRange(IEnumerable collection) + { + foreach (var term in collection) + { + terms.Add(term); + } + } + + public void SerializeTo(Stream stream) + { + var root = new + { + cost_function = this + }; + + // Save to the writer + var jsonSerializer = new JsonSerializer + { + NullValueHandling = NullValueHandling.Ignore + }; + + using var textWriter = new StreamWriter(stream); + using var jsonWriter = new JsonTextWriter(textWriter); + jsonSerializer.Serialize(jsonWriter, root); + } + + public override string ToString() + { + var root = new + { + cost_function = this + }; + return JsonConvert.SerializeObject(root); + } + } +} diff --git a/src/Azure/Azure.Quantum.Optimization/Result.cs b/src/Azure/Azure.Quantum.Optimization/Result.cs new file mode 100644 index 00000000000..d990ba97a54 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization/Result.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Quantum.Optimization +{ + public class Result + { + [JsonProperty(PropertyName = "version")] + public string Version + { get; set; } + + [JsonProperty(PropertyName = "configuration")] + public Dictionary Configuration + { get; set; } + + [JsonProperty(PropertyName = "cost")] + public float Cost + { get; set; } + + [JsonProperty(PropertyName = "parameters")] + public Dictionary Parameters + { get; set; } + } +} diff --git a/src/Azure/Azure.Quantum.Optimization/Solver.cs b/src/Azure/Azure.Quantum.Optimization/Solver.cs new file mode 100644 index 00000000000..79ffb343df3 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization/Solver.cs @@ -0,0 +1,269 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Threading.Tasks; +using Azure.Storage.Blobs; +using Microsoft.Azure.Quantum.Client.Models; +using Microsoft.Azure.Quantum.Storage; +using Microsoft.Azure.Quantum.Utility; +using Microsoft.Quantum.Runtime; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Quantum.Optimization +{ + public class Solver + { + readonly Workspace workspace; + readonly string provider; + readonly string target; + readonly string inputDataFormat; + readonly string outputDataFormat; + readonly bool hasNestedParameters; + + Dictionary parameters; + + public Solver( + Workspace workspace, + string provider, + string target, + string inputDataFormat, + string outputDataFormat, + bool hasNestedParameters = true) + { + this.workspace = workspace; + this.provider = provider; + this.target = target; + this.inputDataFormat = inputDataFormat; + this.outputDataFormat = outputDataFormat; + this.hasNestedParameters = hasNestedParameters; + + parameters = new Dictionary(); + if (hasNestedParameters) + { + parameters.Add("params", new Dictionary()); + } + } + + protected void AddParameter(string name, object value) + { + var parms = hasNestedParameters ? parameters["params"] as Dictionary : parameters; + + parms.Add(name, value); + } + + public async Task SubmitAsync(Problem problem) + { + string intermediaryFile = Path.GetTempFileName(); + + // Save to the intermediary file + using (var intermediaryWriter = File.Create(intermediaryFile)) + { + using var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest); + problem.SerializeTo(compressionStream); + // problem.SerializeTo(intermediaryWriter); + } + + using var intermediaryReader = File.OpenRead(intermediaryFile); + var jobStorageHelper = new LinkedStorageJobHelper(workspace); + + var jobId = Guid.NewGuid().ToString(); + + var (containerUri, inputUri) = await jobStorageHelper.UploadJobInputAsync(jobId, intermediaryReader); + + return await SubmitAsync(jobId, problem.Name, containerUri, inputUri); + } + + public async Task SubmitAsync(string problemUri) + { + var jobId = Guid.NewGuid().ToString(); + + // Calls the service to get a SAS Uri + var containerSasUri = await workspace.GetSasUriAsync(problemUri); + + var inputSasUri = await workspace.GetSasUriAsync(problemUri, "inputData"); + + var containerUri = new Uri(containerSasUri).GetLeftPart(UriPartial.Path); + + var inputUri = new Uri(inputSasUri).GetLeftPart(UriPartial.Path); + + return await SubmitAsync(jobId, "Optimization problem", containerUri, inputUri); + } + + private async Task SubmitAsync(string jobId, string problemName, string containerUri, string inputUri) + { + var details = new JobDetails + { + Id = jobId, + Name = problemName, + InputDataFormat = inputDataFormat, + OutputDataFormat = outputDataFormat, + ProviderId = provider, + Target = target, + InputParams = parameters, + ContainerUri = containerUri, + InputDataUri = inputUri + }; + + var job = await workspace.SubmitJobAsync(new CloudJob(workspace, details)); + + return job; + } + + /// + /// Submits the Problem to the associated Azure Quantum Workspace and get the results. + /// + /// The Problem to solve./param> + public async Task OptimizeAsync(Problem problem, int maxPollInterval = 30) + { + var job = await SubmitAsync(problem); + + await job.RefreshAsync(); + + int pollInterval = 1; + + while (job.InProgress) + { + Console.Out.Write("."); + await Task.Delay(TimeSpan.FromSeconds(pollInterval)); + await job.RefreshAsync(); + + pollInterval = (pollInterval >= maxPollInterval) ? maxPollInterval : pollInterval * 2; + } + Console.Out.WriteLine(); + + var outputUri = new Uri(job.Details.OutputDataUri); + + var blobClient = new BlobClient(outputUri); + + var stream = new MemoryStream(); + + await blobClient.DownloadToAsync(stream); + + stream.Seek(0, SeekOrigin.Begin); + + var jsonSerializer = new JsonSerializer(); + + using var textReader = new StreamReader(stream); + using var jsonReader = new JsonTextReader(textReader); + var result = jsonSerializer.Deserialize(jsonReader); + + return result; + } + + public Result Optimize(Problem problem, int maxPollInterval = 30) + { + return OptimizeAsync(problem, maxPollInterval).GetAwaiter().GetResult(); + } + } + + public enum HardwarePlatform : int + { + CPU = 1, + FPGA = 2 + }; + + public class ParallelTemperingSolver : Solver + { + public ParallelTemperingSolver(Workspace workspace, int? timeout = null, int? seed = null, int? sweeps = null, int? replicas = null, int[] all_betas = null) + : this(workspace, timeout, seed, !(sweeps.HasValue || replicas.HasValue || all_betas != null)) + { + if (sweeps.HasValue) + AddParameter("sweeps", sweeps.Value); + + if (all_betas != null) + { + AddParameter("all_betas", all_betas); + if (replicas.HasValue) + { + if (all_betas.Length != replicas) + throw new ArgumentException("Parameter 'replicas' must equal the length of the 'all_betas' parameters."); + + AddParameter("replicas", replicas); + } + else + { + AddParameter("replicas", all_betas.Length); + } + } + } + + private ParallelTemperingSolver(Workspace workspace, int? timeout, int? seed, bool paramFree) + : base(workspace, + "Microsoft", + paramFree ? "microsoft.paralleltempering-parameterfree.cpu" : "microsoft.paralleltempering.cpu", + "microsoft.qio.v2", + "microsoft.qio-results.v2") + { + + if (timeout.HasValue) + AddParameter("timeout", timeout.Value); + + if (seed.HasValue) + AddParameter("seed", seed.Value); + } + } + + public class SimulatedAnnealingSolver : Solver + { + public SimulatedAnnealingSolver(Workspace workspace, int? timeout = null, int? seed = null, HardwarePlatform platform = HardwarePlatform.CPU, float? beta_start = null, float? beta_stop = null, int? sweeps = null, int? restarts = null) + : this(workspace, timeout, seed, platform, !(beta_start.HasValue || beta_stop.HasValue || sweeps.HasValue || restarts.HasValue)) + { + if (beta_start.HasValue) + AddParameter("beta_start", beta_start.Value); + + if (beta_stop.HasValue) + AddParameter("beta_stop", beta_stop.Value); + + if (sweeps.HasValue) + AddParameter("sweeps", sweeps.Value); + + if (restarts.HasValue) + AddParameter("restarts", restarts.Value); + } + + private SimulatedAnnealingSolver(Workspace workspace, int? timeout, int? seed, HardwarePlatform platform, bool paramFree) + : base(workspace, + "Microsoft", + (platform == HardwarePlatform.FPGA) ? + (paramFree ? "microsoft.simulatedannealing-parameterfree.fpga" : "microsoft.simulatedannealing.fpga") : + (paramFree ? "microsoft.simulatedannealing-parameterfree.cpu" : "microsoft.simulatedannealing.cpu"), + "microsoft.qio.v2", + "microsoft.qio-results.v2") + { + if (timeout.HasValue) + AddParameter("timeout", timeout.Value); + + if (seed.HasValue) + AddParameter("seed", seed.Value); + } + } + + public class TabuSolver : Solver + { + public TabuSolver(Workspace workspace, int? timeout = null, int? seed = null, int? sweeps = null, int? tabu_tenure = null) + : this(workspace, timeout, seed, + !(tabu_tenure.HasValue || sweeps.HasValue)) + { + if (sweeps.HasValue) + AddParameter("sweeps", sweeps.Value); + + if (tabu_tenure.HasValue) + AddParameter("tabu_tenure", tabu_tenure.Value); + } + + private TabuSolver(Workspace workspace, int? timeout, int? seed, bool paramFree) + : base(workspace, + "Microsoft", + paramFree ? "microsoft.tabu-parameterfree.cpu" : "microsoft.tabu.cpu", + "microsoft.qio.v2", + "microsoft.qio-results.v2") + { + if (timeout.HasValue) + AddParameter("timeout", timeout.Value); + + if (seed.HasValue) + AddParameter("seed", seed.Value); + } + } +} diff --git a/src/Azure/Azure.Quantum.Optimization/Term.cs b/src/Azure/Azure.Quantum.Optimization/Term.cs new file mode 100644 index 00000000000..b8b0e859cd8 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization/Term.cs @@ -0,0 +1,40 @@ +using System; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Quantum.Optimization +{ + public class Term + { + [JsonProperty(PropertyName = "c")] + public float Weight + { get; private set; } + + [JsonProperty(PropertyName = "ids")] + public int[] IDs + { get; private set; } + + public Term(int[] ids, float c) + { + this.IDs = ids; + this.Weight = c; + } + + public Term(int i, float c) + { + this.IDs = new int[] { i }; + this.Weight = c; + } + + public Term(int i, int j, float c) + { + this.IDs = new int[] { i, j }; + this.Weight = c; + } + + public Term(int i, int j, int k, float c) + { + this.IDs = new int[] { i, j, k }; + this.Weight = c; + } + } +} From 0e0bf1b21be40abc4ac7d86cc3bb3f7d2c0f0fc3 Mon Sep 17 00:00:00 2001 From: Roman Snytsar Date: Wed, 2 Dec 2020 11:27:46 -0800 Subject: [PATCH 03/20] Converting to System.Text.Json --- .../Azure.Quantum.Optimization/Problem.cs | 38 +++++++++---------- .../Azure.Quantum.Optimization/Result.cs | 11 +++--- .../Azure.Quantum.Optimization/Solver.cs | 23 ++++++----- src/Azure/Azure.Quantum.Optimization/Term.cs | 7 ++-- src/Azure/ShippingSample/Program.cs | 4 +- 5 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/Azure/Azure.Quantum.Optimization/Problem.cs b/src/Azure/Azure.Quantum.Optimization/Problem.cs index 0e24e5dd140..15e5c0b6ed9 100644 --- a/src/Azure/Azure.Quantum.Optimization/Problem.cs +++ b/src/Azure/Azure.Quantum.Optimization/Problem.cs @@ -1,8 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; namespace Microsoft.Azure.Quantum.Optimization { @@ -12,22 +12,27 @@ public enum ProblemType : int ising = 1 } + struct ProblemSerializationWrapper + { + public Problem cost_function { get; set; } + } + public class Problem { [JsonIgnore] public string Name { get; private set; } - [JsonProperty(PropertyName = "version")] + [JsonPropertyName("version")] public string Version { get => (initialConfiguration == null) ? "1.0" : "1.1"; } - [JsonProperty(PropertyName = "type")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("type")] + [JsonConverter(typeof(JsonStringEnumConverter))] public ProblemType ProblemType { get; set; } - [JsonProperty(PropertyName = "terms")] + [JsonPropertyName("terms")] public IEnumerable Terms { get => terms; } @@ -80,31 +85,24 @@ public void AddRange(IEnumerable collection) } } - public void SerializeTo(Stream stream) + public Task SerializeAsync(Stream stream) { - var root = new + var root = new ProblemSerializationWrapper { cost_function = this }; // Save to the writer - var jsonSerializer = new JsonSerializer - { - NullValueHandling = NullValueHandling.Ignore - }; - - using var textWriter = new StreamWriter(stream); - using var jsonWriter = new JsonTextWriter(textWriter); - jsonSerializer.Serialize(jsonWriter, root); + return JsonSerializer.SerializeAsync(stream, root); } public override string ToString() { - var root = new + var root = new ProblemSerializationWrapper { cost_function = this }; - return JsonConvert.SerializeObject(root); + return JsonSerializer.Serialize(root); } } } diff --git a/src/Azure/Azure.Quantum.Optimization/Result.cs b/src/Azure/Azure.Quantum.Optimization/Result.cs index d990ba97a54..333cfa1fa82 100644 --- a/src/Azure/Azure.Quantum.Optimization/Result.cs +++ b/src/Azure/Azure.Quantum.Optimization/Result.cs @@ -1,24 +1,23 @@ -using System; +using System.Text.Json.Serialization; using System.Collections.Generic; -using Newtonsoft.Json; namespace Microsoft.Azure.Quantum.Optimization { public class Result { - [JsonProperty(PropertyName = "version")] + [JsonPropertyName("version")] public string Version { get; set; } - [JsonProperty(PropertyName = "configuration")] + [JsonPropertyName("configuration")] public Dictionary Configuration { get; set; } - [JsonProperty(PropertyName = "cost")] + [JsonPropertyName("cost")] public float Cost { get; set; } - [JsonProperty(PropertyName = "parameters")] + [JsonPropertyName("parameters")] public Dictionary Parameters { get; set; } } diff --git a/src/Azure/Azure.Quantum.Optimization/Solver.cs b/src/Azure/Azure.Quantum.Optimization/Solver.cs index 79ffb343df3..ab2f5f8eff9 100644 --- a/src/Azure/Azure.Quantum.Optimization/Solver.cs +++ b/src/Azure/Azure.Quantum.Optimization/Solver.cs @@ -2,13 +2,11 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; +using System.Text.Json; using System.Threading.Tasks; using Azure.Storage.Blobs; using Microsoft.Azure.Quantum.Client.Models; using Microsoft.Azure.Quantum.Storage; -using Microsoft.Azure.Quantum.Utility; -using Microsoft.Quantum.Runtime; -using Newtonsoft.Json; namespace Microsoft.Azure.Quantum.Optimization { @@ -57,12 +55,11 @@ public async Task SubmitAsync(Problem problem) string intermediaryFile = Path.GetTempFileName(); // Save to the intermediary file - using (var intermediaryWriter = File.Create(intermediaryFile)) - { - using var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest); - problem.SerializeTo(compressionStream); + using var intermediaryWriter = File.Create(intermediaryFile); + using var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest); + + await problem.SerializeAsync(compressionStream); // problem.SerializeTo(intermediaryWriter); - } using var intermediaryReader = File.OpenRead(intermediaryFile); var jobStorageHelper = new LinkedStorageJobHelper(workspace); @@ -142,11 +139,13 @@ public async Task OptimizeAsync(Problem problem, int maxPollInterval = 3 stream.Seek(0, SeekOrigin.Begin); - var jsonSerializer = new JsonSerializer(); + var result = await JsonSerializer.DeserializeAsync(stream); + + string ser = JsonSerializer.Serialize(result); + + Console.Out.WriteLine(ser); - using var textReader = new StreamReader(stream); - using var jsonReader = new JsonTextReader(textReader); - var result = jsonSerializer.Deserialize(jsonReader); + var result2 = JsonSerializer.Deserialize(ser); return result; } diff --git a/src/Azure/Azure.Quantum.Optimization/Term.cs b/src/Azure/Azure.Quantum.Optimization/Term.cs index b8b0e859cd8..1c1ab874809 100644 --- a/src/Azure/Azure.Quantum.Optimization/Term.cs +++ b/src/Azure/Azure.Quantum.Optimization/Term.cs @@ -1,15 +1,14 @@ -using System; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Microsoft.Azure.Quantum.Optimization { public class Term { - [JsonProperty(PropertyName = "c")] + [JsonPropertyName("c")] public float Weight { get; private set; } - [JsonProperty(PropertyName = "ids")] + [JsonPropertyName("ids")] public int[] IDs { get; private set; } diff --git a/src/Azure/ShippingSample/Program.cs b/src/Azure/ShippingSample/Program.cs index 35dae4a3fa5..c5e53c4f9d1 100644 --- a/src/Azure/ShippingSample/Program.cs +++ b/src/Azure/ShippingSample/Program.cs @@ -4,8 +4,8 @@ namespace ShippingSample { using System; using System.Linq; + using System.Text.Json; using Microsoft.Azure.Quantum.Optimization; - using Newtonsoft.Json; partial class Program { @@ -36,7 +36,7 @@ static void Main(string[] args) // Improving the Cost Function // The cost function we"ve built works well so far, but let"s take a closer look at the `Problem` that was generated: Console.Out.WriteLine("The original problem has {0} terms for {1} containers:", problem.Terms.Count(), containerWeights.Length); - Console.Out.WriteLine(JsonConvert.SerializeObject(problem.Terms)); + Console.Out.WriteLine(JsonSerializer.Serialize(problem.Terms)); // Check that this creates a smaller problem // Create the simplified problem From 8072393494c4eaa294d625abe97f96b7262923ca Mon Sep 17 00:00:00 2001 From: Roman Snytsar Date: Wed, 2 Dec 2020 11:28:42 -0800 Subject: [PATCH 04/20] QIO Test Project --- Simulation.sln | 19 +++++++++++++ ...oft.Azure.Quantum.Optimization.Test.csproj | 20 +++++++++++++ .../ProblemTest.cs | 26 +++++++++++++++++ .../ResultTest.cs | 28 +++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj create mode 100644 src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs create mode 100644 src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs diff --git a/Simulation.sln b/Simulation.sln index dca923850c5..ae8eda4531a 100644 --- a/Simulation.sln +++ b/Simulation.sln @@ -71,6 +71,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Opt EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShippingSample", "src\Azure\ShippingSample\ShippingSample.csproj", "{E8B1A54F-4BEB-454E-9C1B-5B642518CE13}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Optimization.Test", "src\Azure\Azure.Quantum.Optimization.Test\Microsoft.Azure.Quantum.Optimization.Test.csproj", "{C0DBEC04-533D-440E-93C4-7AFF75388F07}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -531,6 +533,22 @@ Global {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|x64.ActiveCfg = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|x64.Build.0 = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|Any CPU.Build.0 = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|x64.ActiveCfg = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|x64.Build.0 = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -565,6 +583,7 @@ Global {D5D41201-101F-4C0D-B6A0-201D8FC3AB91} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} {C8F4C061-3947-4448-97DD-C39C40C3999F} = {37CDC768-16D4-4574-8553-07D99D0A72F7} {E8B1A54F-4BEB-454E-9C1B-5B642518CE13} = {37CDC768-16D4-4574-8553-07D99D0A72F7} + {C0DBEC04-533D-440E-93C4-7AFF75388F07} = {37CDC768-16D4-4574-8553-07D99D0A72F7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821} diff --git a/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj b/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj new file mode 100644 index 00000000000..b6137875cb4 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + + diff --git a/src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs b/src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs new file mode 100644 index 00000000000..65f6cf47752 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs @@ -0,0 +1,26 @@ +using System.Text.Json; +using Microsoft.Azure.Quantum.Optimization; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Microsoft.Azure.Quantum.Optimization.Test +{ + [TestClass] + public class ProblemTest + { + [TestMethod] + public void TestToString() + { + var problem = new Problem("Container Problem"); + problem.Add(new Term(new int[]{ 1, 2 }, 3)); + problem.Add(new Term(new int[]{ 4, 5 }, 4.5f)); + + string dump = problem.ToString(); + + var document = JsonDocument.Parse(dump); + + bool versionMatch = document.RootElement.GetProperty("cost_function").GetProperty("version").ValueEquals("1.0"); + + Assert.IsTrue(versionMatch); + } + } +} diff --git a/src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs b/src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs new file mode 100644 index 00000000000..a2e220218f0 --- /dev/null +++ b/src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs @@ -0,0 +1,28 @@ +using System.Text.Json; +using Microsoft.Azure.Quantum.Optimization; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Microsoft.Azure.Quantum.Optimization.Test +{ + [TestClass] + public class ResultTest + { + private string stream = "{" + + "\"version\": \"1.0\", " + + "\"configuration\": {\"0\": 1, \"1\": 0, \"2\": 1, \"3\": 0, \"4\": 1, \"5\": 1, \"6\": 0, \"7\": 1, \"8\": 1, \"9\": 0, \"10\": 1, \"11\": 0, \"12\": 1, \"13\": 0, \"14\": 0, \"15\": 1, \"16\": 0, \"17\": 0}, " + + "\"cost\": -1387.0, " + + "\"parameters\": {" + + "\"all_betas\": [0.0019047619047619048, 0.004161358043205629, 0.009091372900969896, 0.019862040316247203, 0.0019047619047619048, 0.00269576882469859, 0.003815264017013829, 0.0053996616424066, 0.007642025747748261, 0.010815595753369938, 0.015307081572550497, 0.02166378548270995, 0.030660292702854874, 0.0019047619047619048, 0.002381280313535361, 0.0029770103641063093, 0.003721775490949473, 0.0046528601216981, 0.0058168762099525505, 0.0072720967226419, 0.009091372900969891, 0.011365781338846444, 0.01420918345882487, 0.017763925642003773, 0.02220796537176503, 0.02776378014031601, 0.03470950511566573, 0.0019047619047619048, 0.0022453918738908774, 0.0026469369503509727, 0.003120290627485277, 0.0036782944900449863, 0.004336086592805416, 0.005111512139985543, 0.006025607606769506, 0.0071031714366350356, 0.008373436796903902, 0.00987086464366111, 0.01163607861105555, 0.01371696708754028, 0.01616998237721557, 0.019061672191148227, 0.02247048501640737, 0.02648889834056961, 0.03122592746817419, 0.036810082990665745, 0.0019047619047619048, 0.0021697336670484847, 0.0024715656976099236, 0.0028153856348238737, 0.0032070344237410653, 0.0036531655443015733, 0.004161358043205629, 0.004740245289667783, 0.0053996616424065984, 0.006150809519504954, 0.007006449709387911, 0.007981118155994036, 0.009091372900969895, 0.01035607537803648, 0.011796710838264248, 0.013437753349764285, 0.01530708157255049, 0.017436452371915635, 0.019862040316247196, 0.022625052224478838, 0.025772427203345518, 0.02935763406694387, 0.03344157968546726, 0.03809364369449257], " + + "\"replicas\": 70, " + + "\"sweeps\": 600}}"; + + [TestMethod] + public void TestParse() + { + Result result = JsonSerializer.Deserialize(stream); + + Assert.AreEqual(-1387.0f, result.Cost); + Assert.AreEqual("1.0", result.Version); + } + } +} From fa63226dcdbce05a259f99636073b3385e996508 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 12 May 2021 20:42:21 -0700 Subject: [PATCH 05/20] undo Simulation.sln --- Simulation.sln | 370 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 294 insertions(+), 76 deletions(-) diff --git a/Simulation.sln b/Simulation.sln index ae8eda4531a..9a65f34a9db 100644 --- a/Simulation.sln +++ b/Simulation.sln @@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Sim EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simulation", "simulation", "{34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Core", "src\Simulation\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj", "{A6C5BA7A-DF6F-476F-9106-95905932B810}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Core", "src\Simulation\QSharpCore\Microsoft.Quantum.QSharp.Core.csproj", "{A6C5BA7A-DF6F-476F-9106-95905932B810}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xunit", "xunit", "{34117E2A-DEDC-4274-AAA4-3C61ACF86284}" EndProject @@ -27,17 +27,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Xunit", " EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generation", "generation", "{A567C185-A429-418B-AFDE-6F1785BA4A77}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.CsharpGeneration", "src\Simulation\CsharpGeneration.Tests\Tests.CsharpGeneration.fsproj", "{10D7C395-4F79-4DAF-9289-A4B8FAF6183A}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.CSharpGeneration", "src\Simulation\CSharpGeneration.Tests\Tests.CSharpGeneration.fsproj", "{10D7C395-4F79-4DAF-9289-A4B8FAF6183A}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.RoslynWrapper", "src\Simulation\RoslynWrapper\Microsoft.Quantum.RoslynWrapper.fsproj", "{618FBF9D-4EF3-435D-9728-81C726236668}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.RoslynWrapper", "src\Simulation\RoslynWrapper.Tests\Tests.RoslynWrapper.fsproj", "{48206BD6-48DD-4442-A395-3A6594E4C9C6}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.CsharpGeneration", "src\Simulation\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj", "{B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.CSharpGeneration", "src\Simulation\CSharpGeneration\Microsoft.Quantum.CSharpGeneration.fsproj", "{B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{09C842CB-930C-4C7D-AD5F-E30DE4A55820}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSharpExe", "src\Simulation\Simulators.Tests\TestProjects\QSharpExe\QSharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}" EndProject @@ -65,13 +65,53 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QCIExe", "src\Simulation\Si EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TargetedExe", "src\Simulation\Simulators.Tests\TestProjects\TargetedExe\TargetedExe.csproj", "{D292BF18-3956-4827-820E-254C3F81EF09}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntrinsicTests", "src\Simulation\Simulators.Tests\TestProjects\IntrinsicTests\IntrinsicTests.csproj", "{D5D41201-101F-4C0D-B6A0-201D8FC3AB91}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Foundation", "src\Simulation\QSharpFoundation\Microsoft.Quantum.QSharp.Foundation.csproj", "{DB45AD73-4D91-43F3-85CC-C63614A96FB0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Optimization", "src\Azure\Azure.Quantum.Optimization\Microsoft.Azure.Quantum.Optimization.csproj", "{C8F4C061-3947-4448-97DD-C39C40C3999F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Type2.Core", "src\Simulation\Type2Core\Microsoft.Quantum.Type2.Core.csproj", "{AF6CD304-8E03-433D-AAA2-6E0094B53071}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShippingSample", "src\Azure\ShippingSample\ShippingSample.csproj", "{E8B1A54F-4BEB-454E-9C1B-5B642518CE13}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators.Type2", "src\Simulation\Simulators.Type2.Tests\Tests.Microsoft.Quantum.Simulators.Type2.csproj", "{ED3D7040-4B3F-4217-A75E-9DF63DD84707}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Optimization.Test", "src\Azure\Azure.Quantum.Optimization.Test\Microsoft.Azure.Quantum.Optimization.Test.csproj", "{C0DBEC04-533D-440E-93C4-7AFF75388F07}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntrinsicTests", "src\Simulation\Simulators.Tests\TestProjects\IntrinsicTests\IntrinsicTests.csproj", "{4EF958CA-B4A6-4E5F-924A-100B5615BEC3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators.Type1", "src\Simulation\Simulators.Type1.Tests\Tests.Microsoft.Quantum.Simulators.Type1.csproj", "{EB6E3DBD-C884-4241-9BC4-8281191D1F53}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Type1.Core", "src\Simulation\Type1Core\Microsoft.Quantum.Type1.Core.csproj", "{E1A463D7-2E23-4134-BE04-1EFF7A546813}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "targeting", "targeting", "{93409CC3-8DF9-45FA-AE21-16A19FDEF650}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Targets.Interfaces", "src\Simulation\TargetDefinitions\Interfaces\Microsoft.Quantum.Targets.Interfaces.csproj", "{789C86D9-CE77-40DA-BDDD-979436952512}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Type3.Core", "src\Simulation\Type3Core\Microsoft.Quantum.Type3.Core.csproj", "{7E24885B-D86D-477E-A840-06FA53C33FE1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators.Type3", "src\Simulation\Simulators.Type3.Tests\Tests.Microsoft.Quantum.Simulators.Type3.csproj", "{7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{020356B7-C3FC-4100-AE37-97E5D8288D1D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Qir", "Qir", "{F6C2D4C0-12DC-40E3-9C86-FA5308D9B567}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7F7BB60A-5DCB-469E-8546-1BE9E3CAC833}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FullstateSimulator", "FullstateSimulator", "{EAC5EAE7-D1B3-4726-AFDB-73000E62176A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-test-simulator", "src\Qir\Tests\FullstateSimulator\qsharp\qir-test-simulator.csproj", "{C7531119-9730-497A-9D11-8BBB3761B726}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QIR-dynamic", "QIR-dynamic", "{3DFACF7F-D5C2-455B-AB8A-26908DEF7E2D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-test-random", "src\Qir\Tests\QIR-dynamic\qsharp\qir-test-random.csproj", "{5DBF6402-D9CD-4470-A309-3755CFDA42CF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QIR-static", "QIR-static", "{54000816-122C-4AA0-9FE9-B0ABB9547232}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-gen", "src\Qir\Tests\QIR-static\qsharp\qir-gen.csproj", "{33ED37AB-61B1-4A49-9952-58D19AA8EF30}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QIR-tracer", "QIR-tracer", "{522EAA31-6317-42D5-831F-C39313DF03A0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tracer-qir", "src\Qir\Tests\QIR-tracer\qsharp\tracer-qir.csproj", "{002174F4-BFA8-4675-908D-0E9C32ED951A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{AAFB81D3-BC87-404D-BA64-AF40B2D2E45A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StandaloneInputReference", "StandaloneInputReference", "{A7DB7367-9FD6-4164-8263-A05077BE54AB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qir-standalone-input-reference", "src\Qir\Samples\StandaloneInputReference\qsharp\qir-standalone-input-reference.csproj", "{D7D34736-A719-4B45-A33F-2723F59EC29D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -485,70 +525,230 @@ Global {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|x64.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|x64.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|Any CPU.Build.0 = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|x64.ActiveCfg = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|x64.Build.0 = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|x64.ActiveCfg = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Debug|x64.Build.0 = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|Any CPU.Build.0 = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|x64.ActiveCfg = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.Release|x64.Build.0 = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {C8F4C061-3947-4448-97DD-C39C40C3999F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|x64.ActiveCfg = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Debug|x64.Build.0 = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|Any CPU.Build.0 = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|x64.ActiveCfg = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.Release|x64.Build.0 = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|x64.ActiveCfg = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Debug|x64.Build.0 = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|Any CPU.Build.0 = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|x64.ActiveCfg = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.Release|x64.Build.0 = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {C0DBEC04-533D-440E-93C4-7AFF75388F07}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|x64.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|x64.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|Any CPU.Build.0 = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|x64.ActiveCfg = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|x64.Build.0 = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|x64.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|x64.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|Any CPU.Build.0 = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|x64.ActiveCfg = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|x64.Build.0 = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|x64.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|Any CPU.Build.0 = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|x64.ActiveCfg = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|x64.Build.0 = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|x64.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|x64.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|Any CPU.Build.0 = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|x64.ActiveCfg = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|x64.Build.0 = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|x64.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|x64.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|Any CPU.Build.0 = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|x64.ActiveCfg = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|x64.Build.0 = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|x64.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|x64.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|Any CPU.Build.0 = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|x64.ActiveCfg = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|x64.Build.0 = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|Any CPU.Build.0 = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|x64.ActiveCfg = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Debug|x64.Build.0 = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Release|Any CPU.ActiveCfg = Release|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Release|Any CPU.Build.0 = Release|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Release|x64.ActiveCfg = Release|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.Release|x64.Build.0 = Release|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {789C86D9-CE77-40DA-BDDD-979436952512}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|x64.ActiveCfg = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Debug|x64.Build.0 = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|Any CPU.Build.0 = Release|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|x64.ActiveCfg = Release|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.Release|x64.Build.0 = Release|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {7E24885B-D86D-477E-A840-06FA53C33FE1}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|x64.ActiveCfg = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Debug|x64.Build.0 = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|Any CPU.Build.0 = Release|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|x64.ActiveCfg = Release|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.Release|x64.Build.0 = Release|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|x64.ActiveCfg = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Debug|x64.Build.0 = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Release|Any CPU.Build.0 = Release|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Release|x64.ActiveCfg = Release|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.Release|x64.Build.0 = Release|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {C7531119-9730-497A-9D11-8BBB3761B726}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|x64.ActiveCfg = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Debug|x64.Build.0 = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|Any CPU.Build.0 = Release|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|x64.ActiveCfg = Release|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.Release|x64.Build.0 = Release|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {5DBF6402-D9CD-4470-A309-3755CFDA42CF}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|x64.ActiveCfg = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Debug|x64.Build.0 = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|Any CPU.Build.0 = Release|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|x64.ActiveCfg = Release|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.Release|x64.Build.0 = Release|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {33ED37AB-61B1-4A49-9952-58D19AA8EF30}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|x64.ActiveCfg = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Debug|x64.Build.0 = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|Any CPU.Build.0 = Release|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|x64.ActiveCfg = Release|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.Release|x64.Build.0 = Release|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {002174F4-BFA8-4675-908D-0E9C32ED951A}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|x64.ActiveCfg = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Debug|x64.Build.0 = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|Any CPU.Build.0 = Release|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|x64.ActiveCfg = Release|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.Release|x64.Build.0 = Release|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {D7D34736-A719-4B45-A33F-2723F59EC29D}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -580,10 +780,28 @@ Global {55833C6C-6E91-4413-9F77-96B3A09666B8} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} {C015FF41-9A51-4AF0-AEFC-2547D596B10A} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} {D292BF18-3956-4827-820E-254C3F81EF09} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {C8F4C061-3947-4448-97DD-C39C40C3999F} = {37CDC768-16D4-4574-8553-07D99D0A72F7} - {E8B1A54F-4BEB-454E-9C1B-5B642518CE13} = {37CDC768-16D4-4574-8553-07D99D0A72F7} - {C0DBEC04-533D-440E-93C4-7AFF75388F07} = {37CDC768-16D4-4574-8553-07D99D0A72F7} + {DB45AD73-4D91-43F3-85CC-C63614A96FB0} = {03736C2E-DB2A-46A9-B7B2-C1216BDECB4F} + {AF6CD304-8E03-433D-AAA2-6E0094B53071} = {93409CC3-8DF9-45FA-AE21-16A19FDEF650} + {ED3D7040-4B3F-4217-A75E-9DF63DD84707} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {EB6E3DBD-C884-4241-9BC4-8281191D1F53} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {E1A463D7-2E23-4134-BE04-1EFF7A546813} = {93409CC3-8DF9-45FA-AE21-16A19FDEF650} + {789C86D9-CE77-40DA-BDDD-979436952512} = {93409CC3-8DF9-45FA-AE21-16A19FDEF650} + {7E24885B-D86D-477E-A840-06FA53C33FE1} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {7F80466B-A6B5-4EF1-A9E9-22ABAE3C20C1} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {F6C2D4C0-12DC-40E3-9C86-FA5308D9B567} = {020356B7-C3FC-4100-AE37-97E5D8288D1D} + {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} = {F6C2D4C0-12DC-40E3-9C86-FA5308D9B567} + {EAC5EAE7-D1B3-4726-AFDB-73000E62176A} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} + {C7531119-9730-497A-9D11-8BBB3761B726} = {EAC5EAE7-D1B3-4726-AFDB-73000E62176A} + {3DFACF7F-D5C2-455B-AB8A-26908DEF7E2D} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} + {5DBF6402-D9CD-4470-A309-3755CFDA42CF} = {3DFACF7F-D5C2-455B-AB8A-26908DEF7E2D} + {54000816-122C-4AA0-9FE9-B0ABB9547232} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} + {33ED37AB-61B1-4A49-9952-58D19AA8EF30} = {54000816-122C-4AA0-9FE9-B0ABB9547232} + {522EAA31-6317-42D5-831F-C39313DF03A0} = {7F7BB60A-5DCB-469E-8546-1BE9E3CAC833} + {002174F4-BFA8-4675-908D-0E9C32ED951A} = {522EAA31-6317-42D5-831F-C39313DF03A0} + {AAFB81D3-BC87-404D-BA64-AF40B2D2E45A} = {F6C2D4C0-12DC-40E3-9C86-FA5308D9B567} + {A7DB7367-9FD6-4164-8263-A05077BE54AB} = {AAFB81D3-BC87-404D-BA64-AF40B2D2E45A} + {D7D34736-A719-4B45-A33F-2723F59EC29D} = {A7DB7367-9FD6-4164-8263-A05077BE54AB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821} From 74ad5e39ab32e73fee96c5c340a60fa4802e914f Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 12 May 2021 20:45:29 -0700 Subject: [PATCH 06/20] Update version --- ...rosoft.Azure.Quantum.Optimization.Test.sln | Bin 0 -> 5702 bytes ...icrosoft.Azure.Quantum.Optimization.csproj | 4 +++ .../Azure.Quantum.Optimization/Solver.cs | 26 ++++++++++-------- src/Azure/ShippingSample/ShippingSample.sln | Bin 0 -> 5560 bytes 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.sln create mode 100644 src/Azure/ShippingSample/ShippingSample.sln diff --git a/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.sln b/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.sln new file mode 100644 index 0000000000000000000000000000000000000000..3207f8c745f338c4c2febcb254944ae4583a2eb3 GIT binary patch literal 5702 zcmds*OHbQC5Xa|ArGAGhCn_}&CXa?nJ;aVp4}DN*d&&ifp+O{}38@OSU%l;bc0&Te z-nhhAsIu(coqc%bKeIEl`{(yN>B*stWGG|aBRQ96@&(#hCbBQ5wDzD)qzi3mT0^K4 zXxbh?iKv}QEH6xb$Xb17+I3=Dr#>{*^-ucd_Bfg zS-DKDLHUwejaoyR)O-o0PP;rEAJX5Vt>fxE4f(}t&*A4aZ%OXTSYiAnQjGX}MLrr? z2S(05?Erat^eCldE&M}$0z zt?DmC-tK}HAGcmVfQs5}pZC((sI}pWd_rgA0=2!IlYh5?V;gEAEowD0yY?SiMp3&zO?P=(L9$oy@c{w)Z=z41M?HXN zJcH`KN}u|NEhy@BwN~ZbqE*LV)X}`otv+(yFM9ahTi#kdzQ(P1<}L5*?e~m#nGioT z0$T6VnXR6z&8)no?cTubM%|Aa=tZMqlW&AhRD&8R)tme5RvSHax9W(1b~M$sPkWhP z-$tsT93a`L@&9Xbld=bT8po~7>tqeL^8`hBKz`AaV-t7h`0Py4Ix;%wJ;ttNBVjrkc2s)* z`a%@FA6A;dou{IeXZ)`?u-DAW+QD})4bb>;W_=XLqmSKa*4j1ssLd0X+e^Ouxh*Rl zNB6vI+b)*ZBs{b7nP2wtaCTV~k4ZRYvCBO9bL(w&yDXB|Bs|^n&G%1!nbAYqWnS5v zo5v&^v)N^S{JHg(hg}xOYZ9Jr`Q~<+U%uzo`6_X|C?1n=%wm^$^5@pu>ULQquSs~i z<+FCVdIr3BUa+@=XXKD0bE?q$nQZ5RH)M8Q<}I%Hp7Vv$ZMLU3S#KE=PR}x{OAyKr zIE^`p=#A%r$uE0QE^eKZZc5?K*cbWVHaTl|%KsJTI{WCIjGn;Dlo97Rd+zg~=^dY* e+#`Cl*QeE{3^)<$osQlE>bWnw4)3C*bN>QBhhTXC literal 0 HcmV?d00001 diff --git a/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj b/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj index 6725e90a3cc..c07fe5f6859 100644 --- a/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj +++ b/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj @@ -8,6 +8,10 @@ Client library for Azure Quantum Optimization. + + + + diff --git a/src/Azure/Azure.Quantum.Optimization/Solver.cs b/src/Azure/Azure.Quantum.Optimization/Solver.cs index ab2f5f8eff9..eb4fba63f17 100644 --- a/src/Azure/Azure.Quantum.Optimization/Solver.cs +++ b/src/Azure/Azure.Quantum.Optimization/Solver.cs @@ -55,20 +55,22 @@ public async Task SubmitAsync(Problem problem) string intermediaryFile = Path.GetTempFileName(); // Save to the intermediary file - using var intermediaryWriter = File.Create(intermediaryFile); - using var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest); - - await problem.SerializeAsync(compressionStream); - // problem.SerializeTo(intermediaryWriter); - - using var intermediaryReader = File.OpenRead(intermediaryFile); - var jobStorageHelper = new LinkedStorageJobHelper(workspace); - - var jobId = Guid.NewGuid().ToString(); + using (var intermediaryWriter = File.Create(intermediaryFile)) { + using (var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest)) + { + await problem.SerializeAsync(compressionStream); + // problem.SerializeTo(intermediaryWriter); + } + } - var (containerUri, inputUri) = await jobStorageHelper.UploadJobInputAsync(jobId, intermediaryReader); + using (var intermediaryReader = File.OpenRead(intermediaryFile)) + { + var jobStorageHelper = new LinkedStorageJobHelper(workspace); + var jobId = Guid.NewGuid().ToString(); + var (containerUri, inputUri) = await jobStorageHelper.UploadJobInputAsync(jobId, intermediaryReader); - return await SubmitAsync(jobId, problem.Name, containerUri, inputUri); + return await SubmitAsync(jobId, problem.Name, containerUri, inputUri); + } } public async Task SubmitAsync(string problemUri) diff --git a/src/Azure/ShippingSample/ShippingSample.sln b/src/Azure/ShippingSample/ShippingSample.sln new file mode 100644 index 0000000000000000000000000000000000000000..4b3f32d00738e08ea213613cd773ea5eb8b6c7a0 GIT binary patch literal 5560 zcmd6rOHbQC5Xa|ArGAGhCo0uZOhO2iddQO=`k+MZDHkAy29ZY-Qt>EXz3p#iLju7z zh8PQ3PS&&I-I@P9*Z=;0mYy8SScWp;K9VzeBR`-`WGee|%2ONKRJzcH_B4b#g{IE~ zC@n^(639Cn4_T|vn{J(er^%etmkr5Ff$O!rl3m;Ngf|c2UYDF)$+lF*=hug)$jTn0 zGXGnQN{q@?$5SxMqN z`%aKaZF(}7{|anchH4drd}$za5!wb4Dz@9)HAYoN4dy*&6v+*^%4o0XSD16ys{NYi z+g-Ba%eL!RP*K0_b6=W|Iv>u;#!>q}-ri9wMcclP^@?WWl37>dtYV`Q_O4)SjV6tr z0wdodtbp~KctpY8Eilr!dKtEF6MH@EIpTL9$7HE}>^ibcl%_r7_UW)|v=mXcD1mCp zaIPEj8hx9@oMOc1a&Z&EM@}uThtrWpL zKRq?Swk@8g*j;Omi|5XK_3+3_DqEBVYea%(&Kh@%jOcP@3#wYM$iHS+&7*pGNV5gq zhhHsOq~X(X;^8`bQXzLniV%6gT3}L&JTWrX&s9nC$>j+GS=`L?GwA!0lLoY zVSh$ixX z^g5&G^UJJc48t*rU#2Nvyxms!%PeIL!!usLg(PiW+h`7j!FD7P5I*Owz^+t zDQg&>@%lNxT)hKcJ} Date: Thu, 6 May 2021 19:11:19 +0000 Subject: [PATCH 07/20] Build 0.16.2105.140472. --- global.json | 2 +- .../Microsoft.Quantum.Development.Kit.nuspec | 2 +- .../CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj | 2 +- src/Xunit/Microsoft.Quantum.Xunit.nuspec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/global.json b/global.json index 1a4560e2e79..a59778a3b8e 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "Microsoft.Quantum.Sdk": "0.16.2104138281-beta" + "Microsoft.Quantum.Sdk": "0.16.2105140472" } } diff --git a/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec b/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec index de6a81b711b..aeedbfb3a2f 100644 --- a/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec +++ b/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec @@ -20,7 +20,7 @@ Quantum Q# QSharp - + diff --git a/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj b/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj index 19bd62fc925..14ebc89e93e 100644 --- a/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj +++ b/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj @@ -22,7 +22,7 @@ - + diff --git a/src/Xunit/Microsoft.Quantum.Xunit.nuspec b/src/Xunit/Microsoft.Quantum.Xunit.nuspec index 0649bf826cd..ace99ba74a4 100644 --- a/src/Xunit/Microsoft.Quantum.Xunit.nuspec +++ b/src/Xunit/Microsoft.Quantum.Xunit.nuspec @@ -22,7 +22,7 @@ - + From b1ff862a9405145dc59d633733435bd615b83599 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 13 May 2021 10:53:27 -0700 Subject: [PATCH 08/20] ignore snk files --- build/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/.gitignore diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 00000000000..ee956f580c1 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1 @@ +*.snk \ No newline at end of file From e7e314d1c58c80c1c577ad6ee06efe1bc054c9b3 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 13 May 2021 21:23:06 -0700 Subject: [PATCH 09/20] Migrate Azure.Quantum.Client to use Azure.Quantum.Jobs --- .../Authentication/ClientCredentials.cs | 48 - .../CustomAccessTokenProvider.cs | 127 --- .../Authentication/IAccessTokenProvider.cs | 21 - .../StaticAccessTokenProvider.cs | 37 - .../Authentication/TokenCredentialProvider.cs | 43 - .../Exceptions/WorkspaceClientException.cs | 29 +- .../JobManagement/CloudJob.cs | 6 +- .../JobManagement/QuotaInfo.cs | 7 +- .../JobManagement/Workspace.cs | 199 ++-- .../Microsoft.Azure.Quantum.Client.csproj | 7 +- .../generated/IJobsOperations.cs | 134 --- .../generated/IProvidersOperations.cs | 68 -- .../generated/IQuantumClient.cs | 99 -- .../generated/IQuotasOperations.cs | 68 -- .../generated/IStorageOperations.cs | 52 - .../generated/JobsOperations.cs | 974 ------------------ .../generated/JobsOperationsExtensions.cs | 192 ---- .../generated/Models/BlobDetails.cs | 73 -- .../generated/Models/DimensionScope.cs | 22 - .../generated/Models/ErrorData.cs | 63 -- .../generated/Models/JobDetails.cs | 233 ----- .../generated/Models/JobStatus.cs | 25 - .../generated/Models/MeterPeriod.cs | 22 - .../generated/Models/Page.cs | 53 - .../generated/Models/ProviderAvailability.cs | 23 - .../generated/Models/ProviderStatus.cs | 69 -- .../generated/Models/Quota.cs | 114 -- .../generated/Models/RestError.cs | 49 - .../generated/Models/RestErrorException.cs | 61 -- .../generated/Models/SasUriResponse.cs | 53 - .../generated/Models/TargetAvailability.cs | 23 - .../generated/Models/TargetStatus.cs | 79 -- .../generated/ProvidersOperations.cs | 397 ------- .../ProvidersOperationsExtensions.cs | 87 -- .../generated/QuantumClient.cs | 381 ------- .../generated/QuotasOperations.cs | 397 ------- .../generated/QuotasOperationsExtensions.cs | 87 -- .../generated/StorageOperations.cs | 249 ----- .../generated/StorageOperationsExtensions.cs | 63 -- src/Simulation/EntryPointDriver/Azure.cs | 75 +- src/Simulation/EntryPointDriver/Driver.cs | 3 +- 41 files changed, 129 insertions(+), 4683 deletions(-) delete mode 100644 src/Azure/Azure.Quantum.Client/Authentication/ClientCredentials.cs delete mode 100644 src/Azure/Azure.Quantum.Client/Authentication/CustomAccessTokenProvider.cs delete mode 100644 src/Azure/Azure.Quantum.Client/Authentication/IAccessTokenProvider.cs delete mode 100644 src/Azure/Azure.Quantum.Client/Authentication/StaticAccessTokenProvider.cs delete mode 100644 src/Azure/Azure.Quantum.Client/Authentication/TokenCredentialProvider.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/IJobsOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/IProvidersOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/IQuantumClient.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/IQuotasOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/IStorageOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/JobsOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/JobsOperationsExtensions.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/BlobDetails.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/DimensionScope.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/ErrorData.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/JobDetails.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/JobStatus.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/MeterPeriod.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/Page.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/ProviderAvailability.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/ProviderStatus.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/Quota.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/RestError.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/RestErrorException.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/SasUriResponse.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/TargetAvailability.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/Models/TargetStatus.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/ProvidersOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/ProvidersOperationsExtensions.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/QuantumClient.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/QuotasOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/QuotasOperationsExtensions.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/StorageOperations.cs delete mode 100644 src/Azure/Azure.Quantum.Client/generated/StorageOperationsExtensions.cs diff --git a/src/Azure/Azure.Quantum.Client/Authentication/ClientCredentials.cs b/src/Azure/Azure.Quantum.Client/Authentication/ClientCredentials.cs deleted file mode 100644 index e9082df95b1..00000000000 --- a/src/Azure/Azure.Quantum.Client/Authentication/ClientCredentials.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Rest; - -namespace Microsoft.Azure.Quantum.Authentication -{ - /// - /// Authorization client handler class. - /// - internal class ClientCredentials : ServiceClientCredentials - { - private const string AuthorizationHeaderName = "Authorization"; - private const string BearerScheme = "Bearer"; - - private readonly IAccessTokenProvider accessTokenProvider; - - /// - /// Initializes a new instance of the class. - /// - /// The access token provider. - public ClientCredentials(IAccessTokenProvider accessTokenProvider) - { - this.accessTokenProvider = accessTokenProvider; - } - - public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - if (request == null) - { - throw new ArgumentNullException("request"); - } - - if (!request.Headers.Contains(AuthorizationHeaderName)) - { - string accessToken = await this.accessTokenProvider.GetAccessTokenAsync(cancellationToken); - request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(BearerScheme, accessToken); - } - - //request.Version = new Version(apiVersion); - await base.ProcessHttpRequestAsync(request, cancellationToken); - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/Authentication/CustomAccessTokenProvider.cs b/src/Azure/Azure.Quantum.Client/Authentication/CustomAccessTokenProvider.cs deleted file mode 100644 index b95e03237b1..00000000000 --- a/src/Azure/Azure.Quantum.Client/Authentication/CustomAccessTokenProvider.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Linq; -using System.Net.Http; -using System.Security.Authentication; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Quantum.Utility; -using Microsoft.Identity.Client; -using Microsoft.Identity.Client.Extensions.Msal; - -namespace Microsoft.Azure.Quantum.Authentication -{ - /// - /// This class manually uses MSAL to get an access token. - /// It first tries to get silently, if that doesn't work, it tries to get interactively. - /// - /// - internal class CustomAccessTokenProvider : IAccessTokenProvider - { - private readonly LazyAsync applicationLazy; - private readonly string[] scopes; - private readonly string subscriptionId; - - /// - /// Initializes a new instance of the class. - /// - /// The Subscription Id of the account in use. - public CustomAccessTokenProvider(string subscriptionId) - { - static async Task GetSubscriptionTenantUri(string subscriptionId) - { - var uri = $"https://management.azure.com/subscriptions/{subscriptionId}?api-version=2018-01-01"; - try - { - static string GetTenantUriFromHeader(System.Net.Http.Headers.AuthenticationHeaderValue header) => - header - .Parameter - .Replace("Bearer ", string.Empty) - .Split(",") - .Select(part => part.Split("=")) - .ToDictionary(rg => rg[0], rg => rg[1])["authorization_uri"] - .Trim('\'', '"'); - - using var client = new HttpClient(); - var httpResult = await client.GetAsync(uri); - - return httpResult - .Headers - .WwwAuthenticate - .Select(GetTenantUriFromHeader) - .Single(); - } - catch (System.Exception ex) - { - throw new AuthenticationException("Unable to extract tenantUri!", ex); - } - } - - this.scopes = new string[] { Constants.Aad.Audience }; - this.subscriptionId = subscriptionId; - this.applicationLazy = - new LazyAsync(async () => - { - var application = PublicClientApplicationBuilder - .Create(Constants.Aad.ApplicationId) - .WithDefaultRedirectUri() - .WithAuthority(await GetSubscriptionTenantUri(subscriptionId)) - .Build(); - var cacheHelper = await CreateCacheHelperAsync(); - cacheHelper.RegisterCache(application.UserTokenCache); - return application; - }); - } - - /// - /// Tries to get access token silently, if didn't work, tries to get it interactively. - /// - /// The cancellation token. - /// A encapsulating the access token. - public async Task GetAccessTokenAsync(CancellationToken cancellationToken) - { - var application = await applicationLazy.Value; - - try - { - var accounts = await application.GetAccountsAsync(); - - // Try silently first - var result = await application - .AcquireTokenSilent(scopes, accounts.FirstOrDefault()) - .ExecuteAsync(); - - return result.AccessToken; - } - catch (MsalUiRequiredException) - { - // Didn't work, perform interactive logging - var result = await application - .AcquireTokenInteractive(scopes) - .ExecuteAsync(); - - return result.AccessToken; - } - } - - private static async Task CreateCacheHelperAsync() - { - StorageCreationProperties storageProperties; - - storageProperties = new StorageCreationPropertiesBuilder( - Constants.Aad.CacheFileName, - MsalCacheHelper.UserRootDirectory, - Constants.Aad.ApplicationId) - .WithMacKeyChain( - Constants.Aad.KeyChainServiceName, - Constants.Aad.KeyChainAccountName) - .Build(); - - var cacheHelper = await MsalCacheHelper.CreateAsync(storageProperties).ConfigureAwait(false); - - cacheHelper.VerifyPersistence(); - return cacheHelper; - } - } -} \ No newline at end of file diff --git a/src/Azure/Azure.Quantum.Client/Authentication/IAccessTokenProvider.cs b/src/Azure/Azure.Quantum.Client/Authentication/IAccessTokenProvider.cs deleted file mode 100644 index e72e4a440b8..00000000000 --- a/src/Azure/Azure.Quantum.Client/Authentication/IAccessTokenProvider.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.Azure.Quantum.Authentication -{ - /// - /// Generic interface to retrieve access token. This is not exposed to the user. - /// - internal interface IAccessTokenProvider - { - /// - /// Gets the access token. - /// - /// The cancellation token. - /// Access token string - Task GetAccessTokenAsync(CancellationToken cancellationToken); - } -} diff --git a/src/Azure/Azure.Quantum.Client/Authentication/StaticAccessTokenProvider.cs b/src/Azure/Azure.Quantum.Client/Authentication/StaticAccessTokenProvider.cs deleted file mode 100644 index d44aa2e88ef..00000000000 --- a/src/Azure/Azure.Quantum.Client/Authentication/StaticAccessTokenProvider.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Quantum.Utility; - -namespace Microsoft.Azure.Quantum.Authentication -{ - /// - /// This class accepts an access token string and provides it. - /// - /// - internal class StaticAccessTokenProvider : IAccessTokenProvider - { - private readonly string accessToken; - - /// - /// Initializes a new instance of the class. - /// - public StaticAccessTokenProvider(string accessToken) - { - Ensure.NotNullOrWhiteSpace(accessToken, nameof(accessToken)); - - this.accessToken = accessToken; - } - - /// - /// Returns the static access token. - /// - /// The cancellation token. - public Task GetAccessTokenAsync(CancellationToken cancellationToken) - { - return Task.FromResult(this.accessToken); - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/Authentication/TokenCredentialProvider.cs b/src/Azure/Azure.Quantum.Client/Authentication/TokenCredentialProvider.cs deleted file mode 100644 index dd4805f7fda..00000000000 --- a/src/Azure/Azure.Quantum.Client/Authentication/TokenCredentialProvider.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Microsoft.Azure.Quantum.Utility; - -namespace Microsoft.Azure.Quantum.Authentication -{ - /// - /// A provider for TokenCredential - /// - /// - internal class TokenCredentialProvider : IAccessTokenProvider - { - private readonly TokenCredential tokenCredential; - private readonly string[] scopes; - - /// - /// Initializes a new instance of the class. - /// - /// The token credential. - public TokenCredentialProvider(TokenCredential tokenCredential) - { - this.tokenCredential = tokenCredential; - this.scopes = new string[] { Constants.Aad.Audience }; - } - - /// - /// Gets the access token. - /// - /// The cancellation token. - /// - /// Access token string - /// - public async Task GetAccessTokenAsync(CancellationToken cancellationToken) - { - AccessToken accessToken = await this.tokenCredential.GetTokenAsync(new TokenRequestContext(this.scopes), cancellationToken); - return accessToken.Token; - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs b/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs index e33d38930ae..e8c669688f5 100644 --- a/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs +++ b/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.Azure.Quantum.Client.Models; using System; namespace Microsoft.Azure.Quantum.Exceptions @@ -50,7 +49,7 @@ public WorkspaceClientException( /// ID of the subscription used by the Azure workspace client. /// Name of the resource group used by the Azure workspace client. /// Name of the workspace used by the Azure workspace client. - /// URI used by the Azure workspace client. + /// Workspace's location (region). /// ID of the job involved in the operation that caused the exception. /// Exception that is the cause of the current one. public WorkspaceClientException( @@ -58,7 +57,7 @@ public WorkspaceClientException( string subscriptionId, string resourceGroupName, string workspaceName, - Uri baseUri, + string location, string jobId, Exception inner) : base( @@ -66,7 +65,7 @@ public WorkspaceClientException( $"SubscriptionId: {subscriptionId}{Environment.NewLine}" + $"ResourceGroupName: {resourceGroupName}{Environment.NewLine}" + $"WorkspaceName: {workspaceName}{Environment.NewLine}" + - $"BaseUri: {baseUri}{Environment.NewLine}" + + $"Location: {location}{Environment.NewLine}" + $"JobId: {jobId}{Environment.NewLine}" + FormatInnerException(inner), inner) @@ -88,18 +87,18 @@ private static string FormatInnerException(Exception ex) { formattedException += $"Server Error: {ex.Message}{Environment.NewLine}"; - // Handle specific types of exceptions for additional data - if (ex is RestErrorException restErrorException) - { - formattedException += $"Error Code: {restErrorException?.Body?.Error?.Code}{Environment.NewLine}" + - $"Server message: {restErrorException?.Body?.Error?.Message}{Environment.NewLine}"; + //// Handle specific types of exceptions for additional data + //if (ex is RequestFailedException restErrorException) + //{ + // formattedException += $"Error Code: {restErrorException.ErrorCode}{Environment.NewLine}" + + // $"Server message: {restErrorException}{Environment.NewLine}"; - var headers = restErrorException?.Response?.Headers; - if (headers != null && headers.ContainsKey("x-ms-request-id")) - { - formattedException += $"Server Request Id: {headers["x-ms-request-id"]}{Environment.NewLine}"; - } - } + // var headers = restErrorException?.Response?.Headers; + // if (headers != null && headers.ContainsKey("x-ms-request-id")) + // { + // formattedException += $"Server Request Id: {headers["x-ms-request-id"]}{Environment.NewLine}"; + // } + //} } return formattedException; diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs b/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs index bfc879eb9d2..d79c3e87072 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs @@ -6,7 +6,9 @@ namespace Microsoft.Azure.Quantum using System; using System.Threading; using System.Threading.Tasks; - using Microsoft.Azure.Quantum.Client.Models; + + using global::Azure.Quantum.Jobs.Models; + using Microsoft.Azure.Quantum.Utility; using Microsoft.Quantum.Runtime; @@ -50,7 +52,7 @@ public CloudJob(IWorkspace workspace, JobDetails jobDetails) /// /// Gets the status of the submitted job. /// - public string Status => Details.Status; + public string Status => Details.Status?.ToString(); /// /// Gets whether the job execution completed successfully. diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/QuotaInfo.cs b/src/Azure/Azure.Quantum.Client/JobManagement/QuotaInfo.cs index 71160112136..6906963b65a 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/QuotaInfo.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/QuotaInfo.cs @@ -3,7 +3,8 @@ namespace Microsoft.Azure.Quantum { - using Microsoft.Azure.Quantum.Client.Models; + using global::Azure.Quantum.Jobs.Models; + using Microsoft.Azure.Quantum.Utility; /// @@ -16,7 +17,7 @@ public class QuotaInfo /// /// The workspace. /// The job details. - public QuotaInfo(IWorkspace workspace, Quota quota) + public QuotaInfo(IWorkspace workspace, QuantumJobQuota quota) { Ensure.NotNull(workspace, nameof(workspace)); Ensure.NotNull(quota, nameof(quota)); @@ -33,6 +34,6 @@ public QuotaInfo(IWorkspace workspace, Quota quota) /// /// Gets the quota information. /// - public Quota Quota { get; private set; } + public QuantumJobQuota Quota { get; private set; } } } diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs index ec306e5e2dd..39676915019 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs @@ -9,9 +9,11 @@ namespace Microsoft.Azure.Quantum using System.Threading; using System.Threading.Tasks; using global::Azure.Core; - using Microsoft.Azure.Quantum.Authentication; - using Microsoft.Azure.Quantum.Client; - using Microsoft.Azure.Quantum.Client.Models; + using global::Azure.Identity; + using global::Azure.Quantum; + using global::Azure.Quantum.Jobs; + using global::Azure.Quantum.Jobs.Models; + using Microsoft.Azure.Quantum.Exceptions; using Microsoft.Azure.Quantum.Utility; @@ -21,150 +23,61 @@ namespace Microsoft.Azure.Quantum /// public class Workspace : IWorkspace { - private readonly Uri baseUri; - private readonly string resourceGroupName; - private readonly string subscriptionId; - private readonly string workspaceName; - - /// - /// Initializes a new instance of the class. - /// - /// The subscription identifier. - /// Name of the resource group. - /// Name of the workspace. - /// The token credential. - /// The base URI. - public Workspace( - string subscriptionId, - string resourceGroupName, - string workspaceName, - TokenCredential tokenCredential = null, - Uri baseUri = null) - : this( - subscriptionId, - resourceGroupName, - workspaceName, - tokenCredential == null ? null : new TokenCredentialProvider(tokenCredential), - baseUri) - { - } - /// /// Initializes a new instance of the class. /// /// The subscription identifier. /// Name of the resource group. /// Name of the workspace. - /// Normalized location to use with the default endpoint. - /// The token credential. + /// Azure region where the workspace was created. + /// The credentials to connect to Azure. If not provided it defaults to DefaultAzureCredentials. + /// Options for the client library when communication with Azure Service.. public Workspace( string subscriptionId, string resourceGroupName, string workspaceName, string location, - TokenCredential tokenCredential = null) - : this( - subscriptionId, - resourceGroupName, - workspaceName, - tokenCredential, - new Uri($"https://{location}.{Constants.DefaultLocationlessEndpoint}/")) + TokenCredential credentials = null, + QuantumJobClientOptions options = default) { - } - - /// - /// Initializes a new instance of the class. - /// - /// The subscription identifier. - /// Name of the resource group. - /// Name of the workspace. - /// The access token. - /// The base URI. - public Workspace( - string subscriptionId, - string resourceGroupName, - string workspaceName, - string accessToken, - Uri baseUri = null) - : this( - subscriptionId, - resourceGroupName, - workspaceName, - new StaticAccessTokenProvider(accessToken), - baseUri) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The subscription identifier. - /// Name of the resource group. - /// Name of the workspace. - /// The access token. - /// Normalized location to use with the default endpoint. - public Workspace( - string subscriptionId, - string resourceGroupName, - string workspaceName, - string accessToken, - string location) - : this( - subscriptionId, - resourceGroupName, - workspaceName, - new StaticAccessTokenProvider(accessToken), - new Uri($"https://{location}.{Constants.DefaultLocationlessEndpoint}/")) - { - } - - private Workspace( - string subscriptionId, - string resourceGroupName, - string workspaceName, - IAccessTokenProvider accessTokenProvider, - Uri baseUri = null) - { - this.baseUri = baseUri ?? new Uri($"https://{Constants.DefaultLocation}.{Constants.DefaultLocationlessEndpoint}/"); + // Required parameters: Ensure.NotNullOrWhiteSpace(subscriptionId, nameof(subscriptionId)); - this.subscriptionId = subscriptionId; Ensure.NotNullOrWhiteSpace(resourceGroupName, nameof(resourceGroupName)); - this.resourceGroupName = resourceGroupName; Ensure.NotNullOrWhiteSpace(workspaceName, nameof(workspaceName)); - this.workspaceName = workspaceName; + Ensure.NotNullOrWhiteSpace(location, nameof(location)); - try - { - accessTokenProvider = accessTokenProvider ?? new CustomAccessTokenProvider(subscriptionId); - } - catch (Exception ex) - { - throw CreateException(ex, "Could not create an access token provider"); - } + // Optional parameters: + credentials ??= new DefaultAzureCredential(includeInteractiveCredentials: true); + options ??= new QuantumJobClientOptions(); - Ensure.NotNull(accessTokenProvider, nameof(accessTokenProvider)); + this.ResourceGroupName = resourceGroupName; + this.WorkspaceName = workspaceName; + this.SubscriptionId = subscriptionId; + this.Location = location; try { - this.QuantumClient = new QuantumClient(new ClientCredentials(accessTokenProvider)) - { - BaseUri = this.baseUri, - SubscriptionId = subscriptionId, - ResourceGroupName = resourceGroupName, - WorkspaceName = workspaceName, - }; + this.QuantumClient = new QuantumJobClient( + subscriptionId, + resourceGroupName, + workspaceName, + location, + credentials, + options); } catch (Exception ex) { - throw CreateException(ex, "Could not create an Azure quantum service client"); + throw CreateException(ex, "Could not create an Azure Quantum service client"); } } - public string ResourceGroupName { get => resourceGroupName; } + public string ResourceGroupName { get; } - public string SubscriptionId { get => subscriptionId; } + public string SubscriptionId { get; } - public string WorkspaceName { get => workspaceName; } + public string WorkspaceName { get; } + + public string Location { get; } /// /// Gets or sets the jobs client. @@ -173,7 +86,7 @@ private Workspace( /// /// The jobs client. /// - internal IQuantumClient QuantumClient { get; set; } + internal QuantumJobClient QuantumClient { get; set; } /// /// Submits the job. @@ -192,7 +105,7 @@ public async Task SubmitJobAsync( try { - JobDetails jobDetails = await this.QuantumClient.Jobs.CreateAsync( + JobDetails jobDetails = await this.QuantumClient.CreateJobAsync( jobId: jobDefinition.Details.Id, job: jobDefinition.Details, cancellationToken: cancellationToken); @@ -217,11 +130,11 @@ public async Task CancelJobAsync(string jobId, CancellationToken cance try { - await this.QuantumClient.Jobs.CancelAsync( + await this.QuantumClient.CancelJobAsync( jobId: jobId, cancellationToken: cancellationToken); - JobDetails jobDetails = this.QuantumClient.Jobs.Get(jobId); + JobDetails jobDetails = this.QuantumClient.GetJob(jobId); return new CloudJob(this, jobDetails); } @@ -245,7 +158,7 @@ public async Task GetJobAsync(string jobId, CancellationToken cancella try { - JobDetails jobDetails = await this.QuantumClient.Jobs.GetAsync( + JobDetails jobDetails = await this.QuantumClient.GetJobAsync( jobId: jobId, cancellationToken: cancellationToken); @@ -268,11 +181,15 @@ public async Task> ListJobsAsync(CancellationToken cancell { try { - var jobs = await this.QuantumClient.Jobs.ListAsync( - cancellationToken: cancellationToken); + var jobs = this.QuantumClient.GetJobsAsync(cancellationToken); + + var result = new List(); + await foreach (var j in jobs) + { + result.Add(new CloudJob(this, j)); + } - return jobs - .Select(details => new CloudJob(this, details)); + return result; } catch (Exception ex) { @@ -291,10 +208,15 @@ public async Task> ListQuotasAsync(CancellationToken canc { try { - var quotas = await this.QuantumClient.Quotas.ListAsync( - cancellationToken: cancellationToken); + var quotas = this.QuantumClient.GetQuotasAsync(cancellationToken); + + var result = new List(); + await foreach (var q in quotas) + { + result.Add(new QuotaInfo(this, q)); + } - return quotas.Select(quota => new QuotaInfo(this, quota)); + return result; } catch (Exception ex) { @@ -313,14 +235,13 @@ public async Task> ListQuotasAsync(CancellationToken canc /// public async Task GetSasUriAsync(string containerName, string blobName = null, CancellationToken cancellationToken = default) { - BlobDetails details = new BlobDetails + BlobDetails details = new BlobDetails(containerName) { - ContainerName = containerName, BlobName = blobName, }; - var response = await this.QuantumClient.Storage.SasUriAsync(details, cancellationToken); - return response.SasUri; + var response = await this.QuantumClient.GetStorageSasUriAsync(details, cancellationToken); + return response.Value.SasUri; } private WorkspaceClientException CreateException( @@ -330,10 +251,10 @@ private WorkspaceClientException CreateException( { return new WorkspaceClientException( message, - subscriptionId, - resourceGroupName, - workspaceName, - baseUri, + this.SubscriptionId, + this.ResourceGroupName, + this.WorkspaceName, + this.Location, jobId, inner); } diff --git a/src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj b/src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj index 5cbb18eb53b..28a0ded1164 100644 --- a/src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj +++ b/src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj @@ -19,11 +19,10 @@ - + + + - - - all diff --git a/src/Azure/Azure.Quantum.Client/generated/IJobsOperations.cs b/src/Azure/Azure.Quantum.Client/generated/IJobsOperations.cs deleted file mode 100644 index af9fd24eb91..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/IJobsOperations.cs +++ /dev/null @@ -1,134 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// JobsOperations operations. - /// - public partial interface IJobsOperations - { - /// - /// List jobs. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get job by id - /// - /// - /// Id of the job. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string jobId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create a job. - /// - /// - /// Id of the job. - /// - /// - /// The complete metadata of the job to submit. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateWithHttpMessagesAsync(string jobId, JobDetails job, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Cancel a job. - /// - /// - /// Id of the job. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task CancelWithHttpMessagesAsync(string jobId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List jobs. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/IProvidersOperations.cs b/src/Azure/Azure.Quantum.Client/generated/IProvidersOperations.cs deleted file mode 100644 index 2cc635ca7c8..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/IProvidersOperations.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ProvidersOperations operations. - /// - public partial interface IProvidersOperations - { - /// - /// Get provider status. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> GetStatusWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get provider status. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> GetStatusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/IQuantumClient.cs b/src/Azure/Azure.Quantum.Client/generated/IQuantumClient.cs deleted file mode 100644 index 6f0f9edbf5c..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/IQuantumClient.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - - /// - /// Azure Quantum REST API client - /// - public partial interface IQuantumClient : System.IDisposable - { - /// - /// The base URI of the service. - /// - System.Uri BaseUri { get; set; } - - /// - /// Gets or sets json serialization settings. - /// - JsonSerializerSettings SerializationSettings { get; } - - /// - /// Gets or sets json deserialization settings. - /// - JsonSerializerSettings DeserializationSettings { get; } - - /// - /// Credentials needed for the client to connect to Azure. - /// - ServiceClientCredentials Credentials { get; } - - /// - /// The Azure subscription ID. This is a GUID-formatted string (e.g. - /// 00000000-0000-0000-0000-000000000000) - /// - string SubscriptionId { get; set; } - - /// - /// Name of an Azure resource group. - /// - string ResourceGroupName { get; set; } - - /// - /// Name of the workspace. - /// - string WorkspaceName { get; set; } - - /// - /// The preferred language for the response. - /// - string AcceptLanguage { get; set; } - - /// - /// The retry timeout in seconds for Long Running Operations. Default - /// value is 30. - /// - int? LongRunningOperationRetryTimeout { get; set; } - - /// - /// Whether a unique x-ms-client-request-id should be generated. When - /// set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. - /// - bool? GenerateClientRequestId { get; set; } - - - /// - /// Gets the IJobsOperations. - /// - IJobsOperations Jobs { get; } - - /// - /// Gets the IProvidersOperations. - /// - IProvidersOperations Providers { get; } - - /// - /// Gets the IStorageOperations. - /// - IStorageOperations Storage { get; } - - /// - /// Gets the IQuotasOperations. - /// - IQuotasOperations Quotas { get; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/IQuotasOperations.cs b/src/Azure/Azure.Quantum.Client/generated/IQuotasOperations.cs deleted file mode 100644 index b25390bb5df..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/IQuotasOperations.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// QuotasOperations operations. - /// - public partial interface IQuotasOperations - { - /// - /// List quotas for the given workspace. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List quotas for the given workspace. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/IStorageOperations.cs b/src/Azure/Azure.Quantum.Client/generated/IStorageOperations.cs deleted file mode 100644 index 838761aab6c..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/IStorageOperations.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// StorageOperations operations. - /// - public partial interface IStorageOperations - { - /// - /// Gets a URL with SAS token for a container/blob in the storage - /// account associated with the workspace. The SAS URL can be used to - /// upload job input and/or download job output. - /// - /// - /// The details (name and container) of the blob to store or download - /// data. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> SasUriWithHttpMessagesAsync(BlobDetails blobDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/JobsOperations.cs b/src/Azure/Azure.Quantum.Client/generated/JobsOperations.cs deleted file mode 100644 index 250d26ab5a2..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/JobsOperations.cs +++ /dev/null @@ -1,974 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// JobsOperations operations. - /// - internal partial class JobsOperations : IServiceOperations, IJobsOperations - { - /// - /// Initializes a new instance of the JobsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal JobsOperations(QuantumClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QuantumClient - /// - public QuantumClient Client { get; private set; } - - /// - /// List jobs. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get job by id - /// - /// - /// Id of the job. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string jobId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - if (jobId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jobId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("jobId", jobId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - _url = _url.Replace("{jobId}", System.Uri.EscapeDataString(jobId)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create a job. - /// - /// - /// Id of the job. - /// - /// - /// The complete metadata of the job to submit. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateWithHttpMessagesAsync(string jobId, JobDetails job, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - if (jobId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jobId"); - } - if (job == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "job"); - } - if (job != null) - { - job.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("jobId", jobId); - tracingParameters.Add("job", job); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - _url = _url.Replace("{jobId}", System.Uri.EscapeDataString(jobId)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(job != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(job, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Cancel a job. - /// - /// - /// Id of the job. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task CancelWithHttpMessagesAsync(string jobId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - if (jobId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jobId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("jobId", jobId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - _url = _url.Replace("{jobId}", System.Uri.EscapeDataString(jobId)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List jobs. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/JobsOperationsExtensions.cs b/src/Azure/Azure.Quantum.Client/generated/JobsOperationsExtensions.cs deleted file mode 100644 index 24fa241b994..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/JobsOperationsExtensions.cs +++ /dev/null @@ -1,192 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for JobsOperations. - /// - public static partial class JobsOperationsExtensions - { - /// - /// List jobs. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IJobsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// List jobs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IJobsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get job by id - /// - /// - /// The operations group for this extension method. - /// - /// - /// Id of the job. - /// - public static JobDetails Get(this IJobsOperations operations, string jobId) - { - return operations.GetAsync(jobId).GetAwaiter().GetResult(); - } - - /// - /// Get job by id - /// - /// - /// The operations group for this extension method. - /// - /// - /// Id of the job. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IJobsOperations operations, string jobId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(jobId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create a job. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Id of the job. - /// - /// - /// The complete metadata of the job to submit. - /// - public static JobDetails Create(this IJobsOperations operations, string jobId, JobDetails job) - { - return operations.CreateAsync(jobId, job).GetAwaiter().GetResult(); - } - - /// - /// Create a job. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Id of the job. - /// - /// - /// The complete metadata of the job to submit. - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IJobsOperations operations, string jobId, JobDetails job, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(jobId, job, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Cancel a job. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Id of the job. - /// - public static void Cancel(this IJobsOperations operations, string jobId) - { - operations.CancelAsync(jobId).GetAwaiter().GetResult(); - } - - /// - /// Cancel a job. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Id of the job. - /// - /// - /// The cancellation token. - /// - public static async Task CancelAsync(this IJobsOperations operations, string jobId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.CancelWithHttpMessagesAsync(jobId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List jobs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IJobsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List jobs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IJobsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/BlobDetails.cs b/src/Azure/Azure.Quantum.Client/generated/Models/BlobDetails.cs deleted file mode 100644 index 6698af8a001..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/BlobDetails.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Blob details. - /// - public partial class BlobDetails - { - /// - /// Initializes a new instance of the BlobDetails class. - /// - public BlobDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BlobDetails class. - /// - /// The container name. - /// The blob name. - public BlobDetails(string containerName, string blobName = default(string)) - { - ContainerName = containerName; - BlobName = blobName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the container name. - /// - [JsonProperty(PropertyName = "containerName")] - public string ContainerName { get; set; } - - /// - /// Gets or sets the blob name. - /// - [JsonProperty(PropertyName = "blobName")] - public string BlobName { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ContainerName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ContainerName"); - } - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/DimensionScope.cs b/src/Azure/Azure.Quantum.Client/generated/Models/DimensionScope.cs deleted file mode 100644 index 2f00b039adc..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/DimensionScope.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - - /// - /// Defines values for DimensionScope. - /// - public static class DimensionScope - { - public const string Workspace = "Workspace"; - public const string Subscription = "Subscription"; - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/ErrorData.cs b/src/Azure/Azure.Quantum.Client/generated/Models/ErrorData.cs deleted file mode 100644 index c817ad9fa72..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/ErrorData.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An error response from Azure. - /// - public partial class ErrorData - { - /// - /// Initializes a new instance of the ErrorData class. - /// - public ErrorData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorData class. - /// - /// An identifier for the error. Codes are invariant - /// and are intended to be consumed programmatically. - /// A message describing the error, intended to - /// be suitable for displaying in a user interface. - public ErrorData(string code = default(string), string message = default(string)) - { - Code = code; - Message = message; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets an identifier for the error. Codes are invariant and - /// are intended to be consumed programmatically. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a message describing the error, intended to be - /// suitable for displaying in a user interface. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/JobDetails.cs b/src/Azure/Azure.Quantum.Client/generated/Models/JobDetails.cs deleted file mode 100644 index e4a0a5a2711..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/JobDetails.cs +++ /dev/null @@ -1,233 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Job details. - /// - public partial class JobDetails - { - /// - /// Initializes a new instance of the JobDetails class. - /// - public JobDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the JobDetails class. - /// - /// The blob container SAS uri, the - /// container is used to host job data. - /// The format of the input data. - /// The unique identifier for the - /// provider. - /// The target identifier to run the job. - /// The job id. - /// The job name. Is not required for the name to be - /// unique and it's only used for display purposes. - /// The input blob SAS uri, if specified, it - /// will override the default input blob in the container. - /// The input parameters for the job. JSON - /// object used by the target solver. It is expected that the size of - /// this object is small and only used to specify parameters for the - /// execution target, not the input data. - /// The job metadata. Metadata provides client - /// the ability to store client-specific information - /// The output blob SAS uri. When a job - /// finishes successfully, results will be uploaded to this - /// blob. - /// The format of the output - /// data. - /// The job status. Possible values include: - /// 'Waiting', 'Executing', 'Succeeded', 'Failed', 'Cancelled' - /// The creation time of the job. - /// The time when the job began - /// execution. - /// The time when the job finished - /// execution. - /// The time when a job was successfully - /// cancelled. - /// The error data for the job. This is - /// expected only when Status 'Failed'. - public JobDetails(string containerUri, string inputDataFormat, string providerId, string target, string id = default(string), string name = default(string), string inputDataUri = default(string), object inputParams = default(object), IDictionary metadata = default(IDictionary), string outputDataUri = default(string), string outputDataFormat = default(string), string status = default(string), System.DateTime? creationTime = default(System.DateTime?), System.DateTime? beginExecutionTime = default(System.DateTime?), System.DateTime? endExecutionTime = default(System.DateTime?), System.DateTime? cancellationTime = default(System.DateTime?), ErrorData errorData = default(ErrorData)) - { - Id = id; - Name = name; - ContainerUri = containerUri; - InputDataUri = inputDataUri; - InputDataFormat = inputDataFormat; - InputParams = inputParams; - ProviderId = providerId; - Target = target; - Metadata = metadata; - OutputDataUri = outputDataUri; - OutputDataFormat = outputDataFormat; - Status = status; - CreationTime = creationTime; - BeginExecutionTime = beginExecutionTime; - EndExecutionTime = endExecutionTime; - CancellationTime = cancellationTime; - ErrorData = errorData; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the job id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the job name. Is not required for the name to be - /// unique and it's only used for display purposes. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the blob container SAS uri, the container is used to - /// host job data. - /// - [JsonProperty(PropertyName = "containerUri")] - public string ContainerUri { get; set; } - - /// - /// Gets or sets the input blob SAS uri, if specified, it will override - /// the default input blob in the container. - /// - [JsonProperty(PropertyName = "inputDataUri")] - public string InputDataUri { get; set; } - - /// - /// Gets or sets the format of the input data. - /// - [JsonProperty(PropertyName = "inputDataFormat")] - public string InputDataFormat { get; set; } - - /// - /// Gets or sets the input parameters for the job. JSON object used by - /// the target solver. It is expected that the size of this object is - /// small and only used to specify parameters for the execution target, - /// not the input data. - /// - [JsonProperty(PropertyName = "inputParams")] - public object InputParams { get; set; } - - /// - /// Gets or sets the unique identifier for the provider. - /// - [JsonProperty(PropertyName = "providerId")] - public string ProviderId { get; set; } - - /// - /// Gets or sets the target identifier to run the job. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - /// - /// Gets or sets the job metadata. Metadata provides client the ability - /// to store client-specific information - /// - [JsonProperty(PropertyName = "metadata")] - public IDictionary Metadata { get; set; } - - /// - /// Gets or sets the output blob SAS uri. When a job finishes - /// successfully, results will be uploaded to this blob. - /// - [JsonProperty(PropertyName = "outputDataUri")] - public string OutputDataUri { get; set; } - - /// - /// Gets or sets the format of the output data. - /// - [JsonProperty(PropertyName = "outputDataFormat")] - public string OutputDataFormat { get; set; } - - /// - /// Gets the job status. Possible values include: 'Waiting', - /// 'Executing', 'Succeeded', 'Failed', 'Cancelled' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - - /// - /// Gets the creation time of the job. - /// - [JsonProperty(PropertyName = "creationTime")] - public System.DateTime? CreationTime { get; private set; } - - /// - /// Gets the time when the job began execution. - /// - [JsonProperty(PropertyName = "beginExecutionTime")] - public System.DateTime? BeginExecutionTime { get; private set; } - - /// - /// Gets the time when the job finished execution. - /// - [JsonProperty(PropertyName = "endExecutionTime")] - public System.DateTime? EndExecutionTime { get; private set; } - - /// - /// Gets the time when a job was successfully cancelled. - /// - [JsonProperty(PropertyName = "cancellationTime")] - public System.DateTime? CancellationTime { get; private set; } - - /// - /// Gets the error data for the job. This is expected only when Status - /// 'Failed'. - /// - [JsonProperty(PropertyName = "errorData")] - public ErrorData ErrorData { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ContainerUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ContainerUri"); - } - if (InputDataFormat == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "InputDataFormat"); - } - if (ProviderId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ProviderId"); - } - if (Target == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Target"); - } - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/JobStatus.cs b/src/Azure/Azure.Quantum.Client/generated/Models/JobStatus.cs deleted file mode 100644 index cf79f42d3e9..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/JobStatus.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - - /// - /// Defines values for JobStatus. - /// - public static class JobStatus - { - public const string Waiting = "Waiting"; - public const string Executing = "Executing"; - public const string Succeeded = "Succeeded"; - public const string Failed = "Failed"; - public const string Cancelled = "Cancelled"; - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/MeterPeriod.cs b/src/Azure/Azure.Quantum.Client/generated/Models/MeterPeriod.cs deleted file mode 100644 index c8c8092b34f..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/MeterPeriod.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - - /// - /// Defines values for MeterPeriod. - /// - public static class MeterPeriod - { - public const string None = "None"; - public const string Monthly = "Monthly"; - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/Page.cs b/src/Azure/Azure.Quantum.Client/generated/Models/Page.cs deleted file mode 100644 index faf255dd623..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/Page.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - - /// - /// Defines a page in Azure responses. - /// - /// Type of the page content items - [JsonObject] - public class Page : IPage - { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/ProviderAvailability.cs b/src/Azure/Azure.Quantum.Client/generated/Models/ProviderAvailability.cs deleted file mode 100644 index 73232a3ff71..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/ProviderAvailability.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - - /// - /// Defines values for ProviderAvailability. - /// - public static class ProviderAvailability - { - public const string Available = "Available"; - public const string Degraded = "Degraded"; - public const string Unavailable = "Unavailable"; - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/ProviderStatus.cs b/src/Azure/Azure.Quantum.Client/generated/Models/ProviderStatus.cs deleted file mode 100644 index 43baf39b445..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/ProviderStatus.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Providers status. - /// - public partial class ProviderStatus - { - /// - /// Initializes a new instance of the ProviderStatus class. - /// - public ProviderStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProviderStatus class. - /// - /// Provider id. - /// Provider availability. Possible - /// values include: 'Available', 'Degraded', 'Unavailable' - public ProviderStatus(string id = default(string), string currentAvailability = default(string), IList targets = default(IList)) - { - Id = id; - CurrentAvailability = currentAvailability; - Targets = targets; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets provider id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets provider availability. Possible values include: 'Available', - /// 'Degraded', 'Unavailable' - /// - [JsonProperty(PropertyName = "currentAvailability")] - public string CurrentAvailability { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "targets")] - public IList Targets { get; private set; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/Quota.cs b/src/Azure/Azure.Quantum.Client/generated/Models/Quota.cs deleted file mode 100644 index dc0ca8d75aa..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/Quota.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Quota information. - /// - public partial class Quota - { - /// - /// Initializes a new instance of the Quota class. - /// - public Quota() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Quota class. - /// - /// The name of the dimension associated with - /// the quota. - /// The scope at which the quota is applied. - /// Possible values include: 'Workspace', 'Subscription' - /// The unique identifier for the - /// provider. - /// The amount of the usage that has been - /// applied for the current period. - /// The amount of the usage that has been reserved - /// but not applied for the current period. - /// The maximum amount of usage allowed for the - /// current period. - /// The time period in which the quota's - /// underlying meter is accumulated. Based on calendar year. 'None' is - /// used for concurrent quotas. Possible values include: 'None', - /// 'Monthly' - public Quota(string dimension = default(string), string scope = default(string), string providerId = default(string), double? utilization = default(double?), double? holds = default(double?), double? limit = default(double?), string period = default(string)) - { - Dimension = dimension; - Scope = scope; - ProviderId = providerId; - Utilization = utilization; - Holds = holds; - Limit = limit; - Period = period; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the dimension associated with the quota. - /// - [JsonProperty(PropertyName = "dimension")] - public string Dimension { get; set; } - - /// - /// Gets or sets the scope at which the quota is applied. Possible - /// values include: 'Workspace', 'Subscription' - /// - [JsonProperty(PropertyName = "scope")] - public string Scope { get; set; } - - /// - /// Gets or sets the unique identifier for the provider. - /// - [JsonProperty(PropertyName = "providerId")] - public string ProviderId { get; set; } - - /// - /// Gets or sets the amount of the usage that has been applied for the - /// current period. - /// - [JsonProperty(PropertyName = "utilization")] - public double? Utilization { get; set; } - - /// - /// Gets or sets the amount of the usage that has been reserved but not - /// applied for the current period. - /// - [JsonProperty(PropertyName = "holds")] - public double? Holds { get; set; } - - /// - /// Gets or sets the maximum amount of usage allowed for the current - /// period. - /// - [JsonProperty(PropertyName = "limit")] - public double? Limit { get; set; } - - /// - /// Gets or sets the time period in which the quota's underlying meter - /// is accumulated. Based on calendar year. 'None' is used for - /// concurrent quotas. Possible values include: 'None', 'Monthly' - /// - [JsonProperty(PropertyName = "period")] - public string Period { get; set; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/RestError.cs b/src/Azure/Azure.Quantum.Client/generated/Models/RestError.cs deleted file mode 100644 index 3545335a6ba..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/RestError.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Error information returned by the API - /// - public partial class RestError - { - /// - /// Initializes a new instance of the RestError class. - /// - public RestError() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RestError class. - /// - public RestError(ErrorData error = default(ErrorData)) - { - Error = error; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "error")] - public ErrorData Error { get; set; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/RestErrorException.cs b/src/Azure/Azure.Quantum.Client/generated/Models/RestErrorException.cs deleted file mode 100644 index cb5804185a0..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/RestErrorException.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Microsoft.Rest; - - /// - /// Exception thrown for an invalid response with RestError information. - /// - public partial class RestErrorException : RestException - { - /// - /// Gets information about the associated HTTP request. - /// - public HttpRequestMessageWrapper Request { get; set; } - - /// - /// Gets information about the associated HTTP response. - /// - public HttpResponseMessageWrapper Response { get; set; } - - /// - /// Gets or sets the body object. - /// - public RestError Body { get; set; } - - /// - /// Initializes a new instance of the RestErrorException class. - /// - public RestErrorException() - { - } - - /// - /// Initializes a new instance of the RestErrorException class. - /// - /// The exception message. - public RestErrorException(string message) - : this(message, null) - { - } - - /// - /// Initializes a new instance of the RestErrorException class. - /// - /// The exception message. - /// Inner exception. - public RestErrorException(string message, System.Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/SasUriResponse.cs b/src/Azure/Azure.Quantum.Client/generated/Models/SasUriResponse.cs deleted file mode 100644 index b811d2e06a6..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/SasUriResponse.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Get SAS URL operation response. - /// - public partial class SasUriResponse - { - /// - /// Initializes a new instance of the SasUriResponse class. - /// - public SasUriResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SasUriResponse class. - /// - /// A URL with a SAS token to upload a blob for - /// execution in the given workspace. - public SasUriResponse(string sasUri = default(string)) - { - SasUri = sasUri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a URL with a SAS token to upload a blob for execution - /// in the given workspace. - /// - [JsonProperty(PropertyName = "sasUri")] - public string SasUri { get; set; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/TargetAvailability.cs b/src/Azure/Azure.Quantum.Client/generated/Models/TargetAvailability.cs deleted file mode 100644 index a2009e7852c..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/TargetAvailability.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - - /// - /// Defines values for TargetAvailability. - /// - public static class TargetAvailability - { - public const string Available = "Available"; - public const string Degraded = "Degraded"; - public const string Unavailable = "Unavailable"; - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/Models/TargetStatus.cs b/src/Azure/Azure.Quantum.Client/generated/Models/TargetStatus.cs deleted file mode 100644 index 78c150b3c95..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/Models/TargetStatus.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Target status. - /// - public partial class TargetStatus - { - /// - /// Initializes a new instance of the TargetStatus class. - /// - public TargetStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TargetStatus class. - /// - /// Target id. - /// Target availability. Possible - /// values include: 'Available', 'Degraded', 'Unavailable' - /// Average queue time in - /// seconds. - /// A page with detailed status of the - /// provider. - public TargetStatus(string id = default(string), string currentAvailability = default(string), long? averageQueueTime = default(long?), string statusPage = default(string)) - { - Id = id; - CurrentAvailability = currentAvailability; - AverageQueueTime = averageQueueTime; - StatusPage = statusPage; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets target id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets target availability. Possible values include: 'Available', - /// 'Degraded', 'Unavailable' - /// - [JsonProperty(PropertyName = "currentAvailability")] - public string CurrentAvailability { get; private set; } - - /// - /// Gets average queue time in seconds. - /// - [JsonProperty(PropertyName = "averageQueueTime")] - public long? AverageQueueTime { get; private set; } - - /// - /// Gets a page with detailed status of the provider. - /// - [JsonProperty(PropertyName = "statusPage")] - public string StatusPage { get; private set; } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/ProvidersOperations.cs b/src/Azure/Azure.Quantum.Client/generated/ProvidersOperations.cs deleted file mode 100644 index 9cf8af20c06..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/ProvidersOperations.cs +++ /dev/null @@ -1,397 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ProvidersOperations operations. - /// - internal partial class ProvidersOperations : IServiceOperations, IProvidersOperations - { - /// - /// Initializes a new instance of the ProvidersOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ProvidersOperations(QuantumClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QuantumClient - /// - public QuantumClient Client { get; private set; } - - /// - /// Get provider status. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> GetStatusWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetStatus", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/providerStatus").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get provider status. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> GetStatusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetStatusNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/ProvidersOperationsExtensions.cs b/src/Azure/Azure.Quantum.Client/generated/ProvidersOperationsExtensions.cs deleted file mode 100644 index 649d483f64a..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/ProvidersOperationsExtensions.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ProvidersOperations. - /// - public static partial class ProvidersOperationsExtensions - { - /// - /// Get provider status. - /// - /// - /// The operations group for this extension method. - /// - public static IPage GetStatus(this IProvidersOperations operations) - { - return operations.GetStatusAsync().GetAwaiter().GetResult(); - } - - /// - /// Get provider status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> GetStatusAsync(this IProvidersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetStatusWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get provider status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage GetStatusNext(this IProvidersOperations operations, string nextPageLink) - { - return operations.GetStatusNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get provider status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> GetStatusNextAsync(this IProvidersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetStatusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/QuantumClient.cs b/src/Azure/Azure.Quantum.Client/generated/QuantumClient.cs deleted file mode 100644 index 7344a8506c4..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/QuantumClient.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - - /// - /// Azure Quantum REST API client - /// - public partial class QuantumClient : ServiceClient, IQuantumClient, IAzureClient - { - /// - /// The base URI of the service. - /// - public System.Uri BaseUri { get; set; } - - /// - /// Gets or sets json serialization settings. - /// - public JsonSerializerSettings SerializationSettings { get; private set; } - - /// - /// Gets or sets json deserialization settings. - /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - - /// - /// Credentials needed for the client to connect to Azure. - /// - public ServiceClientCredentials Credentials { get; private set; } - - /// - /// The Azure subscription ID. This is a GUID-formatted string (e.g. - /// 00000000-0000-0000-0000-000000000000) - /// - public string SubscriptionId { get; set; } - - /// - /// Name of an Azure resource group. - /// - public string ResourceGroupName { get; set; } - - /// - /// Name of the workspace. - /// - public string WorkspaceName { get; set; } - - /// - /// The preferred language for the response. - /// - public string AcceptLanguage { get; set; } - - /// - /// The retry timeout in seconds for Long Running Operations. Default value is - /// 30. - /// - public int? LongRunningOperationRetryTimeout { get; set; } - - /// - /// Whether a unique x-ms-client-request-id should be generated. When set to - /// true a unique x-ms-client-request-id value is generated and included in - /// each request. Default is true. - /// - public bool? GenerateClientRequestId { get; set; } - - /// - /// Gets the IJobsOperations. - /// - public virtual IJobsOperations Jobs { get; private set; } - - /// - /// Gets the IProvidersOperations. - /// - public virtual IProvidersOperations Providers { get; private set; } - - /// - /// Gets the IStorageOperations. - /// - public virtual IStorageOperations Storage { get; private set; } - - /// - /// Gets the IQuotasOperations. - /// - public virtual IQuotasOperations Quotas { get; private set; } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling QuantumClient.Dispose(). False: will not dispose provided httpClient - protected QuantumClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected QuantumClient(params DelegatingHandler[] handlers) : base(handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected QuantumClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - protected QuantumClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - BaseUri = baseUri; - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - protected QuantumClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - BaseUri = baseUri; - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QuantumClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling QuantumClient.Dispose(). False: will not dispose provided httpClient - /// - /// Thrown when a required parameter is null - /// - public QuantumClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QuantumClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QuantumClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QuantumClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QuantumClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// An optional partial-method to perform custom initialization. - /// - partial void CustomInitialize(); - /// - /// Initializes client properties. - /// - private void Initialize() - { - Jobs = new JobsOperations(this); - Providers = new ProvidersOperations(this); - Storage = new StorageOperations(this); - Quotas = new QuotasOperations(this); - BaseUri = new System.Uri("https://quantum.azure.com"); - AcceptLanguage = "en-US"; - LongRunningOperationRetryTimeout = 30; - GenerateClientRequestId = true; - SerializationSettings = new JsonSerializerSettings - { - Formatting = Newtonsoft.Json.Formatting.Indented, - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - DeserializationSettings = new JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - CustomInitialize(); - DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); - } - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/QuotasOperations.cs b/src/Azure/Azure.Quantum.Client/generated/QuotasOperations.cs deleted file mode 100644 index 639526087e5..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/QuotasOperations.cs +++ /dev/null @@ -1,397 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// QuotasOperations operations. - /// - internal partial class QuotasOperations : IServiceOperations, IQuotasOperations - { - /// - /// Initializes a new instance of the QuotasOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal QuotasOperations(QuantumClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QuantumClient - /// - public QuantumClient Client { get; private set; } - - /// - /// List quotas for the given workspace. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/quotas").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List quotas for the given workspace. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/QuotasOperationsExtensions.cs b/src/Azure/Azure.Quantum.Client/generated/QuotasOperationsExtensions.cs deleted file mode 100644 index 99f5cc55e9b..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/QuotasOperationsExtensions.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for QuotasOperations. - /// - public static partial class QuotasOperationsExtensions - { - /// - /// List quotas for the given workspace. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IQuotasOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// List quotas for the given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IQuotasOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List quotas for the given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IQuotasOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List quotas for the given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IQuotasOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/StorageOperations.cs b/src/Azure/Azure.Quantum.Client/generated/StorageOperations.cs deleted file mode 100644 index 885842c24c3..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/StorageOperations.cs +++ /dev/null @@ -1,249 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// StorageOperations operations. - /// - internal partial class StorageOperations : IServiceOperations, IStorageOperations - { - /// - /// Initializes a new instance of the StorageOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal StorageOperations(QuantumClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QuantumClient - /// - public QuantumClient Client { get; private set; } - - /// - /// Gets a URL with SAS token for a container/blob in the storage account - /// associated with the workspace. The SAS URL can be used to upload job input - /// and/or download job output. - /// - /// - /// The details (name and container) of the blob to store or download data. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> SasUriWithHttpMessagesAsync(BlobDetails blobDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); - } - if (Client.WorkspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.WorkspaceName"); - } - if (blobDetails == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "blobDetails"); - } - if (blobDetails != null) - { - blobDetails.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("blobDetails", blobDetails); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SasUri", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/storage/sasUri").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(Client.WorkspaceName)); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(blobDetails != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(blobDetails, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new RestErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - RestError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/Azure/Azure.Quantum.Client/generated/StorageOperationsExtensions.cs b/src/Azure/Azure.Quantum.Client/generated/StorageOperationsExtensions.cs deleted file mode 100644 index a01a20f0eb9..00000000000 --- a/src/Azure/Azure.Quantum.Client/generated/StorageOperationsExtensions.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Quantum.Client -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for StorageOperations. - /// - public static partial class StorageOperationsExtensions - { - /// - /// Gets a URL with SAS token for a container/blob in the storage account - /// associated with the workspace. The SAS URL can be used to upload job input - /// and/or download job output. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The details (name and container) of the blob to store or download data. - /// - public static SasUriResponse SasUri(this IStorageOperations operations, BlobDetails blobDetails) - { - return operations.SasUriAsync(blobDetails).GetAwaiter().GetResult(); - } - - /// - /// Gets a URL with SAS token for a container/blob in the storage account - /// associated with the workspace. The SAS URL can be used to upload job input - /// and/or download job output. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The details (name and container) of the blob to store or download data. - /// - /// - /// The cancellation token. - /// - public static async Task SasUriAsync(this IStorageOperations operations, BlobDetails blobDetails, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.SasUriWithHttpMessagesAsync(blobDetails, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/Simulation/EntryPointDriver/Azure.cs b/src/Simulation/EntryPointDriver/Azure.cs index 9f33f7baec5..b013a7f93e5 100644 --- a/src/Simulation/EntryPointDriver/Azure.cs +++ b/src/Simulation/EntryPointDriver/Azure.cs @@ -4,6 +4,9 @@ using System; using System.Linq; using System.Threading.Tasks; + +using Azure.Core; + using Microsoft.Azure.Quantum; using Microsoft.Azure.Quantum.Exceptions; using Microsoft.Quantum.Runtime; @@ -208,12 +211,12 @@ public sealed class AzureSettings public string? Subscription { get; set; } /// - /// The resource group name. + /// The Azure Quantum Workspace's resource group name. /// public string? ResourceGroup { get; set; } /// - /// The workspace name. + /// The Azure Quantum Workspace's name. /// public string? Workspace { get; set; } @@ -233,14 +236,7 @@ public sealed class AzureSettings public string? AadToken { get; set; } /// - /// The base URI of the Azure Quantum endpoint. - /// If both and properties are not null, takes precedence. - /// - public Uri? BaseUri { get; set; } - - /// - /// The location to use with the default Azure Quantum endpoint. - /// If both and properties are not null, takes precedence. + /// The Azure Quantum Workspace's location (region). /// public string? Location { get; set; } @@ -269,30 +265,47 @@ public sealed class AzureSettings /// public bool Verbose { get; set; } + /// + /// Print a warning about passing an AAD token. Using this is not supported anymore but we keep + /// the parameter to break any existing clients, like the az cli. + /// Once the known clients are updated we should remove the parameter too. + /// + internal void PrintAadWarning() + { + Console.ForegroundColor = ConsoleColor.Yellow; + + if (!(AadToken is null)) + { + try + { + Console.Error.WriteLine("----------------------------------------------------------------------------"); + Console.Error.WriteLine(" [Warning]"); + Console.Error.WriteLine(" The AadToken parameter is not supported anymore."); + Console.Error.WriteLine(" Take a look at the Azure Identity client library at"); + Console.Error.WriteLine(" https://docs.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme"); + Console.Error.WriteLine(" for new authentication options."); + Console.Error.WriteLine("----------------------------------------------------------------------------"); + } + finally + { + Console.ResetColor(); + } + } + } + /// /// Creates a based on the settings. /// /// The based on the settings. internal Workspace CreateWorkspace() { - if (BaseUri != null) - { - return AadToken is null - ? new Workspace(Subscription, ResourceGroup, Workspace, baseUri: BaseUri) - : new Workspace(Subscription, ResourceGroup, Workspace, AadToken, baseUri: BaseUri); - } - else if (Location != null) - { - return AadToken is null - ? new Workspace(Subscription, ResourceGroup, Workspace, location: NormalizeLocation(Location)) - : new Workspace(Subscription, ResourceGroup, Workspace, AadToken, location: NormalizeLocation(Location)); - } - else - { - return AadToken is null - ? new Workspace(Subscription, ResourceGroup, Workspace, baseUri: null) - : new Workspace(Subscription, ResourceGroup, Workspace, AadToken, baseUri: null); - } + PrintAadWarning(); + + return new Workspace( + subscriptionId: Subscription, + resourceGroupName: ResourceGroup, + workspaceName: Workspace, + location: NormalizeLocation(Location)); } public override string ToString() => @@ -302,8 +315,6 @@ public override string ToString() => $"Workspace: {Workspace}", $"Target: {Target}", $"Storage: {Storage}", - $"AAD Token: {AadToken}", - $"Base URI: {BaseUri}", $"Location: {Location}", $"Job Name: {JobName}", $"Shots: {Shots}", @@ -311,7 +322,7 @@ public override string ToString() => $"Dry Run: {DryRun}", $"Verbose: {Verbose}"); - internal static string NormalizeLocation(string location) => - string.Concat(location.Where(c => !char.IsWhiteSpace(c))).ToLower(); + internal static string NormalizeLocation(string? location) => + string.Concat(location?.Where(c => !char.IsWhiteSpace(c)) ?? "").ToLower(); } } diff --git a/src/Simulation/EntryPointDriver/Driver.cs b/src/Simulation/EntryPointDriver/Driver.cs index 7997a87db01..7fa7c73a1a9 100644 --- a/src/Simulation/EntryPointDriver/Driver.cs +++ b/src/Simulation/EntryPointDriver/Driver.cs @@ -457,11 +457,10 @@ private Task Submit(ParseResult parseResult, AzureSettings azureSettings, I Subscription = azureSettings.Subscription, ResourceGroup = azureSettings.ResourceGroup, Workspace = azureSettings.Workspace, + Location = azureSettings.Location, Target = DefaultIfShadowed(entryPoint, this.TargetOption, azureSettings.Target), Storage = DefaultIfShadowed(entryPoint, StorageOption, azureSettings.Storage), AadToken = DefaultIfShadowed(entryPoint, AadTokenOption, azureSettings.AadToken), - BaseUri = DefaultIfShadowed(entryPoint, BaseUriOption, azureSettings.BaseUri), - Location = DefaultIfShadowed(entryPoint, LocationOption, azureSettings.Location), JobName = DefaultIfShadowed(entryPoint, JobNameOption, azureSettings.JobName), Shots = DefaultIfShadowed(entryPoint, ShotsOption, azureSettings.Shots), Output = DefaultIfShadowed(entryPoint, OutputOption, azureSettings.Output), From a761f1b7c983ff276307cd28d2fdc732d4d92384 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Fri, 14 May 2021 09:08:56 -0700 Subject: [PATCH 10/20] tests compile --- .../Helpers/MockHelper.cs | 5 +-- .../Helpers/TestConstants.cs | 1 + .../WorkspaceTest.cs | 38 +++++++++++-------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs b/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs index cf34b116987..aecba7ee075 100644 --- a/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs +++ b/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs @@ -7,7 +7,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Quantum.Client; +using Azure.Quantum.Jobs; using Moq; using Moq.Protected; @@ -41,10 +41,9 @@ public HttpClient GetHttpClientMock() return new HttpClient(mock.Object); } - public class MockQuantumClient : QuantumClient + public class MockQuantumClient : QuantumJobClient { public MockQuantumClient(MockHelper mock) - : base(mock.GetHttpClientMock(), true) { } } diff --git a/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs b/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs index 6cc2c8aa96d..a65abbc36da 100644 --- a/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs +++ b/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs @@ -10,5 +10,6 @@ public static class TestConstants public const string WorkspaceName = "ws1"; public const string ProviderId = "provider1"; public const string Endpoint = "https://test"; + public const string Location = "westus"; } } diff --git a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs index 48485da8f28..5e943c6e36b 100644 --- a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs +++ b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs @@ -6,10 +6,12 @@ using System.Linq; using System.Net; using System.Net.Http; -using Microsoft.Azure.Quantum.Client; -using Microsoft.Azure.Quantum.Client.Models; + +using Azure.Quantum.Jobs.Models; + using Microsoft.Azure.Quantum.Exceptions; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Newtonsoft.Json; namespace Microsoft.Azure.Quantum.Test @@ -150,10 +152,11 @@ public void CancelJobTest() public void ListJobsTest() { // Craft response - JobDetails jobDetails = new JobDetails - { - ProviderId = TestConstants.ProviderId, - }; + JobDetails jobDetails = new JobDetails( + containerUri: string.Empty, + inputDataFormat: string.Empty, + providerId: TestConstants.ProviderId, + target: string.Empty); dynamic page = new { @@ -189,16 +192,17 @@ private IWorkspace GetWorkspace() return new Workspace( subscriptionId: TestConstants.SubscriptionId, resourceGroupName: TestConstants.ResourceGroupName, - workspaceName: TestConstants.WorkspaceName) + workspaceName: TestConstants.WorkspaceName, + location: TestConstants.Location) { // Mock jobs client (only needed for unit tests) - QuantumClient = new MockHelper.MockQuantumClient(httpMock) - { - SubscriptionId = TestConstants.SubscriptionId, - ResourceGroupName = TestConstants.ResourceGroupName, - WorkspaceName = TestConstants.WorkspaceName, - BaseUri = new Uri(TestConstants.Endpoint), - }, + QuantumClient = new MockHelper.MockQuantumClient(httpMock), + //{ + // SubscriptionId = TestConstants.SubscriptionId, + // ResourceGroupName = TestConstants.ResourceGroupName, + // WorkspaceName = TestConstants.WorkspaceName, + // Loca = new Uri(TestConstants.Endpoint), + //}, }; } @@ -213,11 +217,13 @@ private void SetJobResponseMessage(string jobId) private static JobDetails CreateJobDetails(string jobId) { return new JobDetails( - id: jobId, containerUri: "https://uri", inputDataFormat: "format1", providerId: TestConstants.ProviderId, - target: "target"); + target: "target") + { + Id = jobId, + }; } private void ValidateJobRequestMessage( From 595ab9dacae738ee953f647d533ced3a561d7956 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 19 May 2021 01:26:11 -0700 Subject: [PATCH 11/20] fixing entrypoint tests. --- .../EntryPointDriver.Tests/Tests.fs | 102 +++++++++++------- src/Simulation/EntryPointDriver/Azure.cs | 36 ++++++- src/Simulation/EntryPointDriver/Driver.cs | 4 +- 3 files changed, 100 insertions(+), 42 deletions(-) diff --git a/src/Simulation/EntryPointDriver.Tests/Tests.fs b/src/Simulation/EntryPointDriver.Tests/Tests.fs index 9ca3ad61330..b5b9837b9d6 100644 --- a/src/Simulation/EntryPointDriver.Tests/Tests.fs +++ b/src/Simulation/EntryPointDriver.Tests/Tests.fs @@ -192,7 +192,7 @@ let private testWithTarget defaultTarget = |> testWithConstants /// Standard command-line arguments for the "submit" command without specifying a target. -let private submitWithoutTarget = +let private submitWithoutTargetAndLocation = [ "submit" "--subscription" "mySubscription" @@ -201,6 +201,10 @@ let private submitWithoutTarget = "--workspace" "myWorkspace" ] + +/// Standard command-line arguments for the "submit" command without specifying a target. +let private submitWithoutTarget = submitWithoutTargetAndLocation @ ["--location"; "myLocation"] + /// Standard command-line arguments for the "submit" command using the "test.nothing" target. let private submitWithNothingTarget = submitWithoutTarget @ ["--target"; "test.nothing"] @@ -562,9 +566,8 @@ let ``Submit uses default values`` () = Workspace: myWorkspace Target: test.nothing Storage: - AAD Token: Base URI: - Location: + Location: myLocation Job Name: Shots: 500 Output: FriendlyUri @@ -582,9 +585,8 @@ let ``Submit uses default values with default target`` () = Workspace: myWorkspace Target: test.nothing Storage: - AAD Token: Base URI: - Location: + Location: myLocation Job Name: Shots: 500 Output: FriendlyUri @@ -602,8 +604,6 @@ let ``Submit allows overriding default values`` () = "myStorage" "--aad-token" "myToken" - "--base-uri" - "myBaseUri" "--job-name" "myJobName" "--shots" @@ -614,9 +614,8 @@ let ``Submit allows overriding default values`` () = Workspace: myWorkspace Target: test.nothing Storage: myStorage - AAD Token: myToken - Base URI: myBaseUri - Location: + Base URI: + Location: myLocation Job Name: myJobName Shots: 750 Output: FriendlyUri @@ -624,7 +623,40 @@ let ``Submit allows overriding default values`` () = Verbose: True https://www.example.com/00000000-0000-0000-0000-0000000000000" - + +[] +let ``Submit extracts the location from a quantum endpoint`` () = + let given = test "Returns Unit" + given (submitWithoutTargetAndLocation @ [ + "--verbose" + "--storage" + "myStorage" + "--aad-token" + "myToken" + "--base-uri" + "https://westus.quantum.microsoft.com/" + "--job-name" + "myJobName" + "--shots" + "750" + "--target" + "test.nothing" + ]) + |> yields "Subscription: mySubscription + Resource Group: myResourceGroup + Workspace: myWorkspace + Target: test.nothing + Storage: myStorage + Base URI: https://westus.quantum.microsoft.com/ + Location: westus + Job Name: myJobName + Shots: 750 + Output: FriendlyUri + Dry Run: False + Verbose: True + + https://www.example.com/00000000-0000-0000-0000-0000000000000" + [] let ``Submit allows overriding default values with default target`` () = let given = testWithTarget "foo.target" "Returns Unit" @@ -634,8 +666,6 @@ let ``Submit allows overriding default values with default target`` () = "myStorage" "--aad-token" "myToken" - "--base-uri" - "myBaseUri" "--job-name" "myJobName" "--shots" @@ -646,9 +676,8 @@ let ``Submit allows overriding default values with default target`` () = Workspace: myWorkspace Target: test.nothing Storage: myStorage - AAD Token: myToken - Base URI: myBaseUri - Location: + Base URI: + Location: myLocation Job Name: myJobName Shots: 750 Output: FriendlyUri @@ -663,27 +692,26 @@ let ``Submit does not allow to include mutually exclusive options`` () = given (submitWithNothingTarget @ [ "--base-uri" "myBaseUri" - "--location" - "myLocation" ]) |> failsWith "Options --base-uri, --location cannot be used together." - + [] let ``Submit allows to include --base-uri option when --location is not present`` () = let given = testWithTarget "foo.target" "Returns Unit" - given (submitWithNothingTarget @ [ + given (submitWithoutTargetAndLocation @ [ "--verbose" "--base-uri" - "myBaseUri" + "http://myBaseUri.foo.com/" + "--target" + "test.nothing" ]) |> yields "Subscription: mySubscription Resource Group: myResourceGroup Workspace: myWorkspace Target: test.nothing Storage: - AAD Token: - Base URI: myBaseUri - Location: + Base URI: http://mybaseuri.foo.com/ + Location: mybaseuri Job Name: Shots: 500 Output: FriendlyUri @@ -697,15 +725,12 @@ let ``Submit allows to include --location option when --base-uri is not present` let given = testWithTarget "foo.target" "Returns Unit" given (submitWithNothingTarget @ [ "--verbose" - "--location" - "myLocation" ]) |> yields "Subscription: mySubscription Resource Group: myResourceGroup Workspace: myWorkspace Target: test.nothing Storage: - AAD Token: Base URI: Location: myLocation Job Name: @@ -719,17 +744,18 @@ let ``Submit allows to include --location option when --base-uri is not present` [] let ``Submit allows spaces for the --location option`` () = let given = test "Returns Unit" - given (submitWithNothingTarget @ [ + given (submitWithoutTargetAndLocation @ [ "--verbose" "--location" "My Location" + "--target" + "test.nothing" ]) |> yields "Subscription: mySubscription Resource Group: myResourceGroup Workspace: myWorkspace Target: test.nothing Storage: - AAD Token: Base URI: Location: My Location Job Name: @@ -739,15 +765,15 @@ let ``Submit allows spaces for the --location option`` () = Verbose: True https://www.example.com/00000000-0000-0000-0000-0000000000000" - + [] -let ``Submit does not allow an invalid value for the --location option`` () = +let ``Submit fails if both --location and --baseUri are missing`` () = let given = test "Returns Unit" - given (submitWithNothingTarget @ [ - "--location" - "my!nv@lidLocation" + given (submitWithoutTargetAndLocation @ [ + "--target" + "test.nothing" ]) - |> failsWith "\"my!nv@lidLocation\" is an invalid value for the --location option." + |> failsWith "Either --location or --base-uri must be provided." [] let ``Submit requires a positive number of shots`` () = @@ -783,7 +809,7 @@ let ``Submit has required options`` () = // Try every possible combination of arguments. The command should succeed only when all of the arguments are // included. - let commandName = List.head submitWithNothingTarget + let commandName = List.head (submitWithoutTargetAndLocation @ ["--target"; "test.nothing"]) let allArgs = submitWithNothingTarget |> List.tail |> List.chunkBySize 2 for args in powerSet allArgs do given (commandName :: List.concat args) @@ -930,6 +956,8 @@ let ``Supports submitting multiple entry points`` () = "myResourceGroup" "--workspace" "myWorkspace" + "--location" + "location" "--target" "test.nothing" ] @@ -951,6 +979,8 @@ let ``Supports submitting multiple entry points with different parameters`` () = "myResourceGroup" "--workspace" "myWorkspace" + "--location" + "location" "--target" "test.nothing" ] diff --git a/src/Simulation/EntryPointDriver/Azure.cs b/src/Simulation/EntryPointDriver/Azure.cs index b013a7f93e5..ab0813e0cc8 100644 --- a/src/Simulation/EntryPointDriver/Azure.cs +++ b/src/Simulation/EntryPointDriver/Azure.cs @@ -38,6 +38,13 @@ public static async Task Submit(EntryPointInfo info, Console.WriteLine(); } + if ((settings.Location is null) && (settings.BaseUri is null)) + { + DisplayWithColor(ConsoleColor.Red, Console.Error, + $"Either --location or --base-uri must be provided."); + return 1; + } + var machine = CreateMachine(settings); if (machine is null) { @@ -235,8 +242,16 @@ public sealed class AzureSettings /// public string? AadToken { get; set; } + /// + /// The base URI of the Azure Quantum endpoint. + /// NOTE: This parameter is deprected, please always use . + /// If both and properties are not null, takes precedence. + /// + public Uri? BaseUri { get; set; } + /// /// The Azure Quantum Workspace's location (region). + /// If both and properties are not null, takes precedence. /// public string? Location { get; set; } @@ -301,11 +316,13 @@ internal Workspace CreateWorkspace() { PrintAadWarning(); + var location = NormalizeLocation(Location ?? ExtractLocation(BaseUri)); + return new Workspace( subscriptionId: Subscription, resourceGroupName: ResourceGroup, workspaceName: Workspace, - location: NormalizeLocation(Location)); + location: location); } public override string ToString() => @@ -315,14 +332,25 @@ public override string ToString() => $"Workspace: {Workspace}", $"Target: {Target}", $"Storage: {Storage}", - $"Location: {Location}", + $"Base URI: {BaseUri}", + $"Location: {Location ?? ExtractLocation(BaseUri)}", $"Job Name: {JobName}", $"Shots: {Shots}", $"Output: {Output}", $"Dry Run: {DryRun}", $"Verbose: {Verbose}"); - internal static string NormalizeLocation(string? location) => - string.Concat(location?.Where(c => !char.IsWhiteSpace(c)) ?? "").ToLower(); + internal static string ExtractLocation(Uri? baseUri) + { + if (baseUri is null || !baseUri.IsAbsoluteUri) + { + return ""; + } + + return baseUri.Host.Substring(0, baseUri.Host.IndexOf('.')); + } + + internal static string NormalizeLocation(string location) => + string.Concat(location.Where(c => !char.IsWhiteSpace(c))).ToLower(); } } diff --git a/src/Simulation/EntryPointDriver/Driver.cs b/src/Simulation/EntryPointDriver/Driver.cs index 7fa7c73a1a9..796cc4556a0 100644 --- a/src/Simulation/EntryPointDriver/Driver.cs +++ b/src/Simulation/EntryPointDriver/Driver.cs @@ -457,10 +457,10 @@ private Task Submit(ParseResult parseResult, AzureSettings azureSettings, I Subscription = azureSettings.Subscription, ResourceGroup = azureSettings.ResourceGroup, Workspace = azureSettings.Workspace, - Location = azureSettings.Location, Target = DefaultIfShadowed(entryPoint, this.TargetOption, azureSettings.Target), Storage = DefaultIfShadowed(entryPoint, StorageOption, azureSettings.Storage), - AadToken = DefaultIfShadowed(entryPoint, AadTokenOption, azureSettings.AadToken), + BaseUri = DefaultIfShadowed(entryPoint, BaseUriOption, azureSettings.BaseUri), + Location = DefaultIfShadowed(entryPoint, LocationOption, azureSettings.Location), JobName = DefaultIfShadowed(entryPoint, JobNameOption, azureSettings.JobName), Shots = DefaultIfShadowed(entryPoint, ShotsOption, azureSettings.Shots), Output = DefaultIfShadowed(entryPoint, OutputOption, azureSettings.Output), From 591745fbeefe7831db2607e19faaed18232bef3c Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 19 May 2021 12:48:56 -0700 Subject: [PATCH 12/20] Switching client tests to live environment --- .../Helpers/MockHelper.cs | 51 --- .../Helpers/Problem.cs | 110 ++++++ .../Helpers/TestConstants.cs | 12 +- .../WorkspaceTest.cs | 331 ++++++++---------- .../Exceptions/WorkspaceClientException.cs | 23 +- .../JobManagement/CloudJob.cs | 17 + .../JobManagement/IWorkspace.cs | 2 +- .../JobManagement/Workspace.cs | 19 +- .../JobManagement/WorkspaceExtensions.cs | 10 - 9 files changed, 293 insertions(+), 282 deletions(-) delete mode 100644 src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs create mode 100644 src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs diff --git a/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs b/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs deleted file mode 100644 index aecba7ee075..00000000000 --- a/src/Azure/Azure.Quantum.Client.Test/Helpers/MockHelper.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// - -using System.Collections.Generic; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - -using Azure.Quantum.Jobs; - -using Moq; -using Moq.Protected; - -namespace Microsoft.Azure.Quantum.Test -{ - public class MockHelper - { - internal List RequestMessages { get; private set; } = new List(); - - internal HttpResponseMessage ResponseMessage { get; set; } - - public HttpClient GetHttpClientMock() - { - Mock mock = new Mock(); - - mock.Protected() - .Setup>("SendAsync", ItExpr.IsAny(), ItExpr.IsAny()) - .Returns((HttpRequestMessage request, CancellationToken token) => - { - RequestMessages.Add(request); - - if (request.Method == HttpMethod.Delete) - { - return Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.NoContent)); - } - - return Task.FromResult(ResponseMessage); - }); - - return new HttpClient(mock.Object); - } - - public class MockQuantumClient : QuantumJobClient - { - public MockQuantumClient(MockHelper mock) - { - } - } - } -} diff --git a/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs b/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs new file mode 100644 index 00000000000..5a92aa91854 --- /dev/null +++ b/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs @@ -0,0 +1,110 @@ +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Quantum.Test +{ + public enum ProblemType : int + { + PUBO = 0, + Ising = 1, + } + + public class Problem + { + private readonly HashSet terms = new HashSet(); + + public Problem(ProblemType type = ProblemType.PUBO) + { + ProblemType = type; + } + + public Problem(IEnumerable collection) + : this() + { + AddRange(collection); + } + + [JsonPropertyName("version")] + public string Version => "1.1"; + + [JsonPropertyName("type")] + [JsonConverter(typeof(JsonStringEnumConverter))] + public ProblemType ProblemType { get; } + + [JsonPropertyName("terms")] + public IEnumerable Terms => terms; + + public void Add(Term term) + { + terms.Add(term); + } + + public void Add(int i, float c) + { + terms.Add(new Term(new int[] { i }, c)); + } + + public void Add(int i, int j, float c) + { + terms.Add(new Term( new int[] { i, j }, c)); + } + + public void Add(int i, int j, int k, float c) + { + terms.Add(new Term( new int[] { i, j, k }, c)); + } + + public void AddRange(IEnumerable collection) + { + foreach (var term in collection) + { + terms.Add(term); + } + } + + public Task SerializeAsync(Stream stream) + { + var root = new SerializationWrapper + { + CostFunction = this, + }; + + // Save to the writer + return JsonSerializer.SerializeAsync(stream, root); + } + + public override string ToString() + { + var root = new SerializationWrapper + { + CostFunction = this, + }; + + return JsonSerializer.Serialize(root); + } + + private struct SerializationWrapper + { + [JsonPropertyName("cost_function")] + public Problem CostFunction { get; set; } + } + + public class Term + { + public Term(int[] ids, float c) + { + this.IDs = ids; + this.Weight = c; + } + + [JsonPropertyName("c")] + public float Weight { get; } + + [JsonPropertyName("ids")] + public int[] IDs { get; } + } + } +} diff --git a/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs b/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs index a65abbc36da..d9007003394 100644 --- a/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs +++ b/src/Azure/Azure.Quantum.Client.Test/Helpers/TestConstants.cs @@ -5,11 +5,11 @@ namespace Microsoft.Azure.Quantum.Test { public static class TestConstants { - public const string SubscriptionId = "sub1"; - public const string ResourceGroupName = "rg1"; - public const string WorkspaceName = "ws1"; - public const string ProviderId = "provider1"; - public const string Endpoint = "https://test"; - public const string Location = "westus"; + // Used when connecting live + public const string LiveSubscriptionId = "916dfd6d-030c-4bd9-b579-7bb6d1926e97"; + public const string LiveLocation = "westus2"; + public const string LiveResourceGroupName = "e2e-scenarios"; + public const string LiveStorageAccount = "e2etests"; + public const string LiveWorkspaceName = "e2e-qsharp-tests"; } } diff --git a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs index 5e943c6e36b..59a986c3fed 100644 --- a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs +++ b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs @@ -3,252 +3,209 @@ using System; using System.Collections.Generic; -using System.Linq; +using System.IO; +using System.IO.Compression; using System.Net; -using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Quantum; using Azure.Quantum.Jobs.Models; using Microsoft.Azure.Quantum.Exceptions; +using Microsoft.Azure.Quantum.Storage; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Newtonsoft.Json; - namespace Microsoft.Azure.Quantum.Test { [TestClass] public class WorkspaceTest { - private MockHelper httpMock; - - [TestInitialize] - public void Init() - { - this.httpMock = new MockHelper(); - } - [TestMethod] - public void SubmitJobTest() + public async Task SubmitJobTest() { - string jobId = Guid.NewGuid().ToString(); - - // Craft response - SetJobResponseMessage(jobId); - // Create Job - IWorkspace workspace = GetWorkspace(); - - JobDetails jobDetails = CreateJobDetails(jobId); - CloudJob job = new CloudJob(workspace, jobDetails); - CloudJob receivedJob; + IWorkspace workspace = GetLiveWorkspace(); - // -ve cases - try - { - jobDetails.ContainerUri = null; - receivedJob = workspace.SubmitJob(job); - Assert.Fail(); - } - catch (WorkspaceClientException) - { - jobDetails.ContainerUri = "https://uri"; - } - - try - { - jobDetails.ProviderId = null; - receivedJob = workspace.SubmitJob(job); - Assert.Fail(); - } - catch (WorkspaceClientException) - { - jobDetails.ProviderId = TestConstants.ProviderId; - } + CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(30000); - // Success - receivedJob = workspace.SubmitJob(job); + var job = await SubmitTestProblem(workspace); + AssertJob(job); - // Validate request - ValidateJobRequestMessage(jobId, HttpMethod.Put); + await job.WaitForCompletion(cancellationToken: cts.Token); - // Validate response - Assert.IsNotNull(receivedJob); - - Assert.IsNotNull(receivedJob.Workspace); - - Assert.AreEqual( - expected: jobId, - actual: receivedJob.Details.Id); + AssertJob(job); + Assert.IsTrue(job.Succeeded); } [TestMethod] - public void GetJobTest() + public async Task GetJobTest() { - string jobId = Guid.NewGuid().ToString(); - - // Craft response - SetJobResponseMessage(jobId); - - // Get Job - IWorkspace workspace = GetWorkspace(); - - CloudJob receivedJob = workspace.GetJob(jobId); + IWorkspace workspace = GetLiveWorkspace(); - // Validate request - ValidateJobRequestMessage(jobId, HttpMethod.Get); - - // Validate response - Assert.IsNotNull(receivedJob); + // Since this is a live workspace, we don't have much control about what jobs are in there + // Get the jobs, and call Get on the first. + await foreach (var job in workspace.ListJobsAsync()) + { + AssertJob(job); - Assert.IsNotNull(receivedJob.Workspace); + var current = workspace.GetJob(job.Id); + AssertJob(current); + Assert.AreEqual(job.Id, current.Id); - Assert.AreEqual( - expected: jobId, - actual: receivedJob.Details.Id); + break; + } } [TestMethod] - public void CancelJobTest() + public async Task CancelJobTest() { - string jobId = Guid.NewGuid().ToString(); - - // Craft response - SetJobResponseMessage(jobId); - - // Cancel Job - IWorkspace workspace = GetWorkspace(); - - CloudJob receivedJob = workspace.CancelJob(jobId); - - // Validate request - ValidateJobRequestMessage(jobId, HttpMethod.Delete, HttpMethod.Get); - - // Validate response - Assert.IsNotNull(receivedJob); - - Assert.IsNotNull(receivedJob.Workspace); - - Assert.AreEqual( - expected: jobId, - actual: receivedJob.Details.Id); - - // Convenience method - CloudJob job = new CloudJob(workspace, CreateJobDetails(jobId)); - string newJobId = Guid.NewGuid().ToString(); - SetJobResponseMessage(newJobId); - - Assert.AreEqual( - jobId, - job.Details.Id); + // Create Job + IWorkspace workspace = GetLiveWorkspace(); - job.CancelAsync().Wait(); + var job = await SubmitTestProblem(workspace); + AssertJob(job); - Assert.AreEqual( - newJobId, - job.Details.Id); + try + { + var result = workspace.CancelJob(job.Id); + AssertJob(result); + } + catch (WorkspaceClientException e) + { + Assert.AreEqual((int)HttpStatusCode.Conflict, e.Status); + } } [TestMethod] - public void ListJobsTest() + public async Task ListJobsTest() { - // Craft response - JobDetails jobDetails = new JobDetails( - containerUri: string.Empty, - inputDataFormat: string.Empty, - providerId: TestConstants.ProviderId, - target: string.Empty); - - dynamic page = new - { - nextLink = (string)null, - value = new JobDetails[] { jobDetails }, - }; + IWorkspace workspace = GetLiveWorkspace(); + int max = 3; - this.httpMock.ResponseMessage = new HttpResponseMessage(HttpStatusCode.OK) + // Since this is a live workspace, we don't have much control about what jobs are in there + // Just make sure there is more than one. + await foreach (var job in workspace.ListJobsAsync()) { - Content = new StringContent(JsonConvert.SerializeObject(page)), - }; - - // Cancel Job - IWorkspace workspace = GetWorkspace(); - - List receivedJobs = workspace.ListJobs().ToList(); - - // Validate request - ValidateJobRequestMessage(null, HttpMethod.Get); - - // Validate response - Assert.IsNotNull(receivedJobs); + Assert.IsNotNull(job); + Assert.IsNotNull(job.Details); + Assert.IsNotNull(job.Workspace); + Assert.IsFalse(string.IsNullOrWhiteSpace(job.Id)); + Assert.AreEqual(job.Details.Id, job.Id); + + max--; + if (max <= 0) + { + break; + } + } - Assert.IsNotNull(receivedJobs.Single().Workspace); + // Make sure we iterated through all the expected jobs: + Assert.AreEqual(0, max); + } - Assert.AreEqual( - expected: jobDetails.ProviderId, - actual: receivedJobs.Single().Details.ProviderId); + private static void AssertJob(CloudJob job) + { + Assert.IsNotNull(job); + Assert.IsNotNull(job.Details); + Assert.IsNotNull(job.Workspace); + Assert.IsFalse(string.IsNullOrEmpty(job.Id)); + Assert.AreEqual(job.Id, job.Details.Id); } - private IWorkspace GetWorkspace() + private IWorkspace GetLiveWorkspace() { + var options = new QuantumJobClientOptions(); + options.Diagnostics.ApplicationId = "ClientTests"; + return new Workspace( - subscriptionId: TestConstants.SubscriptionId, - resourceGroupName: TestConstants.ResourceGroupName, - workspaceName: TestConstants.WorkspaceName, - location: TestConstants.Location) - { - // Mock jobs client (only needed for unit tests) - QuantumClient = new MockHelper.MockQuantumClient(httpMock), - //{ - // SubscriptionId = TestConstants.SubscriptionId, - // ResourceGroupName = TestConstants.ResourceGroupName, - // WorkspaceName = TestConstants.WorkspaceName, - // Loca = new Uri(TestConstants.Endpoint), - //}, - }; + subscriptionId: TestConstants.LiveSubscriptionId, + resourceGroupName: TestConstants.LiveResourceGroupName, + workspaceName: TestConstants.LiveWorkspaceName, + location: TestConstants.LiveLocation, + options: options); } - private void SetJobResponseMessage(string jobId) + private static JobDetails CreateJobDetails(string jobId, string containerUri = null, string inputUri = null) { - this.httpMock.ResponseMessage = new HttpResponseMessage(HttpStatusCode.OK) + return new JobDetails( + containerUri: containerUri, + inputDataFormat: "microsoft.qio.v2", + providerId: "Microsoft", + target: "microsoft.paralleltempering-parameterfree.cpu") { - Content = new StringContent(JsonConvert.SerializeObject(CreateJobDetails(jobId))), + Id = jobId, + Name = "Azure.Quantum.Unittest", + OutputDataFormat = "microsoft.qio-results.v2", + InputParams = new Dictionary() + { + { "params", new Dictionary() }, + }, + InputDataUri = inputUri, }; } - private static JobDetails CreateJobDetails(string jobId) + private static Problem CreateTestProblem() { - return new JobDetails( - containerUri: "https://uri", - inputDataFormat: "format1", - providerId: TestConstants.ProviderId, - target: "target") + // Create an Ising-type problem for shipping-containers + var containerWeights = new int[] { 1, 5, 9, 21, 35, 5, 3, 5, 10, 11 }; + + var problem = new Problem(ProblemType.Ising); + for (int i = 0; i < containerWeights.Length; i++) { - Id = jobId, - }; + for (int j = 0; j < containerWeights.Length; j++) + { + if (i != j) + { + problem.Add(i, j, containerWeights[i] * containerWeights[j]); + } + } + } + + return problem; } - private void ValidateJobRequestMessage( - string jobId, - params HttpMethod[] methods) + private async Task<(string, string)> UploadProblem(IWorkspace workspace, Problem problem, string jobId) { - var requestMessages = httpMock.RequestMessages; - Assert.AreEqual(requestMessages.Count, methods.Length); + string intermediaryFile = Path.GetTempFileName(); + + // Save to the intermediary file + using (var intermediaryWriter = File.Create(intermediaryFile)) + { + using (var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest)) + { + await problem.SerializeAsync(compressionStream); + } + } - for (var i = 0; i < requestMessages.Count; i++) + using (var intermediaryReader = File.OpenRead(intermediaryFile)) { - var requestMessage = requestMessages[i]; - var method = methods[i]; - - // Url - string expectedUri = $"{TestConstants.Endpoint}/v1.0/subscriptions/{TestConstants.SubscriptionId}/resourceGroups/{TestConstants.ResourceGroupName}/providers/Microsoft.Quantum/workspaces/{TestConstants.WorkspaceName}/jobs/{jobId}"; - Assert.AreEqual( - expected: expectedUri.TrimEnd('/'), - actual: requestMessage.RequestUri.ToString()); - - // Method - Assert.AreEqual( - expected: method, - actual: requestMessage.Method); + var jobStorageHelper = new LinkedStorageJobHelper(workspace); + return await jobStorageHelper.UploadJobInputAsync(jobId, intermediaryReader); } } + + private async Task SubmitTestProblem(IWorkspace workspace) + { + CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(30000); + + var jobId = Guid.NewGuid().ToString(); + var problem = CreateTestProblem(); + + // Upload problem: + var (containerUri, inputUri) = await UploadProblem(workspace, problem, jobId); + + CloudJob src = new CloudJob(workspace, CreateJobDetails(jobId, containerUri, inputUri)); + AssertJob(src); + + var job = await workspace.SubmitJobAsync(src, cts.Token); + AssertJob(job); + Assert.AreEqual(jobId, job.Id); + Assert.IsFalse(job.Failed); + + return job; + } } } diff --git a/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs b/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs index e8c669688f5..9c70b86fdcd 100644 --- a/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs +++ b/src/Azure/Azure.Quantum.Client/Exceptions/WorkspaceClientException.cs @@ -12,6 +12,10 @@ public class WorkspaceClientException : AzureQuantumException { private const string BaseMessage = "An exception related to the Azure workspace client occurred"; + public string ErrorCode { get; } + + public int Status { get; } + /// /// Initializes a new instance of the class with a default error message. /// @@ -70,6 +74,12 @@ public WorkspaceClientException( FormatInnerException(inner), inner) { + // Handle specific types of exceptions for additional data + if (inner is global::Azure.RequestFailedException requestException) + { + this.ErrorCode = requestException.ErrorCode; + this.Status = requestException.Status; + } } /// @@ -86,19 +96,6 @@ private static string FormatInnerException(Exception ex) if (ex != null) { formattedException += $"Server Error: {ex.Message}{Environment.NewLine}"; - - //// Handle specific types of exceptions for additional data - //if (ex is RequestFailedException restErrorException) - //{ - // formattedException += $"Error Code: {restErrorException.ErrorCode}{Environment.NewLine}" + - // $"Server message: {restErrorException}{Environment.NewLine}"; - - // var headers = restErrorException?.Response?.Headers; - // if (headers != null && headers.ContainsKey("x-ms-request-id")) - // { - // formattedException += $"Server Request Id: {headers["x-ms-request-id"]}{Environment.NewLine}"; - // } - //} } return formattedException; diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs b/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs index d79c3e87072..87fdef58db6 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs @@ -94,6 +94,23 @@ public async Task CancelAsync(CancellationToken cancellationToken = default) this.Details = job.Details; } + /// + /// Keeps polling the server until the Job status changes to be not in progress. + /// + /// Time to wait between polls. Defaults to 500. + /// Cancellation token. + /// + public async Task WaitForCompletion(int pollIntervalMilliseconds = 500, CancellationToken cancellationToken = default) + { + await this.RefreshAsync(cancellationToken); + + while (this.InProgress) + { + await Task.Delay(TimeSpan.FromMilliseconds(pollIntervalMilliseconds)); + await this.RefreshAsync(); + } + } + private Uri GenerateUri() { if (!(this.Workspace is Workspace cloudWorkspace)) diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs b/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs index a7d9bab7170..a14781101e2 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs @@ -48,7 +48,7 @@ Task GetJobAsync( /// /// The cancellation token. /// List of jobs - Task> ListJobsAsync( + IAsyncEnumerable ListJobsAsync( CancellationToken cancellationToken = default); /// diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs index 39676915019..7ca0c5b82f5 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs @@ -6,6 +6,7 @@ namespace Microsoft.Azure.Quantum using System; using System.Collections.Generic; using System.Linq; + using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using global::Azure.Core; @@ -177,23 +178,13 @@ public async Task GetJobAsync(string jobId, CancellationToken cancella /// /// List of jobs. /// - public async Task> ListJobsAsync(CancellationToken cancellationToken = default) + public async IAsyncEnumerable ListJobsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) { - try - { - var jobs = this.QuantumClient.GetJobsAsync(cancellationToken); - - var result = new List(); - await foreach (var j in jobs) - { - result.Add(new CloudJob(this, j)); - } + var jobs = this.QuantumClient.GetJobsAsync().WithCancellation(cancellationToken); - return result; - } - catch (Exception ex) + await foreach (var j in jobs) { - throw CreateException(ex, "Could not list jobs"); + yield return new CloudJob(this, j); } } diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/WorkspaceExtensions.cs b/src/Azure/Azure.Quantum.Client/JobManagement/WorkspaceExtensions.cs index 6d1730003b5..d220d2560d0 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/WorkspaceExtensions.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/WorkspaceExtensions.cs @@ -44,15 +44,5 @@ public static CloudJob GetJob(this IWorkspace workspace, string jobId) { return workspace.GetJobAsync(jobId).GetAwaiter().GetResult(); } - - /// - /// Lists the jobs. - /// - /// The workspace. - /// List of job identifiers. - public static IEnumerable ListJobs(this IWorkspace workspace) - { - return workspace.ListJobsAsync().GetAwaiter().GetResult(); - } } } From 9ff0bdc5c806fabf40bdf489e85ce91e90fff6cf Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 19 May 2021 12:54:26 -0700 Subject: [PATCH 13/20] quotas to AsyncEnumerable --- .../WorkspaceTest.cs | 25 +++++++++++++++++++ .../JobManagement/IWorkspace.cs | 2 +- .../JobManagement/Workspace.cs | 18 +++---------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs index 59a986c3fed..44d76364a73 100644 --- a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs +++ b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs @@ -105,6 +105,31 @@ public async Task ListJobsTest() Assert.AreEqual(0, max); } + [TestMethod] + public async Task ListQuotasTest() + { + IWorkspace workspace = GetLiveWorkspace(); + int max = 3; + + // Since this is a live workspace, we don't have much control about what quotas are in there + // Just make sure there is more than one. + await foreach (var q in workspace.ListQuotasAsync()) + { + Assert.IsNotNull(q); + Assert.IsNotNull(q.Quota); + Assert.IsNotNull(q.Quota.Dimension); + + max--; + if (max <= 0) + { + break; + } + } + + // Make sure we iterated through all the expected jobs: + Assert.AreEqual(0, max); + } + private static void AssertJob(CloudJob job) { Assert.IsNotNull(job); diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs b/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs index a14781101e2..e2ac5921114 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/IWorkspace.cs @@ -56,7 +56,7 @@ IAsyncEnumerable ListJobsAsync( /// /// The cancellation token. /// List of jobs - Task> ListQuotasAsync( + IAsyncEnumerable ListQuotasAsync( CancellationToken cancellationToken = default); /// diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs index 7ca0c5b82f5..05f86116103 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs @@ -195,23 +195,13 @@ public async IAsyncEnumerable ListJobsAsync([EnumeratorCancellation] C /// /// List of quotas. /// - public async Task> ListQuotasAsync(CancellationToken cancellationToken = default) + public async IAsyncEnumerable ListQuotasAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) { - try - { - var quotas = this.QuantumClient.GetQuotasAsync(cancellationToken); - - var result = new List(); - await foreach (var q in quotas) - { - result.Add(new QuotaInfo(this, q)); - } + var quotas = this.QuantumClient.GetQuotasAsync(cancellationToken); - return result; - } - catch (Exception ex) + await foreach (var q in quotas) { - throw CreateException(ex, "Could not list quotas"); + yield return new QuotaInfo(this, q); } } From db56230d3c8f6b15dce4e5de73980c9c64e99571 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 19 May 2021 12:58:28 -0700 Subject: [PATCH 14/20] Removing qio sample --- ...oft.Azure.Quantum.Optimization.Test.csproj | 20 -- ...rosoft.Azure.Quantum.Optimization.Test.sln | Bin 5702 -> 0 bytes .../ProblemTest.cs | 26 -- .../ResultTest.cs | 28 -- ...icrosoft.Azure.Quantum.Optimization.csproj | 20 -- .../Azure.Quantum.Optimization/Problem.cs | 108 ------- .../Azure.Quantum.Optimization/Result.cs | 24 -- .../Azure.Quantum.Optimization/Solver.cs | 270 ------------------ src/Azure/Azure.Quantum.Optimization/Term.cs | 39 --- src/Azure/ShippingSample/Program.cs | 129 --------- .../ShippingSample/ShippingSample.csproj | 13 - src/Azure/ShippingSample/ShippingSample.sln | Bin 5560 -> 0 bytes src/Azure/ShippingSample/Workspace.cs | 22 -- 13 files changed, 699 deletions(-) delete mode 100644 src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj delete mode 100644 src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.sln delete mode 100644 src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs delete mode 100644 src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs delete mode 100644 src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj delete mode 100644 src/Azure/Azure.Quantum.Optimization/Problem.cs delete mode 100644 src/Azure/Azure.Quantum.Optimization/Result.cs delete mode 100644 src/Azure/Azure.Quantum.Optimization/Solver.cs delete mode 100644 src/Azure/Azure.Quantum.Optimization/Term.cs delete mode 100644 src/Azure/ShippingSample/Program.cs delete mode 100644 src/Azure/ShippingSample/ShippingSample.csproj delete mode 100644 src/Azure/ShippingSample/ShippingSample.sln delete mode 100644 src/Azure/ShippingSample/Workspace.cs diff --git a/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj b/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj deleted file mode 100644 index b6137875cb4..00000000000 --- a/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netcoreapp3.1 - - false - - - - - - - - - - - - - - diff --git a/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.sln b/src/Azure/Azure.Quantum.Optimization.Test/Microsoft.Azure.Quantum.Optimization.Test.sln deleted file mode 100644 index 3207f8c745f338c4c2febcb254944ae4583a2eb3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5702 zcmds*OHbQC5Xa|ArGAGhCn_}&CXa?nJ;aVp4}DN*d&&ifp+O{}38@OSU%l;bc0&Te z-nhhAsIu(coqc%bKeIEl`{(yN>B*stWGG|aBRQ96@&(#hCbBQ5wDzD)qzi3mT0^K4 zXxbh?iKv}QEH6xb$Xb17+I3=Dr#>{*^-ucd_Bfg zS-DKDLHUwejaoyR)O-o0PP;rEAJX5Vt>fxE4f(}t&*A4aZ%OXTSYiAnQjGX}MLrr? z2S(05?Erat^eCldE&M}$0z zt?DmC-tK}HAGcmVfQs5}pZC((sI}pWd_rgA0=2!IlYh5?V;gEAEowD0yY?SiMp3&zO?P=(L9$oy@c{w)Z=z41M?HXN zJcH`KN}u|NEhy@BwN~ZbqE*LV)X}`otv+(yFM9ahTi#kdzQ(P1<}L5*?e~m#nGioT z0$T6VnXR6z&8)no?cTubM%|Aa=tZMqlW&AhRD&8R)tme5RvSHax9W(1b~M$sPkWhP z-$tsT93a`L@&9Xbld=bT8po~7>tqeL^8`hBKz`AaV-t7h`0Py4Ix;%wJ;ttNBVjrkc2s)* z`a%@FA6A;dou{IeXZ)`?u-DAW+QD})4bb>;W_=XLqmSKa*4j1ssLd0X+e^Ouxh*Rl zNB6vI+b)*ZBs{b7nP2wtaCTV~k4ZRYvCBO9bL(w&yDXB|Bs|^n&G%1!nbAYqWnS5v zo5v&^v)N^S{JHg(hg}xOYZ9Jr`Q~<+U%uzo`6_X|C?1n=%wm^$^5@pu>ULQquSs~i z<+FCVdIr3BUa+@=XXKD0bE?q$nQZ5RH)M8Q<}I%Hp7Vv$ZMLU3S#KE=PR}x{OAyKr zIE^`p=#A%r$uE0QE^eKZZc5?K*cbWVHaTl|%KsJTI{WCIjGn;Dlo97Rd+zg~=^dY* e+#`Cl*QeE{3^)<$osQlE>bWnw4)3C*bN>QBhhTXC diff --git a/src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs b/src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs deleted file mode 100644 index 65f6cf47752..00000000000 --- a/src/Azure/Azure.Quantum.Optimization.Test/ProblemTest.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json; -using Microsoft.Azure.Quantum.Optimization; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Azure.Quantum.Optimization.Test -{ - [TestClass] - public class ProblemTest - { - [TestMethod] - public void TestToString() - { - var problem = new Problem("Container Problem"); - problem.Add(new Term(new int[]{ 1, 2 }, 3)); - problem.Add(new Term(new int[]{ 4, 5 }, 4.5f)); - - string dump = problem.ToString(); - - var document = JsonDocument.Parse(dump); - - bool versionMatch = document.RootElement.GetProperty("cost_function").GetProperty("version").ValueEquals("1.0"); - - Assert.IsTrue(versionMatch); - } - } -} diff --git a/src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs b/src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs deleted file mode 100644 index a2e220218f0..00000000000 --- a/src/Azure/Azure.Quantum.Optimization.Test/ResultTest.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Text.Json; -using Microsoft.Azure.Quantum.Optimization; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Azure.Quantum.Optimization.Test -{ - [TestClass] - public class ResultTest - { - private string stream = "{" + - "\"version\": \"1.0\", " + - "\"configuration\": {\"0\": 1, \"1\": 0, \"2\": 1, \"3\": 0, \"4\": 1, \"5\": 1, \"6\": 0, \"7\": 1, \"8\": 1, \"9\": 0, \"10\": 1, \"11\": 0, \"12\": 1, \"13\": 0, \"14\": 0, \"15\": 1, \"16\": 0, \"17\": 0}, " + - "\"cost\": -1387.0, " + - "\"parameters\": {" + - "\"all_betas\": [0.0019047619047619048, 0.004161358043205629, 0.009091372900969896, 0.019862040316247203, 0.0019047619047619048, 0.00269576882469859, 0.003815264017013829, 0.0053996616424066, 0.007642025747748261, 0.010815595753369938, 0.015307081572550497, 0.02166378548270995, 0.030660292702854874, 0.0019047619047619048, 0.002381280313535361, 0.0029770103641063093, 0.003721775490949473, 0.0046528601216981, 0.0058168762099525505, 0.0072720967226419, 0.009091372900969891, 0.011365781338846444, 0.01420918345882487, 0.017763925642003773, 0.02220796537176503, 0.02776378014031601, 0.03470950511566573, 0.0019047619047619048, 0.0022453918738908774, 0.0026469369503509727, 0.003120290627485277, 0.0036782944900449863, 0.004336086592805416, 0.005111512139985543, 0.006025607606769506, 0.0071031714366350356, 0.008373436796903902, 0.00987086464366111, 0.01163607861105555, 0.01371696708754028, 0.01616998237721557, 0.019061672191148227, 0.02247048501640737, 0.02648889834056961, 0.03122592746817419, 0.036810082990665745, 0.0019047619047619048, 0.0021697336670484847, 0.0024715656976099236, 0.0028153856348238737, 0.0032070344237410653, 0.0036531655443015733, 0.004161358043205629, 0.004740245289667783, 0.0053996616424065984, 0.006150809519504954, 0.007006449709387911, 0.007981118155994036, 0.009091372900969895, 0.01035607537803648, 0.011796710838264248, 0.013437753349764285, 0.01530708157255049, 0.017436452371915635, 0.019862040316247196, 0.022625052224478838, 0.025772427203345518, 0.02935763406694387, 0.03344157968546726, 0.03809364369449257], " + - "\"replicas\": 70, " + - "\"sweeps\": 600}}"; - - [TestMethod] - public void TestParse() - { - Result result = JsonSerializer.Deserialize(stream); - - Assert.AreEqual(-1387.0f, result.Cost); - Assert.AreEqual("1.0", result.Version); - } - } -} diff --git a/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj b/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj deleted file mode 100644 index c07fe5f6859..00000000000 --- a/src/Azure/Azure.Quantum.Optimization/Microsoft.Azure.Quantum.Optimization.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - netstandard2.1 - x64 - Client library for Azure Quantum Optimization. - - - - - - - - - - - - diff --git a/src/Azure/Azure.Quantum.Optimization/Problem.cs b/src/Azure/Azure.Quantum.Optimization/Problem.cs deleted file mode 100644 index 15e5c0b6ed9..00000000000 --- a/src/Azure/Azure.Quantum.Optimization/Problem.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading.Tasks; - -namespace Microsoft.Azure.Quantum.Optimization -{ - public enum ProblemType : int - { - pubo = 0, - ising = 1 - } - - struct ProblemSerializationWrapper - { - public Problem cost_function { get; set; } - } - - public class Problem - { - [JsonIgnore] - public string Name - { get; private set; } - - [JsonPropertyName("version")] - public string Version - { get => (initialConfiguration == null) ? "1.0" : "1.1"; } - - [JsonPropertyName("type")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public ProblemType ProblemType - { get; set; } - - [JsonPropertyName("terms")] - public IEnumerable Terms - { get => terms; } - - HashSet terms; - Dictionary initialConfiguration; - - public Problem(string name) - { - this.Name = name; - - terms = new HashSet(); - } - public Problem(string name, IEnumerable collection) - : this(name) - { - AddRange(collection); - } - - public Problem(string name, IEnumerable collection, Dictionary initialConfiguration) - : this(name, collection) - { - this.initialConfiguration = initialConfiguration; - } - - public void Add(Term term) - { - terms.Add(term); - } - - public void Add(int i, float c) - { - terms.Add(new Term( new int[] { i }, c)); - } - - public void Add(int i, int j, float c) - { - terms.Add(new Term( new int[] { i, j }, c)); - } - - public void Add(int i, int j, int k, float c) - { - terms.Add(new Term( new int[] { i, j, k }, c)); - } - - public void AddRange(IEnumerable collection) - { - foreach (var term in collection) - { - terms.Add(term); - } - } - - public Task SerializeAsync(Stream stream) - { - var root = new ProblemSerializationWrapper - { - cost_function = this - }; - - // Save to the writer - return JsonSerializer.SerializeAsync(stream, root); - } - - public override string ToString() - { - var root = new ProblemSerializationWrapper - { - cost_function = this - }; - return JsonSerializer.Serialize(root); - } - } -} diff --git a/src/Azure/Azure.Quantum.Optimization/Result.cs b/src/Azure/Azure.Quantum.Optimization/Result.cs deleted file mode 100644 index 333cfa1fa82..00000000000 --- a/src/Azure/Azure.Quantum.Optimization/Result.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; -using System.Collections.Generic; - -namespace Microsoft.Azure.Quantum.Optimization -{ - public class Result - { - [JsonPropertyName("version")] - public string Version - { get; set; } - - [JsonPropertyName("configuration")] - public Dictionary Configuration - { get; set; } - - [JsonPropertyName("cost")] - public float Cost - { get; set; } - - [JsonPropertyName("parameters")] - public Dictionary Parameters - { get; set; } - } -} diff --git a/src/Azure/Azure.Quantum.Optimization/Solver.cs b/src/Azure/Azure.Quantum.Optimization/Solver.cs deleted file mode 100644 index eb4fba63f17..00000000000 --- a/src/Azure/Azure.Quantum.Optimization/Solver.cs +++ /dev/null @@ -1,270 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Storage.Blobs; -using Microsoft.Azure.Quantum.Client.Models; -using Microsoft.Azure.Quantum.Storage; - -namespace Microsoft.Azure.Quantum.Optimization -{ - public class Solver - { - readonly Workspace workspace; - readonly string provider; - readonly string target; - readonly string inputDataFormat; - readonly string outputDataFormat; - readonly bool hasNestedParameters; - - Dictionary parameters; - - public Solver( - Workspace workspace, - string provider, - string target, - string inputDataFormat, - string outputDataFormat, - bool hasNestedParameters = true) - { - this.workspace = workspace; - this.provider = provider; - this.target = target; - this.inputDataFormat = inputDataFormat; - this.outputDataFormat = outputDataFormat; - this.hasNestedParameters = hasNestedParameters; - - parameters = new Dictionary(); - if (hasNestedParameters) - { - parameters.Add("params", new Dictionary()); - } - } - - protected void AddParameter(string name, object value) - { - var parms = hasNestedParameters ? parameters["params"] as Dictionary : parameters; - - parms.Add(name, value); - } - - public async Task SubmitAsync(Problem problem) - { - string intermediaryFile = Path.GetTempFileName(); - - // Save to the intermediary file - using (var intermediaryWriter = File.Create(intermediaryFile)) { - using (var compressionStream = new GZipStream(intermediaryWriter, CompressionLevel.Fastest)) - { - await problem.SerializeAsync(compressionStream); - // problem.SerializeTo(intermediaryWriter); - } - } - - using (var intermediaryReader = File.OpenRead(intermediaryFile)) - { - var jobStorageHelper = new LinkedStorageJobHelper(workspace); - var jobId = Guid.NewGuid().ToString(); - var (containerUri, inputUri) = await jobStorageHelper.UploadJobInputAsync(jobId, intermediaryReader); - - return await SubmitAsync(jobId, problem.Name, containerUri, inputUri); - } - } - - public async Task SubmitAsync(string problemUri) - { - var jobId = Guid.NewGuid().ToString(); - - // Calls the service to get a SAS Uri - var containerSasUri = await workspace.GetSasUriAsync(problemUri); - - var inputSasUri = await workspace.GetSasUriAsync(problemUri, "inputData"); - - var containerUri = new Uri(containerSasUri).GetLeftPart(UriPartial.Path); - - var inputUri = new Uri(inputSasUri).GetLeftPart(UriPartial.Path); - - return await SubmitAsync(jobId, "Optimization problem", containerUri, inputUri); - } - - private async Task SubmitAsync(string jobId, string problemName, string containerUri, string inputUri) - { - var details = new JobDetails - { - Id = jobId, - Name = problemName, - InputDataFormat = inputDataFormat, - OutputDataFormat = outputDataFormat, - ProviderId = provider, - Target = target, - InputParams = parameters, - ContainerUri = containerUri, - InputDataUri = inputUri - }; - - var job = await workspace.SubmitJobAsync(new CloudJob(workspace, details)); - - return job; - } - - /// - /// Submits the Problem to the associated Azure Quantum Workspace and get the results. - /// - /// The Problem to solve./param> - public async Task OptimizeAsync(Problem problem, int maxPollInterval = 30) - { - var job = await SubmitAsync(problem); - - await job.RefreshAsync(); - - int pollInterval = 1; - - while (job.InProgress) - { - Console.Out.Write("."); - await Task.Delay(TimeSpan.FromSeconds(pollInterval)); - await job.RefreshAsync(); - - pollInterval = (pollInterval >= maxPollInterval) ? maxPollInterval : pollInterval * 2; - } - Console.Out.WriteLine(); - - var outputUri = new Uri(job.Details.OutputDataUri); - - var blobClient = new BlobClient(outputUri); - - var stream = new MemoryStream(); - - await blobClient.DownloadToAsync(stream); - - stream.Seek(0, SeekOrigin.Begin); - - var result = await JsonSerializer.DeserializeAsync(stream); - - string ser = JsonSerializer.Serialize(result); - - Console.Out.WriteLine(ser); - - var result2 = JsonSerializer.Deserialize(ser); - - return result; - } - - public Result Optimize(Problem problem, int maxPollInterval = 30) - { - return OptimizeAsync(problem, maxPollInterval).GetAwaiter().GetResult(); - } - } - - public enum HardwarePlatform : int - { - CPU = 1, - FPGA = 2 - }; - - public class ParallelTemperingSolver : Solver - { - public ParallelTemperingSolver(Workspace workspace, int? timeout = null, int? seed = null, int? sweeps = null, int? replicas = null, int[] all_betas = null) - : this(workspace, timeout, seed, !(sweeps.HasValue || replicas.HasValue || all_betas != null)) - { - if (sweeps.HasValue) - AddParameter("sweeps", sweeps.Value); - - if (all_betas != null) - { - AddParameter("all_betas", all_betas); - if (replicas.HasValue) - { - if (all_betas.Length != replicas) - throw new ArgumentException("Parameter 'replicas' must equal the length of the 'all_betas' parameters."); - - AddParameter("replicas", replicas); - } - else - { - AddParameter("replicas", all_betas.Length); - } - } - } - - private ParallelTemperingSolver(Workspace workspace, int? timeout, int? seed, bool paramFree) - : base(workspace, - "Microsoft", - paramFree ? "microsoft.paralleltempering-parameterfree.cpu" : "microsoft.paralleltempering.cpu", - "microsoft.qio.v2", - "microsoft.qio-results.v2") - { - - if (timeout.HasValue) - AddParameter("timeout", timeout.Value); - - if (seed.HasValue) - AddParameter("seed", seed.Value); - } - } - - public class SimulatedAnnealingSolver : Solver - { - public SimulatedAnnealingSolver(Workspace workspace, int? timeout = null, int? seed = null, HardwarePlatform platform = HardwarePlatform.CPU, float? beta_start = null, float? beta_stop = null, int? sweeps = null, int? restarts = null) - : this(workspace, timeout, seed, platform, !(beta_start.HasValue || beta_stop.HasValue || sweeps.HasValue || restarts.HasValue)) - { - if (beta_start.HasValue) - AddParameter("beta_start", beta_start.Value); - - if (beta_stop.HasValue) - AddParameter("beta_stop", beta_stop.Value); - - if (sweeps.HasValue) - AddParameter("sweeps", sweeps.Value); - - if (restarts.HasValue) - AddParameter("restarts", restarts.Value); - } - - private SimulatedAnnealingSolver(Workspace workspace, int? timeout, int? seed, HardwarePlatform platform, bool paramFree) - : base(workspace, - "Microsoft", - (platform == HardwarePlatform.FPGA) ? - (paramFree ? "microsoft.simulatedannealing-parameterfree.fpga" : "microsoft.simulatedannealing.fpga") : - (paramFree ? "microsoft.simulatedannealing-parameterfree.cpu" : "microsoft.simulatedannealing.cpu"), - "microsoft.qio.v2", - "microsoft.qio-results.v2") - { - if (timeout.HasValue) - AddParameter("timeout", timeout.Value); - - if (seed.HasValue) - AddParameter("seed", seed.Value); - } - } - - public class TabuSolver : Solver - { - public TabuSolver(Workspace workspace, int? timeout = null, int? seed = null, int? sweeps = null, int? tabu_tenure = null) - : this(workspace, timeout, seed, - !(tabu_tenure.HasValue || sweeps.HasValue)) - { - if (sweeps.HasValue) - AddParameter("sweeps", sweeps.Value); - - if (tabu_tenure.HasValue) - AddParameter("tabu_tenure", tabu_tenure.Value); - } - - private TabuSolver(Workspace workspace, int? timeout, int? seed, bool paramFree) - : base(workspace, - "Microsoft", - paramFree ? "microsoft.tabu-parameterfree.cpu" : "microsoft.tabu.cpu", - "microsoft.qio.v2", - "microsoft.qio-results.v2") - { - if (timeout.HasValue) - AddParameter("timeout", timeout.Value); - - if (seed.HasValue) - AddParameter("seed", seed.Value); - } - } -} diff --git a/src/Azure/Azure.Quantum.Optimization/Term.cs b/src/Azure/Azure.Quantum.Optimization/Term.cs deleted file mode 100644 index 1c1ab874809..00000000000 --- a/src/Azure/Azure.Quantum.Optimization/Term.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Microsoft.Azure.Quantum.Optimization -{ - public class Term - { - [JsonPropertyName("c")] - public float Weight - { get; private set; } - - [JsonPropertyName("ids")] - public int[] IDs - { get; private set; } - - public Term(int[] ids, float c) - { - this.IDs = ids; - this.Weight = c; - } - - public Term(int i, float c) - { - this.IDs = new int[] { i }; - this.Weight = c; - } - - public Term(int i, int j, float c) - { - this.IDs = new int[] { i, j }; - this.Weight = c; - } - - public Term(int i, int j, int k, float c) - { - this.IDs = new int[] { i, j, k }; - this.Weight = c; - } - } -} diff --git a/src/Azure/ShippingSample/Program.cs b/src/Azure/ShippingSample/Program.cs deleted file mode 100644 index c5e53c4f9d1..00000000000 --- a/src/Azure/ShippingSample/Program.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System.Collections.Generic; - -namespace ShippingSample -{ - using System; - using System.Linq; - using System.Text.Json; - using Microsoft.Azure.Quantum.Optimization; - - partial class Program - { - static void Main(string[] args) - { - var workspace = CreateWorkspace(); - - // This array contains a list of the weights of the containers - var containerWeights = new int[] { 1, 5, 9, 21, 35, 5, 3, 5, 10, 11 }; - - // Create a problem for the list of containers: - var problem = CreateProblemForContainerWeights(containerWeights); - - // Submit problem to Azure Quantum using the ParallelTempering solver: - // Instantiate a solver to solve the problem. - var solver = new ParallelTemperingSolver(workspace, timeout: 100); - - // Optimize the problem - Console.Out.WriteLine("Submitting problem..."); - var startTime = DateTime.Now; - var result = solver.Optimize(problem); - var timeElapsed = DateTime.Now.Subtract(startTime); - Console.Out.WriteLine("Result in {0} seconds:\n{0}", timeElapsed.TotalSeconds, result); - - // Print out a summary of the results: - PrintResultSummary(result, containerWeights); - - // Improving the Cost Function - // The cost function we"ve built works well so far, but let"s take a closer look at the `Problem` that was generated: - Console.Out.WriteLine("The original problem has {0} terms for {1} containers:", problem.Terms.Count(), containerWeights.Length); - Console.Out.WriteLine(JsonSerializer.Serialize(problem.Terms)); - - // Check that this creates a smaller problem - // Create the simplified problem - var simplifiedProblem = CreateSimplifiedProblemForContainerWeights(containerWeights); - Console.Out.WriteLine("The simplified problem has {0} terms", simplifiedProblem.Terms.Count()); - - // Optimize the problem - Console.Out.WriteLine("Submitting simplified problem..."); - startTime = DateTime.Now; - var simplifiedResult = solver.Optimize(simplifiedProblem); - var timeElapsedSimplified = DateTime.Now.Subtract(startTime); - Console.Out.WriteLine("Result in {0} seconds:\n{1}", timeElapsedSimplified.TotalSeconds, simplifiedResult); - PrintResultSummary(simplifiedResult, containerWeights); - } - static void PrintResultSummary(Result result, int[] containerWeights) - { - // Print a summary of the result - int shipAWeight = 0; - int shipBWeight = 0; - foreach (var container in result.Configuration) - { - int containerIndex = Int32.Parse(container.Key); - int containerAssignment = container.Value; - - int containerWeight = containerWeights[containerIndex]; - - string ship = String.Empty; - if (containerAssignment == 1) - { - ship = "A"; - shipAWeight += containerWeight; - } - else - { - ship = "B"; - shipBWeight += containerWeight; - } - - Console.Out.WriteLine("Container {0} with weight {1} was placed on Ship {2}", containerIndex, containerWeight, ship); - } - - Console.Out.WriteLine("Total weights: \n\tShip A: {0} tonnes \n\tShip B: {1} tonnes", shipAWeight, shipBWeight); - } - - // Take an array of container weights and return a Problem object that represents the cost function - static Problem CreateProblemForContainerWeights(int[] containerWeights) - { - // Create an Ising-type problem - var problem = new Problem("Ship-Sample-Problem") - { - ProblemType = ProblemType.ising - }; - - // Expand the squared summation - for (int i = 0; i < containerWeights.Length; i++) - for (int j = 0; j < containerWeights.Length; j++) - { - // Skip the terms where i == j as they form constant terms in an Ising problem and can be disregarded: - // w_i∗w_j∗x_i∗x_j = w_i​*w_j∗(x_i)^2 = w_i∗w_j​​ - // for x_i = x_j, x_i ∈ {1, -1} - if (i != j) - { - problem.Add(i, j, containerWeights[i] * containerWeights[j]); - } - } - - return problem; - } - - // We can reduce the number of terms by removing duplicates - // In code, this means a small modification to the createProblemForContainerWeights function: - static Problem CreateSimplifiedProblemForContainerWeights(int[] containerWeights) - { - var terms = new List(); - - // Expand the squared summation - for (int i = 0; i < containerWeights.Length - 1; i++) - for (int j = i + 1; j < containerWeights.Length; j++) - { - terms.Add(new Term(i, j, containerWeights[i] * containerWeights[j])); - } - - // Return an Ising-type problem - return new Problem("Ship-Sample-Problem-Simplified", terms) - { - ProblemType = ProblemType.ising - }; - } - } -} diff --git a/src/Azure/ShippingSample/ShippingSample.csproj b/src/Azure/ShippingSample/ShippingSample.csproj deleted file mode 100644 index a6925311795..00000000000 --- a/src/Azure/ShippingSample/ShippingSample.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - Exe - netcoreapp3.1 - - - - - - - - diff --git a/src/Azure/ShippingSample/ShippingSample.sln b/src/Azure/ShippingSample/ShippingSample.sln deleted file mode 100644 index 4b3f32d00738e08ea213613cd773ea5eb8b6c7a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5560 zcmd6rOHbQC5Xa|ArGAGhCo0uZOhO2iddQO=`k+MZDHkAy29ZY-Qt>EXz3p#iLju7z zh8PQ3PS&&I-I@P9*Z=;0mYy8SScWp;K9VzeBR`-`WGee|%2ONKRJzcH_B4b#g{IE~ zC@n^(639Cn4_T|vn{J(er^%etmkr5Ff$O!rl3m;Ngf|c2UYDF)$+lF*=hug)$jTn0 zGXGnQN{q@?$5SxMqN z`%aKaZF(}7{|anchH4drd}$za5!wb4Dz@9)HAYoN4dy*&6v+*^%4o0XSD16ys{NYi z+g-Ba%eL!RP*K0_b6=W|Iv>u;#!>q}-ri9wMcclP^@?WWl37>dtYV`Q_O4)SjV6tr z0wdodtbp~KctpY8Eilr!dKtEF6MH@EIpTL9$7HE}>^ibcl%_r7_UW)|v=mXcD1mCp zaIPEj8hx9@oMOc1a&Z&EM@}uThtrWpL zKRq?Swk@8g*j;Omi|5XK_3+3_DqEBVYea%(&Kh@%jOcP@3#wYM$iHS+&7*pGNV5gq zhhHsOq~X(X;^8`bQXzLniV%6gT3}L&JTWrX&s9nC$>j+GS=`L?GwA!0lLoY zVSh$ixX z^g5&G^UJJc48t*rU#2Nvyxms!%PeIL!!usLg(PiW+h`7j!FD7P5I*Owz^+t zDQg&>@%lNxT)hKcJ} Date: Wed, 19 May 2021 13:25:45 -0700 Subject: [PATCH 15/20] Add description to Problem --- src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs b/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs index 5a92aa91854..5a527dc9c6e 100644 --- a/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs +++ b/src/Azure/Azure.Quantum.Client.Test/Helpers/Problem.cs @@ -12,6 +12,11 @@ public enum ProblemType : int Ising = 1, } + /// + /// This is the data structure that represents a QIO problem payload on the service. + /// It's currently not exposed in C#, so we have it here so we can test job submission of + /// the client libraries without having to serialize Q# programs. + /// public class Problem { private readonly HashSet terms = new HashSet(); From 60c5a237fced0930e00ba9292422c7886392d102 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Wed, 19 May 2021 17:51:02 -0700 Subject: [PATCH 16/20] virtual cloudjob methods --- .../JobManagement/CloudJob.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs b/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs index 87fdef58db6..34d7360b81b 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/CloudJob.cs @@ -40,45 +40,46 @@ public CloudJob(IWorkspace workspace, JobDetails jobDetails) /// /// Gets the job id. /// - public string Id => Details.Id; + public virtual string Id => Details.Id; /// /// Gets whether the job execution has completed. /// - public bool InProgress => Status != "Cancelled" && + public virtual bool InProgress => Status != "Cancelled" && Status != "Failed" && Status != "Succeeded"; /// /// Gets the status of the submitted job. /// - public string Status => Details.Status?.ToString(); + public virtual string Status => Details.Status?.ToString(); /// /// Gets whether the job execution completed successfully. /// - public bool Succeeded => Status == "Succeeded"; + public virtual bool Succeeded => Status == "Succeeded"; /// /// Gets an URI to access the job. /// - public Uri Uri => GenerateUri(); + public virtual Uri Uri => GenerateUri(); /// /// Gets the workspace. /// - public IWorkspace Workspace { get; private set; } + public virtual IWorkspace Workspace { get; private set; } /// /// Gets the job details. /// - public JobDetails Details { get; private set; } + public virtual JobDetails Details { get; private set; } /// /// Refreshes the job. /// /// The cancellation token. - public async Task RefreshAsync(CancellationToken cancellationToken = default) + /// + public virtual async Task RefreshAsync(CancellationToken cancellationToken = default) { CloudJob job = (CloudJob)await this.Workspace.GetJobAsync(this.Details.Id, cancellationToken); this.Details = job.Details; @@ -88,7 +89,8 @@ public async Task RefreshAsync(CancellationToken cancellationToken = default) /// Cancels the job. /// /// The cancellation token. - public async Task CancelAsync(CancellationToken cancellationToken = default) + /// + public virtual async Task CancelAsync(CancellationToken cancellationToken = default) { CloudJob job = (CloudJob)await this.Workspace.CancelJobAsync(this.Details.Id, cancellationToken); this.Details = job.Details; From 1353f6f8912cbbddcdd6b4de059f13b24b92c1c3 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 20 May 2021 01:29:33 -0700 Subject: [PATCH 17/20] skip live unittests --- src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs index 44d76364a73..692c6546681 100644 --- a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs +++ b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs @@ -22,6 +22,7 @@ namespace Microsoft.Azure.Quantum.Test public class WorkspaceTest { [TestMethod] + [Ignore] public async Task SubmitJobTest() { // Create Job @@ -40,6 +41,7 @@ public async Task SubmitJobTest() } [TestMethod] + [Ignore] public async Task GetJobTest() { IWorkspace workspace = GetLiveWorkspace(); @@ -59,6 +61,7 @@ public async Task GetJobTest() } [TestMethod] + [Ignore] public async Task CancelJobTest() { // Create Job @@ -79,6 +82,7 @@ public async Task CancelJobTest() } [TestMethod] + [Ignore] public async Task ListJobsTest() { IWorkspace workspace = GetLiveWorkspace(); @@ -106,6 +110,7 @@ public async Task ListJobsTest() } [TestMethod] + [Ignore] public async Task ListQuotasTest() { IWorkspace workspace = GetLiveWorkspace(); From 8cdf286142d11a37ae2de4816efe4795093635cd Mon Sep 17 00:00:00 2001 From: Andres Date: Thu, 20 May 2021 08:31:43 +0000 Subject: [PATCH 18/20] Build 0.16.2105.143425. --- global.json | 2 +- .../Microsoft.Quantum.Development.Kit.nuspec | 2 +- .../CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj | 2 +- src/Xunit/Microsoft.Quantum.Xunit.nuspec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/global.json b/global.json index b8836b5a241..da2e1177aa6 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "Microsoft.Quantum.Sdk": "0.16.2105140327-beta" + "Microsoft.Quantum.Sdk": "0.16.2105143425-alpha" } } diff --git a/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec b/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec index aeedbfb3a2f..b3f2dc492ef 100644 --- a/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec +++ b/src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec @@ -20,7 +20,7 @@ Quantum Q# QSharp - + diff --git a/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj b/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj index 03714fb820f..dba0c6256c8 100644 --- a/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj +++ b/src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj @@ -22,7 +22,7 @@ - + diff --git a/src/Xunit/Microsoft.Quantum.Xunit.nuspec b/src/Xunit/Microsoft.Quantum.Xunit.nuspec index f4be81d5e51..2de3f2c585f 100644 --- a/src/Xunit/Microsoft.Quantum.Xunit.nuspec +++ b/src/Xunit/Microsoft.Quantum.Xunit.nuspec @@ -22,7 +22,7 @@ - + From 12d6735603bb0835b25852eeb8996ac07c30201f Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 20 May 2021 13:30:49 -0700 Subject: [PATCH 19/20] credential, public client --- ...Microsoft.Azure.Quantum.Client.Test.csproj | 1 - .../JobManagement/Workspace.cs | 49 +++++++------------ 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/src/Azure/Azure.Quantum.Client.Test/Microsoft.Azure.Quantum.Client.Test.csproj b/src/Azure/Azure.Quantum.Client.Test/Microsoft.Azure.Quantum.Client.Test.csproj index 7965e696874..7ff14f03a27 100644 --- a/src/Azure/Azure.Quantum.Client.Test/Microsoft.Azure.Quantum.Client.Test.csproj +++ b/src/Azure/Azure.Quantum.Client.Test/Microsoft.Azure.Quantum.Client.Test.csproj @@ -10,7 +10,6 @@ - all diff --git a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs index 05f86116103..2b269a945a8 100644 --- a/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs +++ b/src/Azure/Azure.Quantum.Client/JobManagement/Workspace.cs @@ -31,14 +31,14 @@ public class Workspace : IWorkspace /// Name of the resource group. /// Name of the workspace. /// Azure region where the workspace was created. - /// The credentials to connect to Azure. If not provided it defaults to DefaultAzureCredentials. + /// The credentials to connect to Azure. If not provided it defaults to an interactive DefaultAzureCredentials. /// Options for the client library when communication with Azure Service.. public Workspace( string subscriptionId, string resourceGroupName, string workspaceName, string location, - TokenCredential credentials = null, + TokenCredential credential = null, QuantumJobClientOptions options = default) { // Required parameters: @@ -48,7 +48,7 @@ public Workspace( Ensure.NotNullOrWhiteSpace(location, nameof(location)); // Optional parameters: - credentials ??= new DefaultAzureCredential(includeInteractiveCredentials: true); + credential ??= new DefaultAzureCredential(includeInteractiveCredentials: true); options ??= new QuantumJobClientOptions(); this.ResourceGroupName = resourceGroupName; @@ -56,20 +56,13 @@ public Workspace( this.SubscriptionId = subscriptionId; this.Location = location; - try - { - this.QuantumClient = new QuantumJobClient( - subscriptionId, - resourceGroupName, - workspaceName, - location, - credentials, - options); - } - catch (Exception ex) - { - throw CreateException(ex, "Could not create an Azure Quantum service client"); - } + this.Client = new QuantumJobClient( + subscriptionId, + resourceGroupName, + workspaceName, + location, + credential, + options); } public string ResourceGroupName { get; } @@ -81,13 +74,9 @@ public Workspace( public string Location { get; } /// - /// Gets or sets the jobs client. - /// Internal only. + /// The client used to communicate with the service. /// - /// - /// The jobs client. - /// - internal QuantumJobClient QuantumClient { get; set; } + public QuantumJobClient Client { get; } /// /// Submits the job. @@ -106,7 +95,7 @@ public async Task SubmitJobAsync( try { - JobDetails jobDetails = await this.QuantumClient.CreateJobAsync( + JobDetails jobDetails = await this.Client.CreateJobAsync( jobId: jobDefinition.Details.Id, job: jobDefinition.Details, cancellationToken: cancellationToken); @@ -131,11 +120,11 @@ public async Task CancelJobAsync(string jobId, CancellationToken cance try { - await this.QuantumClient.CancelJobAsync( + await this.Client.CancelJobAsync( jobId: jobId, cancellationToken: cancellationToken); - JobDetails jobDetails = this.QuantumClient.GetJob(jobId); + JobDetails jobDetails = this.Client.GetJob(jobId); return new CloudJob(this, jobDetails); } @@ -159,7 +148,7 @@ public async Task GetJobAsync(string jobId, CancellationToken cancella try { - JobDetails jobDetails = await this.QuantumClient.GetJobAsync( + JobDetails jobDetails = await this.Client.GetJobAsync( jobId: jobId, cancellationToken: cancellationToken); @@ -180,7 +169,7 @@ public async Task GetJobAsync(string jobId, CancellationToken cancella /// public async IAsyncEnumerable ListJobsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) { - var jobs = this.QuantumClient.GetJobsAsync().WithCancellation(cancellationToken); + var jobs = this.Client.GetJobsAsync().WithCancellation(cancellationToken); await foreach (var j in jobs) { @@ -197,7 +186,7 @@ public async IAsyncEnumerable ListJobsAsync([EnumeratorCancellation] C /// public async IAsyncEnumerable ListQuotasAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) { - var quotas = this.QuantumClient.GetQuotasAsync(cancellationToken); + var quotas = this.Client.GetQuotasAsync(cancellationToken); await foreach (var q in quotas) { @@ -221,7 +210,7 @@ public async Task GetSasUriAsync(string containerName, string blobName = BlobName = blobName, }; - var response = await this.QuantumClient.GetStorageSasUriAsync(details, cancellationToken); + var response = await this.Client.GetStorageSasUriAsync(details, cancellationToken); return response.Value.SasUri; } From 7b5a3231d43ddf7bebc56e712323f4a706023b05 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Tue, 25 May 2021 13:08:05 -0700 Subject: [PATCH 20/20] Use env variables for live tests. --- src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs index 692c6546681..ecb5a84ed93 100644 --- a/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs +++ b/src/Azure/Azure.Quantum.Client.Test/WorkspaceTest.cs @@ -150,10 +150,10 @@ private IWorkspace GetLiveWorkspace() options.Diagnostics.ApplicationId = "ClientTests"; return new Workspace( - subscriptionId: TestConstants.LiveSubscriptionId, - resourceGroupName: TestConstants.LiveResourceGroupName, - workspaceName: TestConstants.LiveWorkspaceName, - location: TestConstants.LiveLocation, + subscriptionId: System.Environment.GetEnvironmentVariable("E2E_SUBSCRIPTION_ID") ?? TestConstants.LiveSubscriptionId, + resourceGroupName: System.Environment.GetEnvironmentVariable("E2E_WORKSPACE_RG") ?? TestConstants.LiveResourceGroupName, + workspaceName: System.Environment.GetEnvironmentVariable("E2E_WORKSPACE_NAME") ?? TestConstants.LiveWorkspaceName, + location: System.Environment.GetEnvironmentVariable("E2E_WORKSPACE_LOCATION") ?? TestConstants.LiveLocation, options: options); }