Skip to content

[https://nvbugs/5955173][fix] Add abort method for GenerationResultBa…#12138

Closed
JunyiXu-nv wants to merge 1 commit intoNVIDIA:mainfrom
JunyiXu-nv:dev-junyi-cherry-pick-abort-bug-fix
Closed

[https://nvbugs/5955173][fix] Add abort method for GenerationResultBa…#12138
JunyiXu-nv wants to merge 1 commit intoNVIDIA:mainfrom
JunyiXu-nv:dev-junyi-cherry-pick-abort-bug-fix

Conversation

@JunyiXu-nv
Copy link
Collaborator

@JunyiXu-nv JunyiXu-nv commented Mar 12, 2026

…se (#11970)

Summary by CodeRabbit

Release Notes

  • New Features

    • Implemented an abort mechanism for generation operations, enabling users to cancel ongoing tasks and verify abort status.
  • Tests

    • Added unit tests validating abort functionality and state transitions.

Description

Cherry-pick #11970

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

…se (NVIDIA#11970)

Signed-off-by: Junyi Xu <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv JunyiXu-nv requested a review from a team as a code owner March 12, 2026 05:16
@JunyiXu-nv JunyiXu-nv requested a review from hchings March 12, 2026 05:16
@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@JunyiXu-nv JunyiXu-nv requested review from Superjomn and dongfengy and removed request for Superjomn, dongfengy and hchings March 12, 2026 05:17
@JunyiXu-nv JunyiXu-nv closed this Mar 12, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa4a8f06-8d3f-4322-b639-41e59a97f06a

📥 Commits

Reviewing files that changed from the base of the PR and between 8de01ac and e4279cb.

📒 Files selected for processing (3)
  • tensorrt_llm/executor/postproc_worker.py
  • tensorrt_llm/executor/result.py
  • tests/unittest/llmapi/test_executor.py

📝 Walkthrough

Walkthrough

This change introduces a centralized abortion mechanism for generation results. A should_abort boolean flag is added to PostprocWorker.Output. When processing responses, the system checks this flag and triggers abort() on GenerationResultBase if set. GenerationResult now delegates abortion to its base class instead of managing abort state locally.

Changes

Cohort / File(s) Summary
Abortion State Propagation
tensorrt_llm/executor/postproc_worker.py, tensorrt_llm/executor/result.py
Introduces should_abort: bool field to PostprocWorker.Output and adds centralized abort() / aborted() methods to GenerationResultBase. Coordinates abortion via _handle_response checking the should_abort flag. GenerationResult now delegates to base class for abortion handling.
Unit Tests
tests/unittest/llmapi/test_executor.py
Adds test coverage for GenerationResultBase.abort() / aborted() behavior, PostprocWorker.Output.should_abort flag defaults and construction, and cross-component abortion propagation through _handle_response.

Sequence Diagram(s)

sequenceDiagram
    participant PW as PostprocWorker
    participant HR as Response Handler<br/>(_handle_response)
    participant GRB as GenerationResultBase
    
    PW->>PW: Compute should_abort from record
    PW->>PW: Create Output(should_abort=True)
    PW->>HR: Emit Output with should_abort flag
    
    HR->>HR: Check response.should_abort
    
    alt should_abort == True and not already aborted
        HR->>GRB: abort()
        GRB->>GRB: Set _aborted = True
    end
    
    HR->>GRB: Query aborted()
    GRB-->>HR: Return _aborted state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38674 [ ] completed with state FAILURE. Commit: e4279cb
Not allowed on merged PR

Link to invocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants