Skip to content

feat(rayapp) Anyscale CLI pr3 compute config#398

Open
elliot-barn wants to merge 3 commits intomainfrom
anyscale-cli-pr3-compute-config
Open

feat(rayapp) Anyscale CLI pr3 compute config#398
elliot-barn wants to merge 3 commits intomainfrom
anyscale-cli-pr3-compute-config

Conversation

@elliot-barn
Copy link
Collaborator

@elliot-barn elliot-barn commented Jan 27, 2026

Adding compute config CLI operations to anyscale cli

Method: GetComputeConfig
CLI Command: anyscale compute-config get -n
Purpose: Check if compute config exists
────────────────────────────────────────
Method: CreateComputeConfig
CLI Command: anyscale compute-config create -n -f
Purpose: Create compute config if needed
────────────────────────────────────────

elliot-barn and others added 3 commits January 27, 2026 19:05
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>
Add convertBuildIdToImageURI function that parses build IDs like
"anyscaleray2441-py312-cu128" into image URI "anyscale/ray:2.44.1-py312-cu128"
and Ray version "2.44.1".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add WorkspaceState type with constants (StateTerminated, StateStarting,
StateRunning) and String() method for representing workspace states.

Add compute config operations:
- parseComputeConfigName: parse AWS config path to config name
- CreateComputeConfig: create compute config if it doesn't exist
- GetComputeConfig: retrieve compute config details by name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @elliot-barn, 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 rayapp module by integrating Anyscale CLI operations, primarily for managing compute configurations. The new Go code provides a structured way to interact with the Anyscale platform, enabling automated creation and retrieval of compute configs, along with utility functions for parsing Anyscale-specific identifiers. This facilitates more robust and automated deployment workflows within Go-based applications.

Highlights

  • Anyscale CLI Integration: Introduced a new AnyscaleCLI Go package to programmatically interact with the Anyscale command-line interface, enabling Go applications to execute Anyscale commands.
  • Compute Config Management: Added functions to create and retrieve Anyscale compute configurations, including logic to prevent re-creation of existing configs and to fetch details by name.
  • Build ID to Image URI Conversion: Implemented a utility function (convertBuildIdToImageURI) to transform Anyscale-specific build IDs (e.g., anyscaleray2441-py312-cu128) into standard Docker image URIs and extract the corresponding Ray version.
  • Compute Config Name Parsing: Provided a helper function (parseComputeConfigName) to derive a canonical compute configuration name from a given file path, simplifying naming conventions.
  • Robust Testing with Mocking: Included comprehensive unit tests for all new functionalities, utilizing a mock anyscale executable to simulate CLI interactions reliably and ensure correctness.

🧠 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.

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.

@elliot-barn elliot-barn changed the base branch from main to anyscale-cli-pr2-build-id-conversion January 27, 2026 19:24
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 new functionality for interacting with the Anyscale CLI, specifically for managing compute configurations. It includes functions to create and retrieve compute configs, along with utility functions for parsing build IDs and compute config names. The changes are well-tested with comprehensive unit tests covering various scenarios, including error handling and edge cases. Overall, the code is well-structured and follows good practices for Go development.

I am having trouble creating individual review comments. Click here to see my feedback.

rayapp/anyscale_cli.go (58)

medium

The fmt.Println statement here is likely for debugging purposes. In production code, it's generally better to use a structured logging library (e.g., log package or a more advanced one) or remove debug prints entirely to avoid polluting standard output, which can interfere with programmatic parsing of CLI output.

rayapp/anyscale_cli_test.go (100-101)

medium

Comparing error messages using strings.Contains(err.Error(), tt.wantErr.Error()) can be brittle. If the error message changes slightly in the future, this test might break even if the underlying logic is still correct. Consider defining specific sentinel errors in anyscale_cli.go and using errors.Is for more robust error comparison in tests.

@gitar-bot
Copy link

gitar-bot bot commented Jan 27, 2026

Code Review 👍 Approved with suggestions 0 resolved / 3 findings

Well-structured CLI wrapper with comprehensive tests. Found 3 minor edge case and quality suggestions that would improve robustness but don't block the PR.

💡 Edge Case: WorkspaceState.String() returns empty for unknown states

📄 rayapp/anyscale_cli.go:31-33

The String() method for WorkspaceState returns an empty string for any state value not in the WorkspaceStateName map. This could happen if a new state is added to the enum but forgotten in the map, or if an invalid state value is used.

Consider adding a default case or validation:

func (ws WorkspaceState) String() string {
    if name, ok := WorkspaceStateName[ws]; ok {
        return name
    }
    return fmt.Sprintf("UNKNOWN(%d)", ws)
}

This provides better debugging information if an unknown state is encountered.

💡 Quality: Debug output printed to stdout may pollute logs

📄 rayapp/anyscale_cli.go:58

The runAnyscaleCLI() method prints debug output directly to stdout with fmt.Println("anyscale cli args: ", args). This could pollute logs in production environments or make output parsing difficult.

Consider one of these alternatives:

  1. Use a logger with configurable log levels
  2. Add a verbose/debug flag to AnyscaleCLI struct
  3. Remove the debug print entirely (callers can log args if needed)
type AnyscaleCLI struct {
    Verbose bool
}

func (ac *AnyscaleCLI) runAnyscaleCLI(args []string) (string, error) {
    if ac.Verbose {
        fmt.Println("anyscale cli args: ", args)
    }
    // ...
}
💡 Edge Case: No validation for numeric version string in build ID conversion

📄 rayapp/anyscale_cli.go:101-109

The convertBuildIdToImageURI function assumes the version string contains only numeric digits, but this is not validated. If the version contains non-numeric characters (e.g., "anyscaleray244a-py312"), the function will return an incorrectly formatted version like "2.44.a" instead of failing.

Consider adding validation:

// After extracting versionStr
for _, c := range versionStr {
    if c < '0' || c > '9' {
        return "", "", fmt.Errorf("version string contains non-numeric character: %s", versionStr)
    }
}

Alternatively, document that non-numeric version strings will be passed through as-is if that's intentional.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@elliot-barn elliot-barn changed the title [rayapp] Anyscale cli pr3 compute config feat(rayapp) Anyscale cli pr3 compute config Jan 27, 2026
@elliot-barn elliot-barn changed the title feat(rayapp) Anyscale cli pr3 compute config feat(rayapp) Anyscale CLI pr3 compute config Jan 27, 2026
@elliot-barn elliot-barn requested a review from aslonnie February 2, 2026 21:17
@elliot-barn elliot-barn marked this pull request as ready for review February 3, 2026 00:30
@elliot-barn elliot-barn changed the base branch from anyscale-cli-pr2-build-id-conversion to main February 3, 2026 22:12
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