Skip to content

chore: add flamepy.Runner.#298

Merged
k82cn merged 1 commit into
xflops:mainfrom
k82cn:flm_runner
Jan 14, 2026
Merged

chore: add flamepy.Runner.#298
k82cn merged 1 commit into
xflops:mainfrom
k82cn:flm_runner

Conversation

@k82cn
Copy link
Copy Markdown
Contributor

@k82cn k82cn commented Jan 14, 2026

No description provided.

Signed-off-by: Klaus Ma <klausm@nvidia.com>
@gemini-code-assist
Copy link
Copy Markdown
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 introduces the flamepy.Runner API, a significant enhancement designed to simplify the deployment and execution of Python applications on the Flame distributed computing platform. It provides a high-level, context-managed approach to automate the entire application lifecycle, from packaging and dependency management to service registration and cleanup. Complementary improvements to the FlameRunpyService ensure more efficient data handling through object caching and robust package installation from diverse archive formats, collectively offering a smoother and more performant developer experience.

Highlights

  • New flamepy.Runner API: A Python context manager (Runner) has been introduced to streamline the lifecycle of deploying Python applications on Flame, automating packaging, uploading, registering, and cleaning up applications.
  • Dynamic Service Creation and ObjectFuture: The Runner allows creating RunnerService instances from Python functions, classes, or instances for remote invocation. A new ObjectFuture class manages asynchronous results, returning ObjectRef for efficient data transfer and caching.
  • Enhanced FlameRunpyService: The underlying FlameRunpyService now caches task results as ObjectRef for improved data transfer efficiency and supports automatic extraction of various archive formats (e.g., .tar.gz, .zip) during package installation.
  • Predictable Application Working Directories: Applications deployed via Runner now consistently use /opt/{app_name} as their working directory on executor nodes, enhancing predictability and isolation.
  • Updated Configuration and Infrastructure: Configuration files (ci/flame.yaml, compose.yaml) and core components (executor_manager/src/cache/mod.rs, executor_manager/src/shims/host_shim.rs) have been updated to support the new package management and deployment features.
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
Copy Markdown
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 the flamepy.Runner API, a significant feature aimed at simplifying the deployment of Python applications on Flame. The changes encompass new SDK components for automatic packaging, uploading, and service registration, along with corresponding configurations, comprehensive documentation, and tests. The overall implementation is robust and well-structured. My review includes feedback on a documentation inconsistency, some minor improvements for documentation clarity, and suggestions to enhance code style and robustness in the test and runtime components.


1. **Storage**: Only `file://` URLs supported (S3, HTTP planned for future)
2. **Pickling**: Execution objects must be picklable
3. **Package Reuse**: No caching yet (always uploads new package)
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.

medium

The documentation in the "Limitations" section states that there is "No caching yet (always uploads new package)". This contradicts the implementation in sdk/python/src/flamepy/runner.py, where the _upload_package method checks if a package with the same name already exists and skips the upload. Please update the documentation to accurately reflect this behavior.

Comment on lines +288 to +297
## Summary

This change provides:
- ✅ Predictable working directories (`/opt/{name}`)
- ✅ Organized file system layout
- ✅ Better debugging and troubleshooting
- ✅ Application isolation
- ✅ Fully backward compatible

No code changes required for existing applications!
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.

medium

This document has a duplicated "Summary" section at the end. To improve readability, please remove this redundant section.

Comment thread e2e/tests/test_flmrun.py

def test_flmrun_class_method():
"""Test Case 2: Run methods on a class instance."""
from flamepy.cache import get_object
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.

medium

The import from flamepy.cache import get_object is repeated within several test functions. According to Python's PEP 8 style guide, imports should be placed at the top of the file. Consolidating this import at the top level will improve code readability and maintainability.

References
  1. Imports should generally be placed at the top of the file, after any module docstrings and before any module-level global variables and constants. This practice improves readability and avoids repeated imports within functions. (link)


# Get the working directory (default to /tmp if not set)
working_dir = os.getcwd()
extract_dir = os.path.join(working_dir, f"extracted_{os.path.basename(package_path).split('.')[0]}")
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.

medium

The logic to generate the extraction directory name using os.path.basename(package_path).split('.')[0] is not fully robust. It may produce unexpected results for filenames containing multiple dots, such as version numbers (e.g., my-app-1.2.3.tar.gz would result in my-app-1). Consider a more reliable method for stripping archive extensions to handle such cases correctly.

@k82cn k82cn merged commit c56373b into xflops:main Jan 14, 2026
4 checks passed
@k82cn k82cn deleted the flm_runner branch January 14, 2026 12:00
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