Skip to content

Testbranch (do not merge)#5247

Draft
LAVEEN wants to merge 13 commits intoGoogleCloudPlatform:developfrom
LAVEEN:testbranch
Draft

Testbranch (do not merge)#5247
LAVEEN wants to merge 13 commits intoGoogleCloudPlatform:developfrom
LAVEEN:testbranch

Conversation

@LAVEEN
Copy link
Contributor

@LAVEEN LAVEEN commented Feb 16, 2026

Submission Checklist

NOTE: Community submissions can take up to 2 weeks to be reviewed.

Please take the following actions before submitting this pull request.

  • Fork your PR branch from the Toolkit "develop" branch (not main)
  • Test all changes with pre-commit in a local branch #
  • Confirm that "make tests" passes all tests
  • Add or modify unit tests to cover code changes
  • Ensure that unit test coverage remains above 80%
  • Update all applicable documentation
  • Follow Cluster Toolkit Contribution guidelines #

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @LAVEEN, 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 primarily focuses on enhancing the robustness of the CI/CD pipeline, particularly for 'onspot' test configurations. The changes aim to mitigate common issues like resource naming conflicts and false-positive build conflict detections, which can arise during parallel or frequent test deployments. By introducing randomization and unique identifiers for networking resources, and refining the build conflict detection logic, the PR improves the reliability and efficiency of automated testing.

Highlights

  • Build Conflict Resolution: Modified the check_running_build.sh script to allow multiple concurrent 'onspot' builds that are not daily tests, preventing unnecessary build failures due to perceived conflicts.
  • Networking Resource Randomization: Introduced randomization for networking keys and IP CIDR ranges within blueprint files, and implemented a build ID prefixing mechanism for networking resources to prevent naming conflicts during parallel deployments.
  • Consistent Naming Conventions: Updated naming conventions for deployment, Slurm cluster, and network resources in the ml-a3-ultragpu-onspot-slurm.yml test configuration to use a truncated build ID, ensuring uniqueness and consistency.
Changelog
  • tools/cloud-build/check_running_build.sh
    • Updated the Apache license URL format.
    • Modified the build check logic to permit multiple concurrent 'onspot' builds that are not daily tests, preventing premature exits.
  • tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml
    • Added a task to generate a random suffix for networking resources.
    • Implemented generic randomization for network_name, subnetwork_name, and network_name_prefix keys in blueprints.
    • Introduced tasks to generate random second and third octets for IP ranges.
    • Created a unique IP CIDR range using randomized octets.
    • Injected unique IP ranges into the blueprint by replacing ip_cidr_range and ip_range keys.
    • Added logic to prefix networking resources (network_name, network_id, subnetwork_name, network_name_prefix) with the build ID to prevent 409 conflicts.
    • Forced randomization of a specific conflicting network string (a3u-onspot-slurm-net) by prefixing it with the build ID.
  • tools/cloud-build/daily-tests/tests/ml-a3-ultragpu-onspot-slurm.yml
    • Adjusted deployment_name to use a 4-character truncated build ID.
    • Modified slurm_cluster_name to use a 4-character truncated build ID.
    • Updated network to incorporate a 4-character truncated build ID.
    • Changed base_network_name to use a 4-character truncated build ID.
Activity
  • This pull request is marked as a 'Testbranch (do not merge)' by the author, LAVEEN, indicating it is for internal testing or experimentation.
  • No human activity (comments, reviews) has been recorded on 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 introduces several changes to improve the reliability of integration tests by randomizing network and IP address resources to avoid conflicts between concurrent builds. The changes in check_running_build.sh are good, allowing concurrent 'onspot' builds. The changes in the Ansible playbooks and test configurations effectively introduce this randomization. My review includes a few suggestions to improve maintainability and fix a potential bug in the Ansible playbook. Specifically, I've pointed out a redundant and likely buggy task, a brittle string replacement that could be improved, and an opportunity to reduce repetition in the test configuration file.

Comment on lines +56 to +68
- name: Generate random suffix for networking
ansible.builtin.set_fact:
random_id: "{{ query('password', '/dev/null chars=ascii_lowercase,digits length=4') | first }}"

- name: Generic randomization of networking keys in blueprint
ansible.builtin.replace:
path: "{{ workspace }}/{{ blueprint_path }}"
regexp: '^(\s*)({{ item }}):\s*([^#\n\s]+)(.*)$'
replace: '\1\2: \3-{{ random_id }}\4'
loop:
- network_name
- subnetwork_name
- network_name_prefix
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 block of tasks appears to be incorrect and is also redundant.

  1. The replace task uses path: "{{ workspace }}/{{ blueprint_path }}". The variable blueprint_path is not defined within the provided context; other tasks correctly use blueprint_yaml. This is likely a bug that would cause the task to fail.
  2. This block's goal of randomizing network names is also handled by the task "Prefix networking resources with Build ID to prevent 409 conflicts" at line 145.

To fix the bug and remove redundancy, I recommend removing this entire block (lines 56-68). If a random suffix is still required, that logic should be merged into the task at line 145.

Comment on lines +159 to +165
- name: Force randomization of networking strings in blueprint
ansible.builtin.replace:
path: "{{ blueprint_yaml }}"
# Matches any occurrence of the conflicting network name string
regexp: 'a3u-onspot-slurm-net'
# Replaces it with the prefixed version
replace: '{{ build }}-a3u-onspot-slurm-net'
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This task uses a global replacement for the hardcoded string a3u-onspot-slurm-net. This is a brittle approach that can be difficult to maintain, as it might have unintended side effects if the string appears in other contexts (e.g., comments, or as part of a larger name).

For better long-term maintainability, it would be best to identify where this string originates in the blueprint and parameterize it properly. This would make the configuration more explicit and robust.

Comment on lines +19 to +25
deployment_name: "a3u-onspot-slurm-{{ build[0:4] }}"
slurm_cluster_name: "a3usp{{ build[0:4] }}"
workspace: /workspace
blueprint_yaml: "{{ workspace }}/examples/machine-learning/a3-ultragpu-8g/a3ultra-slurm-blueprint.yaml"
login_node: "{{ slurm_cluster_name }}-slurm-login-*"
controller_node: "{{ slurm_cluster_name }}-controller"
network: "{{ test_name }}-net-0"
network: "a3u-{{ build[0:4] }}-net-0"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The string slice [0:4] is used multiple times across this file (here and on line 54) to create a shortened build ID. This use of a "magic number" and repeated slicing makes the code harder to read and maintain.

To improve this, I suggest defining a variable at the top of the file, like short_build_id: "{{ build[0:4] }}", and then reusing {{ short_build_id }} wherever the shortened ID is needed. This would make the code DRY (Don't Repeat Yourself) and make it easier to change the length of the short ID in the future.

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

Comments