Skip to content

Enroot Integration Strategy #76

@dciangot

Description

@dciangot

Configuration Extension

Add Enroot-specific fields to SlurmConfig in pkg/slurm/types.go:23-27:

  EnrootDefaultOptions []string `yaml:"EnrootDefaultOptions" default:"[\"--rw\"]"`
  EnrootPrefix         string   `yaml:"EnrootPrefix"`
  EnrootPath           string   `yaml:"EnrootPath"`
  ContainerRuntime     string   `yaml:"ContainerRuntime" default:"singularity"` // "singularity" or "enroot"

Command Structure Adaptation

  • Singularity: singularity run/exec [options] [image] [command] [args]
  • Enroot: enroot start [options] [container_name] [command] [args]

Key differences:

  • Enroot requires container creation before execution (enroot create)
  • Enroot uses container names instead of direct image paths -> How to handle images?

Implementation Changes

Abstract Container Runtime (pkg/slurm/Create.go:86-160)

Replace hardcoded Singularity logic with runtime abstraction:

  • Create ContainerCommand interface
  • Implement SingularityCommand and EnrootCommand structs
  • Factory pattern for runtime selection

Mount Handling (pkg/slurm/prepare.go:346-347)

Enroot mount differences:

  • Use --mount instead of --bind
  • Different syntax: --mount type=bind,src=/host/path,dst=/container/path
  • Support additional mount types: tmpfs, devpts

Environment Variables (pkg/slurm/prepare.go:196-234)

Enroot environment handling:

  • use --env-file with different format requirements

Image Management Strategy

Image Import Phase

  • Add pre-job image preparation:
  # Check if container exists
  enroot list | grep -q $CONTAINER_NAME || \
  # Import and create if not exists
  enroot import $IMAGE_URI && \
  enroot create --name $CONTAINER_NAME $IMAGE_SQSH

Container Lifecycle

  • Import: enroot import docker://image:tag
  • Create: enroot create --name pod-uid-container image.sqsh
  • Start: enroot start --rw pod-uid-container command args
  • Cleanup: enroot remove pod-uid-container

Script Generation Modifications

  • Update produceSLURMScript() function in pkg/slurm/prepare.go:522-814:

Pre-execution Setup

  # Container preparation phase
  prepare_enroot_containers() {
      for container in $CONTAINERS; do
          if ! enroot list | grep -q $container; then
              enroot import $IMAGE_URI
              enroot create --name $container $IMAGE_SQSH
          fi
      done
  }

Command Construction

  # Enroot execution
  runCtn container-name enroot start --rw \
      --mount /host/path:/container/path \
      --env KEY=VALUE \
      container-name \
      /command args

Backward Compatibility

  • Default to Singularity runtime if not specified
  • Maintain existing Singularity annotations and behavior
  • Gradual migration path through configuration

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions