SORMAS-Docker icon indicating copy to clipboard operation
SORMAS-Docker copied to clipboard

ValueError: invalid literal for int() with base 10: '1-4'

Open niclasboy opened this issue 3 years ago • 1 comments

When running Docker inside a LXC with 4 from 6 cores selected, you cant run the docker, because cat /sys/fs/cgroup/cpuset/cpuset.cpus returns 1-4 or 1,3-5. So cpu = int(cpus.replace("0-","")) + 1 in https://github.com/hzi-braunschweig/SORMAS-Docker/blob/b11ed03c1925750dc3e6334d505a9e54cdec97cc/postgres/alter_system.py#L81 cant be executed and following error will be thrown: ValueError: invalid literal for int() with base 10: '1-4'. Is there an workaround without increasing the core count to 6? What would happen if you only have a single core cpu? When the core count is set to 6 the container starts up without problems.

niclasboy avatar Mar 12 '21 00:03 niclasboy

I think multiprocessing.cpu_count() can solve this problem.

niclasboy avatar Mar 12 '21 00:03 niclasboy