-
Notifications
You must be signed in to change notification settings - Fork 12
Description
To track timesharing, slots contain an attribute ts_itvs which is a mapping: (user_name or *) -> (job_name or *) -> ProcSet with ProcSet being the resources claimed by a job that is time-shareable with the job job_name or any if * of the user job_user or any if *.
When a job is scheduled, resources are subtracted with the function sub_slot_during_job, that also updates ts_itvs.
The bug is that sub_slot_during_job never updates the value of slot.ts_itvs[job.ts_user][job.ts_name]:
if job.ts_name not in slot.ts_itvs[job.ts_user]:
slot.ts_itvs[job.ts_user][job.ts_name] = copy.copy(job.res_set)Then, if on the same slot, a job is scheduled, and then a bigger job with the same name and type happens to be scheduled on the resources of the smaller job plus some others, the value of slot.ts_itvs[job.ts_user][job.ts_name] will remain the resources of the smaller job instead of expanding.
To fix it, update the map with an union operator even if a record already exists:
if job.ts_name not in slot.ts_itvs[job.ts_user]:
slot.ts_itvs[job.ts_user][job.ts_name] = copy.copy(job.res_set)
else:
slot.ts_itvs[job.ts_user][job.ts_name] |= copy.copy(job.res_set)