FEAT: Run atomic attacks in parallel (better) within a scenario#1783
Draft
rlundeen2 wants to merge 1 commit into
Draft
FEAT: Run atomic attacks in parallel (better) within a scenario#1783rlundeen2 wants to merge 1 commit into
rlundeen2 wants to merge 1 commit into
Conversation
c9926be to
22fb8b5
Compare
Allow multiple atomic attacks in a scenario to run concurrently, driven by the existing max_concurrency parameter. All in-flight objectives across all atomic attacks share a single asyncio.Semaphore(max_concurrency), so the global concurrent-objective budget is bounded by max_concurrency regardless of how work is distributed across atomic attacks. A long-running attack can elastically use slots freed by short-running siblings. Changes: - AttackExecutor now accepts an optional external semaphore kwarg. When provided, it gates both seed-group parameter building and per-objective execution, letting a parent (e.g. Scenario) share one budget across many executors. - AtomicAttack.run_async forwards the optional semaphore to its executor. - Scenario._execute_scenario_async: when max_concurrency > 1 and more than one atomic attack remains, creates one shared semaphore and launches every remaining atomic attack via asyncio.gather, all sharing that semaphore. When max_concurrency == 1 (or only one attack remains), keeps the existing sequential loop verbatim, preserving abort-on-first-failure semantics. - Parallel failure mode uses gather(return_exceptions=True) so in-flight siblings finish before the first error is re-raised (preserves partial work for resume). - No new user-facing parameters or CLI flags. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
22fb8b5 to
b3bd470
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, scenarios could somewhat run in parallel within an atomic attack.
This allows multiple atomic attacks in a scenario to run concurrently, driven by the existing max_concurrency parameter. All in-flight objectives across all atomic attacks share a single asyncio.Semaphore(max_concurrency), so the global concurrent-objective budget is bounded by max_concurrency regardless of how work is distributed across atomic attacks. A long-running attack can elastically use slots freed by short-running siblings.