Skip to content

feat: add Slurm image lifecycle jobs - #896

Open
nabinchha wants to merge 1 commit into
feat/slurm-executionfrom
codex/867-image-lifecycle
Open

feat: add Slurm image lifecycle jobs#896
nabinchha wants to merge 1 commit into
feat/slurm-executionfrom
codex/867-image-lifecycle

Conversation

@nabinchha

Copy link
Copy Markdown
Contributor

📋 Summary

Add the structured CPU Slurm lifecycle needed to import digest-qualified OCI images and inspect existing SQSH artifacts. The lifecycle stages checksum-bound package resources beneath the selected workspace and submits a thin, isolated batch job through the shared Slurm launcher.

🔗 Related Issue

Part of #867

🔄 Changes

  • Add a versioned image lifecycle plan that binds the authored request, selected profile, attempt-local paths, source OCI digest, and package-owned runtime resources.
  • Render CPU-only OCI import and existing-SQSH inspection jobs with safe Enroot URI normalization, exact checksum verification, restrictive workspace staging, and isolated sbatch submission.
  • Ship a standard-library-only inspector that records factual client Python/package/installer metadata or serving vLLM version/executable metadata inside the target image.
  • Extract the existing batch directive and shell quoting logic into shared launcher primitives without changing generation script output.
  • Add behavioral coverage for both lifecycle modes, contract mutations, source credential rejection, symlink/path safety, exact-byte tamper rejection, and client/serving inspection records.

🔍 Attention Areas

⚠️ Reviewers: Please pay special attention to the following:

  • images/lifecycle.py — CPU Slurm and Enroot command semantics, checksum boundaries, and attempt-local staging.
  • images/records.py — persisted lifecycle invariants and separation of source OCI identity from produced SQSH identity.
  • Atomic publication, per-target lifecycle locking, collision handling, and failure cleanup remain intentionally scoped to 867#3.

🧪 Testing

✅ Checklist

  • Follows commit message conventions
  • Commits are signed off (DCO)
  • Architecture docs: N/A — this internal lifecycle slice does not change a documented public surface

Stage digest-bound OCI import and existing-SQSH inspection plans beneath the selected workspace. Reuse safe batch rendering and isolated Slurm submission while shipping a standalone factual inspector for target images.

Part of #867

Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
@nabinchha
nabinchha requested a review from a team as a code owner August 27, 2026 22:18
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a checksum-bound Slurm lifecycle for importing digest-qualified OCI images and inspecting existing SQSH artifacts.

  • Introduces validated lifecycle plans, attempt-local resource staging, and isolated batch submission.
  • Adds CPU-only Enroot import and inspection scripts with digest verification and restrictive filesystem permissions.
  • Extracts shared Slurm directive and shell-quoting helpers without changing generation-script behavior.
  • Adds behavioral tests for lifecycle preparation, rendering, execution, tamper detection, path safety, and inspection records.

Confidence Score: 5/5

The PR appears safe to merge with no concrete correctness or security failures identified.

The lifecycle plan, staged resources, generated script, Slurm submission boundary, and inspection contracts remain internally consistent across the changed implementation and tests.

Important Files Changed

Filename Overview
packages/data-designer-slurm/src/data_designer/slurm/images/lifecycle.py Implements lifecycle preparation, checksum verification, deterministic batch rendering, Enroot execution, and isolated Slurm submission; no actionable defect was established.
packages/data-designer-slurm/src/data_designer/slurm/images/records.py Adds immutable lifecycle plan records and validates workspace-derived paths, operation/source consistency, and package-owned runtime artifacts.
packages/data-designer-slurm/src/data_designer/slurm/images/resources/inspect_image.py Adds a standard-library-only image inspector whose client and serving requirements align with the existing inspection contract.
packages/data-designer-slurm/src/data_designer/slurm/launcher/batch.py Extracts validated batch-directive rendering and shell quoting into shared launcher primitives.
packages/data-designer-slurm/src/data_designer/slurm/launcher/renderer.py Adopts the shared rendering primitives while preserving the existing generation-script structure.
packages/data-designer-slurm/tests/images/test_lifecycle.py Covers lifecycle modes, URI normalization, contract mutations, staging permissions, tamper rejection, and inspection-record compatibility.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Lifecycle
    participant Workspace
    participant Slurm
    participant Enroot
    participant Inspector
    Caller->>Lifecycle: prepare(request, profile, lifecycle_id)
    Lifecycle->>Workspace: Stage inspector, Enroot rc, plan, and batch script
    Caller->>Lifecycle: submit(prepared job)
    Lifecycle->>Workspace: Verify plan and script digests
    Lifecycle->>Slurm: "sbatch --export=NIL"
    Slurm->>Enroot: Import OCI when required
    Slurm->>Enroot: Create and start container
    Enroot->>Inspector: Inspect client or serving image
    Inspector->>Workspace: Atomically write inspection.json
Loading

Reviews (1): Last reviewed commit: "feat: add Slurm image lifecycle jobs" | Re-trigger Greptile

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