Read-Only Workload Diagnosis & Snapshot Collection (`ops-diagnose-workload`)
1. Preconditions & Inputs
Before starting diagnosis, verify or ask the user for:
- Slurm
JOB_ID: The numeric Slurm job ID (if accepted byslurmctld), or the rejectedsrun/sbatch/salloccommand line. - Namespaces & Login Deployment: Slurm/
WorkloadMixingnamespace (NAMESPACE, defaultslurm), operator namespace (BRIDGE_NAMESPACE, defaultk8s-bridge-system), and login deployment (deploy/slurm-login-slinky, ordeploy/slurm-loginin Kind E2E clusters). - Use references/symptom-decision-table.md as a reference of common known failure patterns (non-exhaustive; always verify against live logs, events, and current source code).
2. Guardrails
- Read-only mode: Do not run
scancel,scontrol delete,kubectl delete,kubectl patch, orhelm upgrade/uninstallduring this workflow. If remediation requires cancelling jobs, deletingJobSetobjects, or removing stale dynamic nodes, report the root cause first and hand off toops-cleanup-stateorinfra-configure-crs. - Do not patch
JobSet.spec.suspend: Kueue's webhook resetsJobSet.spec.suspendunlessWorkload.spec.activeis modified. - Never provision or resize node pools for
Pendingpods without user confirmation: If admittedslurmdpods stayPendingwithInsufficient cpu/memory/gpu, reshape the job to fit single-nodeallocatablecapacity or report to the user.
3. Step-by-Step Procedure
Step 1: Collect a One-Shot Diagnostic Snapshot
Run the non-destructive snapshot script scripts/collect-diagnostic-snapshot.sh:
- Option A (when a Slurm
JOB_IDexists):
```bash
bash skills/ops-diagnose-workload/scripts/collect-diagnostic-snapshot.sh <JOB_ID> slurm k8s-bridge-system
```
- Option B (when diagnosing a pre-submission CLI flag rejection with no
JOB_ID):
```bash
bash skills/ops-diagnose-workload/scripts/collect-diagnostic-snapshot.sh "" slurm k8s-bridge-system
```
Step 2: Trace the 4 Handoff Stages & Check Known Symptoms
Inspect the snapshot output across the 4 handoff stages (query scontrol show job <JOB_ID> before MinJobAge in slurm.conf expires; default Slinky deploys omit slurmdbd/sacct). Check references/symptom-decision-table.md for common known symptoms, and inspect live logs or source code directly if the behavior does not match a listed pattern:
- Pre-submission rejection (no
JOB_ID): Compare client stderr andslurmctldlogs againsthack/cli_filter.lua,hack/job_submit.lua, andslurm.conf/partition policy. - Slurm job state (
scontrol show job <JOB_ID>): CheckJobState,Reason,Priority,Features,Comment, andJobTranslationFailedevents. - Kueue &
JobSetadmission: CheckJobSet/slurm-job-<JOB_ID>(SUSPENDED) andWorkload,LocalQueue, andClusterQueueconditions. - Dynamic
slurmdpods & node registration: WhenSUSPENDED=false, inspect theJobSet, childJob,slurmdpods/logs, andscontrol show nodes/partitions.
Step 3: Inspect `k8s-bridge` Prometheus Metrics (Optional)
Query /metrics via port-forward (kube-apiserver proxy strips Authorization headers and fails with 401; on non-GKE clusters, replace gcloud auth print-access-token with kubectl create token <sa-with-metrics-reader>):
(
timeout 15 kubectl -n k8s-bridge-system port-forward deploy/k8s-bridge-controller-manager 18443:8443 >/dev/null 2>&1 &
PF=$!; trap "kill ${PF} 2>/dev/null || true" EXIT
sleep 2
curl -sfk -H "Authorization: Bearer $(gcloud auth print-access-token)" https://127.0.0.1:18443/metrics | grep "^k8s_bridge_"
)
4. Verification
Confirm that your diagnosis output provides:
- The observed state across Slurm (
JobState,Reason,Comment), Kubernetes (JobSetSUSPENDED/READY, Pod phase), and Kueue (WorkloadAdmittedcondition). - The root cause identified from live logs/events/code (referencing references/symptom-decision-table.md when it matches a known pattern).
- The recommended next skill or command for the user to approve.
5. Handoffs & Related Skills
- To clean up wedged Slurm jobs, orphaned
JobSetobjects, or stale dynamic Slurm nodes: Read skills/ops-cleanup-state/SKILL.md. - To fix partition parity,
dynamicNodeFeature, GPUmappedResources, or user UIDs: Read skills/infra-configure-crs/SKILL.md. - To fix a controller or translator bug identified in logs: Read skills/dev-controller-and-translator/SKILL.md.