Fix for path joining in events

This commit is contained in:
Thomas Roehl 2024-01-05 17:24:06 +01:00
parent bace84bad0
commit 48335dd872

View File

@ -409,13 +409,15 @@ func (m *SlurmJobDetector) NewJobEvent(uid, jobid uint64, timestamp time.Time, o
"type-id": fmt.Sprintf("%d", jobid), "type-id": fmt.Sprintf("%d", jobid),
} }
userdir := fmt.Sprintf("uid_%d", uid) userdir := fmt.Sprintf("uid_%d", uid)
jobdir := fmt.Sprintf("job_%d", uid) jobdir := fmt.Sprintf("job_%d", jobid)
// Fill job JSON with data from cgroup // Fill job JSON with data from cgroup
var md SlurmJobMetadata var md SlurmJobMetadata
job_cpus_file := filepath.Join(cpuset_base, userdir, jobdir, "cpuset.effective_cpus") job_cpus_file := filepath.Join(cpuset_base, userdir, jobdir, "cpuset.effective_cpus")
cclog.ComponentDebug(m.name, job_cpus_file)
job_cpus, err := os.ReadFile(job_cpus_file) job_cpus, err := os.ReadFile(job_cpus_file)
if err == nil { if err == nil {
cclog.ComponentDebug(m.name, string(job_cpus))
md.Cpus = ExpandList(string(job_cpus)) md.Cpus = ExpandList(string(job_cpus))
} }
job_mems_file := filepath.Join(cpuset_base, userdir, jobdir, "cpuset.effective_mems") job_mems_file := filepath.Join(cpuset_base, userdir, jobdir, "cpuset.effective_mems")