Skip to content

feat: add raise_timeout parameter to allow quiet waiting for inference results#547

Merged
nuzant merged 3 commits intomainfrom
fw/wait-quiet
Nov 7, 2025
Merged

feat: add raise_timeout parameter to allow quiet waiting for inference results#547
nuzant merged 3 commits intomainfrom
fw/wait-quiet

Conversation

@garrett4wade
Copy link
Collaborator

Description

Fixes #531

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not
    work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • I have run formatting tools (pre-commit or manual)
  • I have run relevant unit tests and they pass
  • I have added tests for new functionality
  • I have updated documentation if needed
  • My branch is up to date with main
  • This PR introduces breaking changes (if yes, fill out details below)
  • If this PR changes documentation, I have built and previewed it locally with
    jb build docs
  • No critical issues raised by AI reviewers (/gemini review)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @garrett4wade, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the wait functionality within the inference engine by introducing a raise_timeout parameter. This allows callers to choose between raising a TimeoutError or receiving a specific sentinel object (NO_RESULT) when an inference request times out, providing more flexible and robust timeout management for asynchronous operations.

Highlights

  • New raise_timeout Parameter: Introduced a new boolean parameter raise_timeout (defaulting to True) to the wait methods across the InferenceEngine hierarchy. This parameter controls whether a TimeoutError is raised upon timeout or if a special sentinel value is returned.
  • Sentinel NO_RESULT Object: A new internal class _NoResult and a corresponding singleton instance NO_RESULT have been added. This NO_RESULT object is returned by the wait method when a timeout occurs and raise_timeout is set to False, providing a quiet way to handle timeouts.
  • Updated Method Signatures and Type Hints: The wait method signatures in InferenceEngine, RemoteInferenceEngine, WorkflowExecutor, SGLangRemoteInferenceEngine, and VLLMRemoteInferenceEngine have been updated to include the raise_timeout parameter and reflect the new dict[str, Any] | _NoResult return type.
  • Refactored Timeout Handling: The core logic in WorkflowExecutor.wait has been modified to conditionally raise TimeoutError or return NO_RESULT based on the raise_timeout parameter, centralizing the new behavior.
  • Pythonic Type Hinting Updates: Minor refactoring of type hints from older typing module constructs (e.g., List, Dict, Optional) to more modern Python built-in types (e.g., list, dict, | None) has been applied in sglang_remote.py.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a raise_timeout parameter to the wait method, allowing for non-blocking waits that return a NO_RESULT sentinel instead of raising a TimeoutError. The changes are consistently applied across the API, core engine, and workflow executor. My review includes a couple of suggestions to improve documentation clarity and adhere to Python's public/private conventions for better code maintainability.

garrett4wade and others added 2 commits November 7, 2025 14:19
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@garrett4wade garrett4wade added the safe-to-test Ready to run unit-tests in a PR. label Nov 7, 2025
@nuzant nuzant merged commit 69740cc into main Nov 7, 2025
4 checks passed
@nuzant nuzant deleted the fw/wait-quiet branch November 7, 2025 07:07
Bruce-rl-hw pushed a commit to Bruce-rl-hw/AReaL-vllm that referenced this pull request Dec 4, 2025
…nce results (inclusionAI#547)

* add raise_timeout param

* Update areal/api/engine_api.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix variable naming

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Ready to run unit-tests in a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Modify the wait method of InferenceEngine to allow silent TimeoutError handling

2 participants