Skip to content

Commit

Permalink
Fix error "Cannot add 'Memory' to 'NoneType'" when running tasks with…
Browse files Browse the repository at this point in the history
… no memory requirement.
  • Loading branch information
riccardomurri committed Aug 30, 2017
1 parent 8da2301 commit 4ba7285
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions gc3libs/backends/shellcmd.py
Expand Up @@ -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):
Expand Down

0 comments on commit 4ba7285

Please sign in to comment.