From d1cd7e88ec56c0c0d8bade840ebbebc0c7206ffc Mon Sep 17 00:00:00 2001 From: Katharine Hyatt <67932820+kshyatt-aws@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:56:19 -0400 Subject: [PATCH] fix: Bump dep versions, fix tests, and change to new IonQ device name (#59) --- Project.toml | 22 +++++----- PyBraket/Project.toml | 6 +-- src/qubit_set.jl | 1 + test/integ_tests/cost_tracking.jl | 2 +- test/integ_tests/device_creation.jl | 4 +- test/jobs.jl | 66 +++++++++++++++-------------- 6 files changed, 52 insertions(+), 49 deletions(-) diff --git a/Project.toml b/Project.toml index 31c6d32d..eb71b1c5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Braket" uuid = "19504a0f-b47d-4348-9127-acc6cc69ef67" authors = ["Katharine Hyatt "] -version = "0.7.4" +version = "0.7.5" [deps] AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc" @@ -30,29 +30,29 @@ Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] -AWS = "=1.85.0" -AWSS3 = "=0.10.3" +AWS = "=1.90.0" +AWSS3 = "=0.11.2" Aqua = "=0.6" -AxisArrays = "=0.4.6" -CSV = "=0.10.10" +AxisArrays = "=0.4.7" +CSV = "=0.10.11" Cairo = "=1.0.5" Colors = "=0.12.10" -Compat = "=4.6.1" +Compat = "=4.7.0" Compose = "=0.9.4" CondaPkg = "=0.2.17" -DataStructures = "=0.18.13" -DecFP = "=1.3.1" +DataStructures = "=0.18.14" +DecFP = "=1.3.2" Distributions = "=0.25.76" GraphPlot = "=0.5.2" Graphs = "=1.8.0" -HTTP = "=1.8.1" -JSON3 = "=1.12.0" +HTTP = "=1.9.14" +JSON3 = "=1.13.1" Markdown = "=0.7.5" Mocking = "=0.7.6" NLopt = "=0.6.5" NamedTupleTools = "=0.14.3" Optim = "=1.7.4" -OrderedCollections = "=1.6.0" +OrderedCollections = "=1.6.2" Plots = "=1.38.5" SimpleWeightedGraphs = "=1.2.2" StructTypes = "=1.10.0" diff --git a/PyBraket/Project.toml b/PyBraket/Project.toml index f86b6e11..d381b70d 100644 --- a/PyBraket/Project.toml +++ b/PyBraket/Project.toml @@ -1,7 +1,7 @@ name = "PyBraket" uuid = "e85266a6-1825-490b-a80e-9b9469c53660" authors = ["Katharine Hyatt "] -version = "0.7.4" +version = "0.7.5" [deps] Braket = "19504a0f-b47d-4348-9127-acc6cc69ef67" @@ -14,9 +14,9 @@ StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" [compat] Aqua = "=0.6" -Braket = "=0.7.4" +Braket = "=0.7.5" CondaPkg = "=0.2.18" -DataStructures = "=0.18.13" +DataStructures = "=0.18.14" PythonCall = "=0.9.12" StructTypes = "=1.10.0" julia = "1.6" diff --git a/src/qubit_set.jl b/src/qubit_set.jl index e88f737c..8b34de91 100644 --- a/src/qubit_set.jl +++ b/src/qubit_set.jl @@ -18,6 +18,7 @@ struct Qubit <: Integer index::Int Qubit(q::Integer) = new(q) Qubit(q::AbstractFloat) = new(Int(q)) + Qubit(q::DecFP.DecimalFloatingPoint) = new(Int(q)) Qubit(q::BigFloat) = new(Int(q)) end Qubit(q::Qubit) = q diff --git a/test/integ_tests/cost_tracking.jl b/test/integ_tests/cost_tracking.jl index e16fc0fe..3fb04624 100644 --- a/test/integ_tests/cost_tracking.jl +++ b/test/integ_tests/cost_tracking.jl @@ -7,7 +7,7 @@ using AWS: @service, AWSConfig, global_aws_config circuit = Circuit([(H, 0)]) t = Braket.Tracker() n_available = 0 - for arn = ("arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy", "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-2", "arn:aws:braket:::device/qpu/ionq/ionQdevice") + for arn = ("arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy", "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-2", "arn:aws:braket:us-east-1::device/qpu/ionq/Aria-1") d = AwsDevice(arn) if Braket.isavailable(d) d(circuit, shots=10) diff --git a/test/integ_tests/device_creation.jl b/test/integ_tests/device_creation.jl index 78f957e0..6fbb66ed 100644 --- a/test/integ_tests/device_creation.jl +++ b/test/integ_tests/device_creation.jl @@ -2,7 +2,7 @@ using Braket, Test DWAVE_ARN = "arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6" RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-11" -IONQ_ARN = "arn:aws:braket:::device/qpu/ionq/ionQdevice" +IONQ_ARN = "arn:aws:braket:us-east-1::device/qpu/ionq/Aria-1" SIMULATOR_ARN = "arn:aws:braket:::device/quantum-simulator/amazon/sv1" OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" @@ -40,4 +40,4 @@ OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" end end end -end \ No newline at end of file +end diff --git a/test/jobs.jl b/test/jobs.jl index dcfbd99a..964ed4a4 100644 --- a/test/jobs.jl +++ b/test/jobs.jl @@ -99,39 +99,41 @@ dev_arn = "arn:aws:braket:::device/quantum-simulator/amazon/sv1" end end @testset "input data handling" begin - log_streams = [Dict("logStreamName"=>"fake_name")] - events = [] - resp_dict = Dict("jobArn"=>"arn:job/fake", "status"=>"COMPLETED", "instanceConfig"=>Dict("instanceCount"=>1), "logStreams"=>log_streams, "nextForwardToken"=>"0", "events"=>events, "GetCallerIdentityResult"=>Dict("Arn"=>"fake_arn", "Account"=>"000000")) - sm = joinpath(@__DIR__, "fake_code.jl") - code_loc = Braket.construct_s3_uri("fake_bucket", "fake_dir") - function f(http_backend, request, response_stream) - if request.service == "s3" - xml_str = """ - - - - 2000:01:01T00:00:00 - "amazon-braket-fake_region-000000" - - - - "fake_name" - 000000 - - - """ - return Braket.AWS.Response(Braket.HTTP.Response(200, ["Content-Type"=>"application/xml"]), IOBuffer(xml_str)) - else - return Braket.AWS.Response(Braket.HTTP.Response(200, ["Content-Type"=>"application/json"]), IOBuffer(JSON3.write(resp_dict))) + withenv("AWS_DEFAULT_REGION"=>"fake_region") do + log_streams = [Dict("logStreamName"=>"fake_name")] + events = [] + resp_dict = Dict("jobArn"=>"arn:job/fake", "status"=>"COMPLETED", "instanceConfig"=>Dict("instanceCount"=>1), "logStreams"=>log_streams, "nextForwardToken"=>"0", "events"=>events, "GetCallerIdentityResult"=>Dict("Arn"=>"fake_arn", "Account"=>"000000")) + sm = joinpath(@__DIR__, "fake_code.jl") + code_loc = Braket.construct_s3_uri("fake_bucket", "fake_dir") + function f(http_backend, request, response_stream) + if request.service == "s3" + xml_str = """ + + + + 2000:01:01T00:00:00 + "amazon-braket-fake_region-000000" + + + + "fake_name" + 000000 + + + """ + return Braket.AWS.Response(Braket.HTTP.Response(200, ["Content-Type"=>"application/xml"]), IOBuffer(xml_str)) + else + return Braket.AWS.Response(Braket.HTTP.Response(200, ["Content-Type"=>"application/json"]), IOBuffer(JSON3.write(resp_dict))) + end + end + req_patch = @patch Braket.AWS._http_request(http_backend, request::Braket.AWS.Request, response_stream::IO; kwargs...) = f(http_backend, request, response_stream) + input_data = relpath(joinpath(pkgdir(Braket), "test", "fake_code.py"), @__DIR__) + apply(req_patch) do + output_dc = Braket.OutputDataConfig("s3://fake_bucket/fake_output") + checkpoint_cf = Braket.CheckpointConfig(nothing, "s3://fake_bucket/fake_checkpoints") + job = Braket.AwsQuantumJob(dev_arn, sm, entry_point="", input_data=input_data, role_arn="arn:fake:role", code_location=code_loc, hyperparameters=Dict("blah"=>1), output_data_config=output_dc, checkpoint_config=checkpoint_cf, wait_until_complete=true) + @test arn(job) == "arn:job/fake" end - end - req_patch = @patch Braket.AWS._http_request(http_backend, request::Braket.AWS.Request, response_stream::IO) = f(http_backend, request, response_stream) - input_data = relpath(joinpath(pkgdir(Braket), "test", "fake_code.py"), @__DIR__) - apply(req_patch) do - output_dc = Braket.OutputDataConfig("s3://fake_bucket/fake_output") - checkpoint_cf = Braket.CheckpointConfig(nothing, "s3://fake_bucket/fake_checkpoints") - job = Braket.AwsQuantumJob(dev_arn, sm, entry_point="", input_data=input_data, role_arn="arn:fake:role", code_location=code_loc, hyperparameters=Dict("blah"=>1), output_data_config=output_dc, checkpoint_config=checkpoint_cf, wait_until_complete=true) - @test arn(job) == "arn:job/fake" end end @testset "status" begin