decentriq_util 0.1.0.dev0__tar.gz → 0.1.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: decentriq_util
3
- Version: 0.1.0.dev0
3
+ Version: 0.1.0.dev2
4
4
  Summary: Utility functions for Python code run in Decentriq workers
5
5
  Author: hafenr
6
6
  Author-email: robin.hafen@gmail.com
@@ -19,17 +19,21 @@ def _get_cgroup_memory() -> int:
19
19
  with open("/sys/fs/cgroup/memory/memory.limit_in_bytes", "r") as f:
20
20
  max_memory_str = f.read().strip()
21
21
 
22
+ max_memory = None
22
23
  if max_memory_str == "max":
23
24
  # Fallback to available virtual memory size
24
25
  max_memory = psutil.virtual_memory().available
25
- else:
26
- max_memory = int(max_memory_str)
26
+ elif max_memory_str is not None:
27
+ try:
28
+ max_memory = int(max_memory_str)
29
+ except ValueError:
30
+ pass
27
31
 
28
32
  if max_memory is not None:
29
33
  return max_memory
30
34
  else:
31
35
  print("Unable to determine available memory from cgroup, assuming 4G")
32
- return 4 * 1024 * 1024
36
+ return 4 * 1024 * 1024 * 1024
33
37
 
34
38
 
35
39
  def _get_num_partitions(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "decentriq_util"
3
- version = "0.1.0-dev0"
3
+ version = "0.1.0-dev2"
4
4
  description = "Utility functions for Python code run in Decentriq workers"
5
5
  authors = ["hafenr <robin.hafen@gmail.com>"]
6
6