Skip to content

Refactor hardcoded container mount paths to use constants #819

@coderabbitai

Description

@coderabbitai

Description

As introduced in PR #814, three new constants were added to SlurmCommandGenStrategy for container mount paths:

  • CONTAINER_MOUNT_INSTALL = "/cloudai_install"
  • CONTAINER_MOUNT_OUTPUT = "/cloudai_run_results"
  • CONTAINER_MOUNT_HF_HOME = "/cloudai_install/huggingface"

These constants should be used consistently across the codebase instead of hardcoded strings.

Files with hardcoded paths

Source files:

  • src/cloudai/systems/slurm/slurm_command_gen_strategy.py (line 309)
  • src/cloudai/workloads/nemo_run/slurm_command_gen_strategy.py (line 124)
  • src/cloudai/workloads/ai_dynamo/ai_dynamo.sh (lines 4-6, 17)
  • src/cloudai/workloads/triton_inference/slurm_command_gen_strategy.py (line 147)

Test files:

  • tests/test_single_sbatch_runner.py (lines 268-269, 277)
  • tests/workloads/slurm_container/test_command_gen_strategy_slurm.py (lines 49-50, 67-68, 87-88)
  • tests/workloads/nemo_run/test_command_gen_strategy_slurm.py (line 74)
  • tests/systems/slurm/test_command_gen_strategy.py (lines 239-240, 258-259, 272-273)

Proposed refactoring

  1. Replace hardcoded strings in source files with references to SlurmCommandGenStrategy.CONTAINER_MOUNT_* constants
  2. Update test files to use the constants for consistency
  3. Consider making these constants accessible in a more central location if needed by non-Slurm code

Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions