Skip to content

Commit

Permalink
[batch] Prevent the worker container from being killed on OOM event (h…
Browse files Browse the repository at this point in the history
…ail-is#13977)

This PR fixes that crun has a different way to specify memory
requirements when using cgroups v2 instead of cgroups v1. Should fix
hail-is#13902.
  • Loading branch information
jigold authored Nov 9, 2023
1 parent ebfbc24 commit 3b38d0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions batch/batch/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,9 +1192,10 @@ async def container_config(self):
'resources': {
"devices": [{"allow": False, "access": "rwm"}],
'cpu': {'shares': weight},
'memory': {
'limit': self.memory_in_bytes,
'reservation': self.memory_in_bytes,
'unified': { # https://github.com/opencontainers/runtime-spec/blob/main/config-linux.md
'memory.max': str(int(0.99 * self.memory_in_bytes)),
'memory.high': str(int(0.95 * self.memory_in_bytes)),
'memory.swap.max': '0',
},
# 'blockIO': {'weight': min(weight, 1000)}, FIXME blkio.weight not supported
},
Expand Down

0 comments on commit 3b38d0b

Please sign in to comment.