Adding to the result.json

0

Is there someway of adding meta information to a sampler run so that it shows up in the result.json file stored in s3?

I want to label a run for later processing by a lambda function. How can I add my own object prior to the run so that I can store other application information along with the results of a quantum anneal?

Thank you

asked 4 years ago187 views
3 Answers
0

Hi AussieV123, the results of your run are being stored on S3 under <your-bucket>/<your-prefix>/<task-id>/results.json. While is is not possible at the moment to write meta data directly in the results.json file, you can add meta data manually in the result s3 folder (<your-bucket>/<your-prefix>/<task-id>).

Would that address your use case?

Edited by: EricMK-AWS on Sep 9, 2020 9:15 AM

profile pictureAWS
answered 4 years ago
0

Yes, I could add information to the bucket but if I have multiple requests coming in from a Lambda function for example is there any way of telling them apart other than order?

If for instance I had the task ID as in (<your-bucket>/<your-prefix>/<task-id>) I could store this into DynamoDB on or after the task launched. Then when the new result file showed up in S3 it could trigger a Lambda function which would read the folder name, retrieve the result.json and lookup the meta information that would have been stored in the result.json.

It could work if I knew the task-id at time of submission. Can I get the task-id on submission?

I could also use <your-prefix> in a similar manner and generate a UUID or a similar id/hash to lock it to an entry in DynamoDB.

Seems like a lot of extra steps for a little meta data.

answered 4 years ago
0

Hi AussieV123, thanks a lot for the explanation and detail on your use case. Yes, the task ID is created when you submit a task with a .run() command. You can retrieve it like this:

task = device.run(my_circuit, s3_folder= (your_bucket, your_prefix), ...)
task_id = task.id.split('/')[1] # technically the task ID is a full ARN but we are only interested in the random string at the end

You can then use boto3 to put your meta data in the same s3 folder the results will live in (your_bucket/your_prefix/task_id).

profile pictureAWS
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions