Skip to content

feat: Per-task shots in run_batch - #1323

Merged
speller26 merged 9 commits into
mainfrom
shots
Jul 31, 2026
Merged

speller26 merged 9 commits into
mainfrom
shots

Conversation

@speller26

Copy link
Copy Markdown
Member

Issue #, if available:

Description of changes:

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@speller26
speller26 requested a review from a team as a code owner July 15, 2026 20:18
@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c79ea8f) to head (f143ae5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1323   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          171       171           
  Lines        11564     11577   +13     
  Branches      1515      1517    +2     
=========================================
+ Hits         11564     11577   +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/braket/aws/aws_quantum_task_batch.py Outdated
Comment thread src/braket/aws/aws_quantum_task_batch.py
aws_quantum_task_mock.return_value = task_mock

shots = [10, 20, 30]
device("arn:aws:braket:::device/quantum-simulator/amazon/sim").run_batch(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this doesn't use ProgramSets at all, right? It creates 3 separate single tasks?

The code doesn't touch the relevant lines so it's hard to tell from this change alone.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't just for program sets; you can run individual circuits with different shot counts now.

max_parallel=1,
)

normalize_mock.assert_called_once()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not checking the result? What is this test validating?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just another sanity check that we're not multipying the shot vector across the tasks; this test might be redundant

max_parallel=1,
)

assert batch.size == len(shots)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this trivial from the test construction? What is this testing? The size method wasn't added in this PR, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's pretty redundant; it's just a sanity check to ensure that the shot vector didn't screw up the batch size (for example, running each task len(shots) times)

Comment thread test/unit_tests/braket/aws/test_aws_quantum_task_batch.py Outdated


@patch("braket.aws.aws_quantum_task.AwsQuantumTask.create")
def test_retry_with_shot_sequence(mock_create):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's testing retry instead of the new shots logic. Can you help me understand how these two processes interact?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to ensure that the retry uses the correct shot count for the retried task

@speller26
speller26 merged commit 356495e into main Jul 31, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants