Skip to content

fix(slurm/scripts): use locationPolicy.zones for AI zone support in Regional BulkInsert#5378

Merged
kvenkatachala333 merged 3 commits into
GoogleCloudPlatform:developfrom
kvenkatachala333:aizone_bulk
Apr 29, 2026
Merged

fix(slurm/scripts): use locationPolicy.zones for AI zone support in Regional BulkInsert#5378
kvenkatachala333 merged 3 commits into
GoogleCloudPlatform:developfrom
kvenkatachala333:aizone_bulk

Conversation

@kvenkatachala333

@kvenkatachala333 kvenkatachala333 commented Mar 22, 2026

Copy link
Copy Markdown
Member

Description

This PR updates the payload mapping for Regional BulkInsert requests in resume.py to support building instances inside AI zones.

The Problem

The previous implementation used locationPolicy.locations{} (a dictionary map). Compute Engine specifications do not support mapping AI-specific zones to that dictionary structure, causing AI zones to be either rejected (historical validation error) or silently ignored by the backend.

The Solution

Refactored create_instances_request to specify explicitly target layouts using the array locationPolicy.zones[] structure:

body["locationPolicy"] = dict(
    zones = [ { "zone": f"zones/{z}" } for z in zone_allow ],
    targetShape = nodeset.zone_target_shape,
)

Testing Performed

Verified on a live Slurm Controller node utilizing simulated injection targetting multiple zones (confirming clean creation loops without crashes on standard regional nodes) and also verified that Zonal BulkInsert (len == 1) is modularly untouched.

@kvenkatachala333 kvenkatachala333 added the release-chore To not include into release notes label Mar 22, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 modifies the resume.py script to correctly handle AI zones during regional bulk insert operations. The previous implementation was incompatible with AI zones due to its reliance on a dictionary-based location mapping. This change refactors the code to use an array-based zone specification, ensuring proper support for AI zones while maintaining existing functionality for zonal bulk inserts.

Highlights

  • AI Zone Support: The primary goal is to enable the creation of instances within AI zones using Regional BulkInsert requests.
  • Location Policy Update: The locationPolicy is updated to use zones[] array instead of locations{} dictionary to align with Compute Engine specifications for AI zones.
  • Zonal BulkInsert Unchanged: The existing Zonal BulkInsert functionality (when only one zone is used) remains untouched and modularly unaffected.
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.

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.

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

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.

Code Review

This pull request updates the regional BulkInsert payload to use locationPolicy.zones[] instead of locationPolicy.locations{}, which enables support for AI zones. The change is clear and directly addresses the issue described.

My review includes one suggestion to add a warning log when zone_policy_deny is configured for a regional bulk insert, as this functionality is being removed. This will help prevent unexpected behavior for users who might have this setting in their configurations.

@kvenkatachala333

Copy link
Copy Markdown
Member Author

/gemini review

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

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.

Code Review

This pull request correctly refactors the regional BulkInsert request payload to use locationPolicy.zones instead of locationPolicy.locations. This change enables support for AI-specific zones, which was the goal. The implementation is clean and removes the now-unused zone_deny logic, simplifying the code. I have one minor suggestion to improve the clarity of a comment.

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

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.

Code Review

This pull request correctly updates the regional BulkInsert payload to use locationPolicy.zones, which enables support for AI zones as intended. The code is now simpler and more aligned with the current Google Cloud API.

I've identified one potential issue where an empty zone_allow list could cause the API request to fail. I've added a specific comment with a suggestion to address this edge case. Otherwise, the change is excellent. I've adjusted the severity to medium.

@kvenkatachala333 kvenkatachala333 marked this pull request as ready for review April 29, 2026 06:09
@kvenkatachala333 kvenkatachala333 requested a review from a team as a code owner April 29, 2026 06:09

@LAVEEN LAVEEN left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@kvenkatachala333 kvenkatachala333 merged commit abe15de into GoogleCloudPlatform:develop Apr 29, 2026
32 of 77 checks passed
@kvenkatachala333 kvenkatachala333 deleted the aizone_bulk branch April 29, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-chore To not include into release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants