Is there any interest in getting mem_limit to work in sudospawner and friends? Would a pull request be accepted?
I guess most people use containers nowadays, but I’m still on good old fashioned VMs (in Azure) and have implemented mem_limit in sudospawner. It is rather crude but seems to work.
Here is a code snippet for sudospawner:
def make_preexec_fn(self):
if not str(self.mem_limit).isnumeric():
return None
from functools import partial
mem_limit = self.mem_limit
self.log.info("memory_limit set to:",str(mem_limit))
def set_resource_limits(mem_limit):
import resource
resource.setrlimit(resource.RLIMIT_RSS, (mem_limit, mem_limit))
return partial(set_resource_limits, mem_limit)
I could send a PR, but it seems like there is no recent activity on sudospawner so I do not want to waste anyones time here.
Best regards
Roy