diff --git a/gc3libs/backends/shellcmd.py b/gc3libs/backends/shellcmd.py index f160037a..4a7d4f1b 100755 --- a/gc3libs/backends/shellcmd.py +++ b/gc3libs/backends/shellcmd.py @@ -882,9 +882,19 @@ def count_used_memory(self): Similar caveats as in `ShellcmdLrms.count_running_tasks`:meth: apply here. """ - return sum((info['requested_memory'] - for info in self._job_infos.values() - if not info['terminated']), 0*MB) + return sum( + # FIXME: if `requested_memory==None` then just do not + # account a task's memory usage. This is of course + # incorrect and leads to situations where a single task + # can wreak havoc on an entire compute node, but is + # consistent with what we do during scheduling / + # requirements check. (OTOH, it's *not* consistent with + # what other backends do: SLURM, for example, takes the + # pessimistic stance that a job with no memory + # requirements is using (DefMemPerCPU * NumCPUs) + ((info['requested_memory'] or 0*MB) + for info in self._job_infos.values() + if not info['terminated']), 0*MB) def _get_persisted_job_info(self):