pythagoras 0.20.9__py3-none-any.whl → 0.20.50__py3-none-any.whl

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.
@@ -132,10 +132,16 @@ class SwarmingPortal(PureCodePortal):
132
132
  @property
133
133
  def max_n_workers(self) -> int:
134
134
  """Get the maximum number of background workers"""
135
- n = self._get_config_setting("max_n_workers")
136
- if n in (None, KEEP_CURRENT):
137
- n = 10
138
- return n
135
+ if not hasattr(self, "_max_n_workers_cache"):
136
+ n = self._get_config_setting("max_n_workers")
137
+ if n in (None, KEEP_CURRENT):
138
+ n = 10
139
+ n = min(n, get_available_cpu_cores())
140
+ n = min(n, get_available_ram_mb() / 500)
141
+ n = int(n)+1
142
+ self._max_n_workers_cache = n
143
+
144
+ return self._max_n_workers_cache
139
145
 
140
146
 
141
147
  def describe(self) -> pd.DataFrame:
@@ -173,6 +179,11 @@ class SwarmingPortal(PureCodePortal):
173
179
  delay = self.entropy_infuser.uniform(min_delay, max_delay)
174
180
  sleep(delay)
175
181
 
182
+
183
+ def _invalidate_cache(self):
184
+ if hasattr(self, "_max_n_workers_cache"):
185
+ del self._max_n_workers_cache
186
+
176
187
  parameterizable.register_parameterizable_class(SwarmingPortal)
177
188
 
178
189
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pythagoras
3
- Version: 0.20.9
3
+ Version: 0.20.50
4
4
  Summary: Planet-scale distributed computing in Python.
5
5
  Keywords: cloud,ML,AI,serverless,distributed,parallel,machine-learning,deep-learning,pythagoras
6
6
  Author: Volodymyr (Vlad) Pavlov
@@ -46,7 +46,7 @@ pythagoras/_080_pure_code_portals/pure_core_classes.py,sha256=73167f9aab4c91f5a0
46
46
  pythagoras/_080_pure_code_portals/pure_decorator.py,sha256=d908ad5eae50e59eeab32f738f784605708e00de71dd53dcbf25efecb83d110d,1168
47
47
  pythagoras/_090_swarming_portals/__init__.py,sha256=7041578f84ffa291f2752c7a2168007b9113f99482f0173f3729171b3bff551a,32
48
48
  pythagoras/_090_swarming_portals/output_suppressor.py,sha256=83e6cc9bcc62a226babb1165912ef5095ea948499ce5136a7516ac8b54522607,626
49
- pythagoras/_090_swarming_portals/swarming_portals.py,sha256=cb5240d0a070571a1b58d66fe3013c5d3123886ce4b266aeb35e95cc28d033fa,11633
49
+ pythagoras/_090_swarming_portals/swarming_portals.py,sha256=0465bf8ff354b48e2c307db3530196228c8c85691514112d629ea17499622d6b,12021
50
50
  pythagoras/_090_swarming_portals/system_utils.py,sha256=d125a0b705b9f8477712179c49441daaf2cd2b0b0d4494b6ac977b2df87b50b5,1370
51
51
  pythagoras/_100_top_level_API/__init__.py,sha256=b392edc2c918da7c2444f14accfd0fac2cd0d5cf6849c64ed2433dfdb58b8b75,64
52
52
  pythagoras/_100_top_level_API/default_local_portal.py,sha256=cfbe20499fed2f038b507b44fb58bb4cb6ea2fbe2fe93a3ab5ad7f3ac655005f,215
@@ -61,6 +61,6 @@ pythagoras/_900_project_stats_collector/__init__.py,sha256=e3b0c44298fc1c149afbf
61
61
  pythagoras/_900_project_stats_collector/project_analyzer.py,sha256=d06e9d7b516cb7424ef777e70abe9d5220e09b0b19476326b8974b4dc3917f89,3506
62
62
  pythagoras/__init__.py,sha256=94303c01a7bde4078fdbd90c0b142807a023fa352c473c3a544a2180b7254ae9,1062
63
63
  pythagoras/core/__init__.py,sha256=a6c3ec6f7d3e69221be505fd344061b774b0eb5c2f18431f39abb9426cb5d0cc,233
64
- pythagoras-0.20.9.dist-info/WHEEL,sha256=1f21b63a61110964f543b6041e8b7da078f20c09d500a32cb79eee5c3d655f54,79
65
- pythagoras-0.20.9.dist-info/METADATA,sha256=f3c36283f7d4eb1f8ab74c2314f1dd80ff883d831c3ea977662284c95f88fbf6,4187
66
- pythagoras-0.20.9.dist-info/RECORD,,
64
+ pythagoras-0.20.50.dist-info/WHEEL,sha256=1f21b63a61110964f543b6041e8b7da078f20c09d500a32cb79eee5c3d655f54,79
65
+ pythagoras-0.20.50.dist-info/METADATA,sha256=38a13a3990ce3ace7c79022526172e4c9c0de186c27e4320db6d876b8f268eb7,4188
66
+ pythagoras-0.20.50.dist-info/RECORD,,