Skip to content

feat(rayapp): Anyscale CLI pr6#412

Open
sai-miduthuri wants to merge 34 commits intomainfrom
sai/template-test-runner
Open

feat(rayapp): Anyscale CLI pr6#412
sai-miduthuri wants to merge 34 commits intomainfrom
sai/template-test-runner

Conversation

@sai-miduthuri
Copy link

This is a fork of PR #390. The following PR description is copied from the original PR.

Adds comprehensive Anyscale CLI wrapper and workspace test runner:

Anyscale CLI (anyscale_cli.go)

  • Compute config management (Create, Get, List)
  • Workspace operations (Create, Start, Terminate, Push, RunCommand)
  • Build ID to image URI conversion
  • Full unit test coverage

Workspace Test Runner (test.go)

  • WorkspaceTestConfig for running tests in Anyscale workspaces
  • Automated flow: create compute config, create workspace, push template, run tests, cleanup
  • Zips template to temp directory before pushing
  • Full unit test coverage for all scenarios

Utilities (util.go)

  • zipDirectory function for packaging templates

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sai-miduthuri, 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 significantly expands the capabilities of the rayapp tool by integrating robust Anyscale workspace management and automated template testing. The changes provide developers with a streamlined way to define, deploy, and validate Ray application templates directly within Anyscale's cloud environment, enhancing the overall CI/CD pipeline and ensuring template reliability.

Highlights

  • Anyscale CLI Wrapper: Introduced a comprehensive Go wrapper for the Anyscale CLI, enabling programmatic management of compute configurations (create, get, list) and workspace operations (create, start, terminate, push, run command). It also handles conversions between Anyscale build IDs and image URIs, and automatically converts old compute config formats.
  • Workspace Test Runner: Added a new workspace test runner (test.go) designed for automated testing of templates within Anyscale workspaces. This runner orchestrates the full lifecycle: creating compute configs, provisioning workspaces, pushing templates, executing tests, and cleaning up resources.
  • CLI Command Enhancements: The rayapp command-line tool now includes test-all and test <template-name> commands, allowing users to trigger the new workspace test runner directly from the CLI. The argument parsing has also been refactored for improved structure.
  • Cluster Environment Flexibility: The ClusterEnv configuration now supports specifying ImageURI in addition to BuildID, providing more flexibility. A new validation function ensures consistency between these fields and handles BYOD (Bring Your Own Docker) configurations.
  • Utility for Directory Zipping: A new zipDirectory utility function has been added to efficiently create zip archives from specified directories, which is crucial for packaging templates before pushing them to Anyscale workspaces.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • build_rayapp.sh
    • Modified the build script to move the rayapp executable to ../rayapp instead of executing it directly.
  • rayapp/anyscale_cli.go
    • Added new file implementing a Go wrapper for Anyscale CLI commands.
    • Included functions for compute config management (Create, Get), workspace operations (Create, Start, Terminate, Push, RunCommand, Status, Wait), and workspace deletion via REST API.
    • Implemented logic for converting Anyscale build IDs to image URIs and vice-versa.
    • Added functionality to detect and convert old compute config YAML formats to the new format.
  • rayapp/anyscale_cli_test.go
    • Added new file with comprehensive unit tests for the AnyscaleCLI wrapper, covering all implemented functions and edge cases.
  • rayapp/builder_test.go
    • Updated TestBuilder to include test cases for ClusterEnv configurations using ImageURI.
  • rayapp/rayapp/main.go
    • Refactored command-line argument parsing using flag.NewFlagSet.
    • Introduced new test-all and test <template-name> commands to invoke the workspace test runner.
    • Updated usage instructions to reflect the new commands and flags.
  • rayapp/template.go
    • Added ImageURI field to the ClusterEnv struct for more flexible image specification.
    • Implemented validateAndBuildClusterEnv to ensure consistency between BuildID and ImageURI and validate BYOD configurations.
    • Modified readTemplates to apply validateAndBuildClusterEnv to each template read.
  • rayapp/template_test.go
    • Added new test cases for job-intro-image-uri and no-cluster-env templates.
    • Included tests to verify error handling for buildIDImageURIMismatch, emptyClusterEnv, and byodIncomplete in ClusterEnv.
  • rayapp/test.go
    • Added new file implementing the WorkspaceTestConfig struct and the core workspace test runner logic.
    • Provided TestAll and Test functions to execute tests on templates.
    • The Run method orchestrates the end-to-end testing process: compute config creation, workspace lifecycle management, template zipping and pushing, command execution, and resource cleanup.
  • rayapp/test_test.go
    • Added new file with unit tests for the WorkspaceTestConfig and the workspace test runner, covering various success and failure scenarios.
  • rayapp/util.go
    • Added zipDirectory function to create a zip file from a given source directory, including all its contents with relative paths.
Activity
  • The pull request is a fork of an existing PR, indicating a continuation or refinement of previous work on Anyscale integration.
  • The author has introduced significant new functionality, including a Go wrapper for the Anyscale CLI and a comprehensive workspace test runner.
  • Extensive unit tests have been added for both the CLI wrapper and the test runner, demonstrating a focus on code quality and reliability.
  • The changes span multiple files, touching core CLI logic, template definitions, and utility functions, suggesting a substantial feature implementation.
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 comprehensive Anyscale CLI wrapper and a workspace test runner for templates. The changes are extensive, adding new functionality and thorough testing. My review focuses on correctness, resource management, and usability. I've identified a critical resource leak in the test runner, a double-close bug, and a few medium-severity issues related to redundant output, unhandled errors, and misleading CLI usage information. Overall, this is a solid contribution that will be even better with these issues addressed.

@aslonnie
Copy link
Collaborator

aslonnie commented Feb 6, 2026

this PR is too big to review as a whole..

elliot-barn and others added 5 commits February 6, 2026 20:54
Extract tailWriter into its own file with a bytes.Buffer-based
double-buffer design. Initial memory footprint is near zero (no
upfront 1MB allocation); buffers grow lazily as data is written.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add foundational components for Anyscale CLI wrapper:
- AnyscaleCLI struct and NewAnyscaleCLI() constructor
- errAnyscaleNotInstalled error sentinel for installation checks
- isAnyscaleInstalled() helper to verify CLI availability
- runAnyscaleCLI() base method for executing anyscale commands

Includes comprehensive test coverage with setupMockAnyscale test helper.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Replace bytes.Buffer with a fixed-size circular buffer (tailWriter)
so memory usage never exceeds maxOutputBufferSize during command
execution. The previous approach truncated after the command finished,
allowing unbounded growth during long-running commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@elliot-barn elliot-barn changed the title feat(rayapp): Add Anyscale CLI wrapper and workspace test runner for templates feat(rayapp): Anyscale CLI pr6 Feb 6, 2026
Remove the inline ring-buffer tailWriter from anyscale_cli.go and
its tests from anyscale_cli_test.go. The tailWriter now lives in
tail_writer.go (from the tailwriter-extract branch) with a lazy
double-buffer implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sai-miduthuri sai-miduthuri force-pushed the sai/template-test-runner branch from e2ad936 to c32de39 Compare February 6, 2026 23:33
elliot-barn and others added 16 commits February 6, 2026 16:22
Adds comprehensive Anyscale CLI wrapper and workspace test runner:

**Anyscale CLI (anyscale_cli.go)**
- Compute config management (Create, Get, List)
- Workspace operations (Create, Start, Terminate, Push, RunCommand)
- Build ID to image URI conversion
- Full unit test coverage

**Workspace Test Runner (test.go)**
- WorkspaceTestConfig for running tests in Anyscale workspaces
- Automated flow: create compute config, create workspace, push template, run tests, cleanup
- Zips template to temp directory before pushing
- Full unit test coverage for all scenarios

**Utilities (util.go)**
- zipDirectory function for packaging templates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Restore WorkspaceTestConfig struct that was commented out but still
  referenced by workspace functions
- Update TestCreateComputeConfig to use temp config files instead of
  non-existent paths, since CreateComputeConfig now reads the file
- Remove ListComputeConfigs function and its tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
The token field was never used - authentication relies on environment
variables (ANYSCALE_CLI_TOKEN, ANYSCALE_HOST) instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Authentication is handled via environment variables (ANYSCALE_CLI_TOKEN
& ANYSCALE_HOST) rather than interactive login.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
@sai-miduthuri sai-miduthuri force-pushed the sai/template-test-runner branch from c32de39 to 4a3594e Compare February 7, 2026 00:41
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.

3 participants