diff --git a/src/schema/task.jl b/src/schema/task.jl index 6bfc4ac..8dbf72a 100644 --- a/src/schema/task.jl +++ b/src/schema/task.jl @@ -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 diff --git a/test/task.jl b/test/task.jl index fec9d48..7ad5b7e 100644 --- a/test/task.jl +++ b/test/task.jl @@ -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), @@ -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( @@ -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)