Skip to content

Commit

Permalink
fix in queue parse
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Jul 13, 2021
1 parent 536da71 commit e302b03
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/schema/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ end
@option struct BraketTaskInfo
createdAt::String
deviceArn::String
deviceParameters::String
endedAt::String
deviceParameters::Maybe{String}
endedAt::Maybe{String}
failureReason::Maybe{String} = nothing
id::String
outputS3Bucket::String
Expand Down
70 changes: 32 additions & 38 deletions test/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ using AWSBraket.Schema
using Configurations
using JSON

bell = Schema.Program(;
instructions=[
Schema.H(;target=0),
Schema.CNot(;control=0, target=1),
],
)

task, status = AWSBraket.create_quantum_task(;
program=bell,
device_arn="arn:aws:braket:::device/quantum-simulator/amazon/sv1",
bucket="amazon-braket-8865d8c99645",
folder="braket",
)

info = AWSBraket.get_quantum_task(task)
# AWSBraket.cancel_quantum_task(info.id, task)

using HTTP
using AWS: @service
@service Braket
@service S3

# S3.list_objects(info.outputS3Bucket)["Contents"]
content = S3.get_object(info.outputS3Bucket, info.outputS3Directory * "/results.json")
JSON.parse(String(content))

# bell = Schema.Program(;
# instructions=[
# Schema.H(;target=0),
Expand All @@ -17,20 +43,13 @@ using JSON
# ]
# )

bell = Schema.Program(;
instructions=[
Schema.H(;target=0),
Schema.CNot(;control=0, target=1),
],
)

deviceParameters = Schema.GateModelSimulatorDeviceParameters(
paradigmParameters=Schema.GateModelParameters(
qubitCount=2, disableQubitRewiring=false,
)
)
# deviceParameters = Schema.GateModelSimulatorDeviceParameters(
# paradigmParameters=Schema.GateModelParameters(
# qubitCount=2, disableQubitRewiring=false,
# )
# )

JSON.json(to_dict(bell; include_defaults=true, exclude_nothing=true), 2)|>print
# JSON.json(to_dict(bell; include_defaults=true, exclude_nothing=true), 2)|>print

# # direct call
# task = Braket.create_quantum_task(
Expand All @@ -44,28 +63,3 @@ JSON.json(to_dict(bell; include_defaults=true, exclude_nothing=true), 2)|>print
# "deviceParameters" => JSON.json(to_dict(deviceParameters; include_defaults=true)),
# ),
# )

# high level
using UUIDs

task, status = AWSBraket.create_quantum_task(;
program=bell,
device_arn="arn:aws:braket:::device/quantum-simulator/amazon/sv1",
bucket="amazon-braket-8865d8c99645",
folder="braket",
)

info = AWSBraket.get_quantum_task(task)
# AWSBraket.cancel_quantum_task(info.id, task)

info = from_dict(AWSBraket.Schema.BraketTaskInfo, meta)

using HTTP
using AWS: @service
@service Braket
@service S3

S3.list_objects(info.outputS3Bucket)["Contents"]
content = S3.get_object(info.outputS3Bucket, info.outputS3Directory * "/results.json")
s = String(content)
JSON.parse(s)

0 comments on commit e302b03

Please sign in to comment.