Skip to content

feat: add account name to slurm config#14

Open
Neonkraft wants to merge 1 commit intomainfrom
feat/job-account
Open

feat: add account name to slurm config#14
Neonkraft wants to merge 1 commit intomainfrom
feat/job-account

Conversation

@Neonkraft
Copy link
Copy Markdown
Collaborator

Summary

What does this PR do?

This PR adds an optional account filed to the SLURM job that is submitted.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Performance
  • Documentation
  • Maintenance

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to support specifying a SLURM account when generating/submitting post-training SLURM job scripts.

Changes:

  • Adds conditional #SBATCH --account={{ account }} directives to the SLURM job script templates.
  • Adds an account field to SlurmConfig.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/post_training/slurm/job.sh.jinja Adds optional --account SBATCH directive in the non-container TRL template.
src/post_training/slurm/job_trl_container.sh.jinja Adds optional --account SBATCH directive in the containerized TRL template.
src/post_training/slurm/job_llamafactory.sh.jinja Adds optional --account SBATCH directive in the LlamaFactory template.
src/post_training/config.py Introduces SlurmConfig.account configuration field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +9 to +10
{% if account %}#SBATCH --account={{ account }}
{% endif %}#SBATCH --nodes={{ num_nodes }}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

account is referenced in the template but is not currently provided in the template.render(...) context in src/post_training/slurm/launcher.py (render_*_slurm_script functions). As a result the --account directive will never be emitted (Jinja treats missing vars as Undefined/falsy by default), so this feature won’t work as intended. Pass account=config.slurm.account into the render context for each script renderer (and consider keeping the {% if %} / #SBATCH directives on separate lines for consistency with the other conditional blocks in this template).

Suggested change
{% if account %}#SBATCH --account={{ account }}
{% endif %}#SBATCH --nodes={{ num_nodes }}
{% if account %}
#SBATCH --account={{ account }}
{% endif %}
#SBATCH --nodes={{ num_nodes }}

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
{% if account %}#SBATCH --account={{ account }}
{% endif %}#SBATCH --nodes={{ num_nodes }}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

account is referenced in the template but is not currently provided in the template.render(...) context in src/post_training/slurm/launcher.py. This makes the {% if account %} block effectively dead code, so containerized TRL jobs will never set #SBATCH --account even when configured. Ensure account=config.slurm.account is passed when rendering this template.

Suggested change
{% if account %}#SBATCH --account={{ account }}
{% endif %}#SBATCH --nodes={{ num_nodes }}
{% if account is defined and account %}
#SBATCH --account={{ account }}
{% endif %}
#SBATCH --nodes={{ num_nodes }}

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
{% if account %}#SBATCH --account={{ account }}
{% endif %}#SBATCH --nodes={{ num_nodes }}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

account is referenced in the template but is not currently provided in the template.render(...) context in src/post_training/slurm/launcher.py. Without passing account=config.slurm.account, the #SBATCH --account directive will never be written into the generated script for this backend.

Suggested change
{% if account %}#SBATCH --account={{ account }}
{% endif %}#SBATCH --nodes={{ num_nodes }}
{% if account is defined and account %}
#SBATCH --account={{ account }}
{% endif %}
#SBATCH --nodes={{ num_nodes }}

Copilot uses AI. Check for mistakes.
"""SLURM job scheduler parameters."""

partition: str = "gpu"
account: str | None = "OELLM_prod2026"
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

The PR description says the SLURM account is optional, but the new config default sets account to a concrete value ("OELLM_prod2026"). This makes the option effectively enabled by default (once the renderer passes it through) and also hard-codes an environment-specific account into the library default. Consider defaulting to None and letting users set it via YAML/CLI overrides when needed.

Suggested change
account: str | None = "OELLM_prod2026"
account: str | None = None

Copilot uses AI. Check for mistakes.
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