Skip to content

chore: enhance runner.service with open_session.#354

Merged
k82cn merged 8 commits intoxflops:mainfrom
k82cn:rr_svc_open_ssn
Feb 10, 2026
Merged

chore: enhance runner.service with open_session.#354
k82cn merged 8 commits intoxflops:mainfrom
k82cn:rr_svc_open_ssn

Conversation

@k82cn
Copy link
Contributor

@k82cn k82cn commented Feb 9, 2026

No description provided.

Signed-off-by: Klaus Ma <klausm@nvidia.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @k82cn, 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 refactors the RunnerService initialization to utilize the open_session API instead of create_session. This change significantly enhances the Runner's capability to manage sessions by allowing existing sessions to be reused. This is particularly important for advanced use cases such as recursive service invocations or when multiple services need to share a common session context, leading to more efficient resource utilization and streamlined application logic.

Highlights

  • Session Management Enhancement: The RunnerService initialization now utilizes the open_session API instead of create_session, enabling the reuse of existing sessions.
  • Explicit Session Specification: The open_session call now uses a SessionAttributes object for more explicit and structured definition of session parameters.
  • New End-to-End Tests: Added comprehensive tests to validate the new session reuse functionality, specifically for recursive service calls and multiple services sharing the same session.
Changelog
  • e2e/tests/test_runner.py
    • Implemented RecursiveService to showcase recursive task submission within a single session.
    • Added test_runner_recursive_same_session to verify the functionality of recursive runner execution using the open_session API.
    • Introduced test_runner_open_session_reuse to confirm that multiple RunnerService instances can successfully reuse the same session ID.
  • sdk/python/src/flamepy/runner/runner.py
    • Changed the session creation mechanism in RunnerService.__init__ from create_session to open_session.
    • Imported open_session from flamepy.core.client and SessionAttributes from flamepy.core.types.
    • Updated the open_session call to use a SessionAttributes object for defining session parameters.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
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 enhances runner.service to use the new open_session API, allowing for session reuse and enabling recursive service calls. The changes in sdk/python/src/flamepy/runner/runner.py correctly implement the switch from create_session to open_session. New e2e tests have been added to validate this new functionality, including recursive calls and session reuse across multiple services.

My review identifies one high-severity issue in the new recursive test case. The test implementation reveals a flaw in runner.Runner that causes significant performance degradation and resource leaks due to repeated, unnecessary packaging and uploading. I've provided details in a specific comment.


# Create a new Runner to reuse existing app (fail_if_exists=False by default)
# The outer Runner manages the lifecycle (registration/unregistration)
inner_runner = runner.Runner(self._session_context.application_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This line creates a new runner.Runner instance on each recursive call. The runner.Runner constructor is heavyweight: it packages the current directory and uploads it to storage on every invocation, even if the application already exists. This leads to significant performance overhead and resource leakage, as the created packages are not cleaned up.

The inner_runner is not closed (and cannot be, as it would close the shared session), so the uploaded packages in storage and local temporary package files are leaked on every recursive step.

To fix this, runner.Runner._start() should be refactored to check for the application's existence before packaging and uploading. If the application already exists and fail_if_exists=False, it should skip these expensive steps.

While the fix is in sdk/python/src/flamepy/runner/runner.py, which is outside the diff for this file, this test introduces the problematic pattern. The test is valuable for testing recursion, but it highlights a critical flaw in the Runner implementation that should be addressed.

k82cn added 7 commits February 9, 2026 12:57
Signed-off-by: Klaus Ma <klausm@nvidia.com>
Signed-off-by: Klaus Ma <klausm@nvidia.com>
Signed-off-by: Klaus Ma <klausm@nvidia.com>
Signed-off-by: Klaus Ma <klausm@nvidia.com>
Signed-off-by: Klaus Ma <klausm@nvidia.com>
Signed-off-by: Klaus Ma <klausm@nvidia.com>
Signed-off-by: Klaus Ma <klausm@nvidia.com>
@k82cn k82cn merged commit 05a52f9 into xflops:main Feb 10, 2026
5 checks passed
@k82cn k82cn deleted the rr_svc_open_ssn branch February 10, 2026 08:11
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.

1 participant