Skip to content

feat(slurm): add startup_script support to slurm login nodes#5800

Draft
kvenkatachala333 wants to merge 1 commit into
GoogleCloudPlatform:developfrom
kvenkatachala333:feature/login-startup-script
Draft

feat(slurm): add startup_script support to slurm login nodes#5800
kvenkatachala333 wants to merge 1 commit into
GoogleCloudPlatform:developfrom
kvenkatachala333:feature/login-startup-script

Conversation

@kvenkatachala333

Copy link
Copy Markdown
Member

Description

Fixes #5716 by adding startup_script support to the schedmd-slurm-gcp-v6-login module.

Previously, the runner-startup module was silently ignored on login nodes because the variable was missing from the login module schema. This PR plumbs the script correctly through both the login and controller modules so that the blueprint generator can successfully inject startup scripts into login nodes.

Changes

  • schedmd-slurm-gcp-v6-login: Added startup_script input variable and wired it to output via the login_node map.
  • schedmd-slurm-gcp-v6-controller: Updated the login_nodes variable schema to accept startup_script and appended it to the internal login module instantiation logic.

Existing configurations and workflows lacking a startup_script will gracefully fallback to empty lists and # no-op strings, ensuring 100% backward compatibility.

@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 introduces support for startup scripts on Slurm login nodes within the Google Cloud Platform cluster toolkit. By updating the schema and wiring the necessary logic through the controller and login modules, users can now successfully inject custom startup scripts into their login node configurations. The changes are designed to be fully backward compatible, ensuring that existing deployments remain unaffected.

Highlights

  • Login Node Startup Script Support: Enabled the use of startup scripts on Slurm login nodes by plumbing the necessary variables through the controller and login modules.
  • Schema Updates: Updated the login_nodes variable schema in the controller module to accept startup_script definitions, ensuring compatibility with the blueprint generator.
  • Backward Compatibility: Maintained backward compatibility by defaulting new startup script inputs to empty lists or no-op strings for existing configurations.
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 the 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 counterproductive. 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 adds support for custom startup scripts in the login nodes of the schedmd-slurm-gcp-v6 scheduler module. The review feedback highlights two potential plan-time crashes related to null values: one where concat() could fail if each.value.startup_script is null or missing, and another where a null var.startup_script could cause a crash during downstream resource computation. Both issues can be resolved by using safe fallbacks and conditional checks.

login_nodes = each.value

startup_scripts = local.login_startup_scripts
startup_scripts = concat(local.login_startup_scripts, each.value.startup_script)

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

If each.value.startup_script is explicitly set to null or is missing, the concat function will fail at plan-time because it expects all arguments to be lists.

To prevent plan-time crashes and safely handle null or missing values (in alignment with the general rule of keeping variables nullable and using safe fallbacks), use a try() block to safely access the attribute and default to an empty list [] if it is null or missing.

  startup_scripts         = concat(local.login_startup_scripts, try(each.value.startup_script != null ? each.value.startup_script : [], []))
References
  1. To allow variables to be explicitly set to null without automatically overriding them to default configurations, keep the variable nullable and use try() blocks in the main configuration to safely access its attributes and prevent plan-time crashes.

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.

can you please check if this is required to be addressed or not

Comment on lines +66 to +69
ghpc_startup_script = [{
filename = "ghpc_login_startup.sh"
content = var.startup_script
}]

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

If var.startup_script is explicitly set to null, content will be null. This will cause a plan-time crash in the downstream google_storage_bucket_object.startup_scripts resource when computing md5(each.value).

To prevent this, instead of overriding the user's explicit null setting with a default string, conditionally omit the startup script configuration entirely if var.startup_script is null.

  ghpc_startup_script = var.startup_script != null ? [{
    filename = "ghpc_login_startup.sh"
    content  = var.startup_script
  }] : []
References
  1. To allow variables to be explicitly set to null without automatically overriding them to default configurations, keep the variable nullable and use try() blocks in the main configuration to safely access its attributes and prevent plan-time crashes.

@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

@LAVEEN LAVEEN assigned kvenkatachala333 and unassigned LAVEEN Jun 18, 2026
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.

2 participants