pythagoras 0.20.8__py3-none-any.whl → 0.20.10__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.
- pythagoras/_090_swarming_portals/swarming_portals.py +15 -4
- pythagoras/_100_top_level_API/__init__.py +1 -1
- pythagoras/_100_top_level_API/top_level_API.py +30 -0
- pythagoras/core/__init__.py +2 -1
- {pythagoras-0.20.8.dist-info → pythagoras-0.20.10.dist-info}/METADATA +2 -2
- {pythagoras-0.20.8.dist-info → pythagoras-0.20.10.dist-info}/RECORD +7 -7
- {pythagoras-0.20.8.dist-info → pythagoras-0.20.10.dist-info}/WHEEL +0 -0
|
@@ -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
|
-
|
|
136
|
-
|
|
137
|
-
n
|
|
138
|
-
|
|
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)
|
|
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,2 +1,2 @@
|
|
|
1
1
|
from .top_level_API import *
|
|
2
|
-
from .default_local_portal import
|
|
2
|
+
from .default_local_portal import *
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from urllib.parse import urlparse
|
|
3
|
+
|
|
4
|
+
from .._090_swarming_portals import SwarmingPortal
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _is_valid_url(url: str) -> bool:
|
|
8
|
+
try:
|
|
9
|
+
result = urlparse(url)
|
|
10
|
+
return all([result.scheme, result.netloc])
|
|
11
|
+
except ValueError:
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
def _is_valid_folder_name(path_str):
|
|
15
|
+
if os.path.isdir(path_str):
|
|
16
|
+
return True
|
|
17
|
+
try:
|
|
18
|
+
os.makedirs(path_str, exist_ok=True)
|
|
19
|
+
return True
|
|
20
|
+
except OSError:
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
def get_portal(url_or_foldername:str) -> SwarmingPortal:
|
|
24
|
+
"""Create a return a portal object based on a URL or a directory. """
|
|
25
|
+
if _is_valid_folder_name(url_or_foldername):
|
|
26
|
+
return SwarmingPortal(url_or_foldername)
|
|
27
|
+
elif _is_valid_url(url_or_foldername):
|
|
28
|
+
raise NotImplementedError("URLы not supported yet ... stay turned")
|
|
29
|
+
else:
|
|
30
|
+
raise ValueError(f"Invalid folder name: {url_or_foldername}")
|
pythagoras/core/__init__.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from .._030_data_portals import ready, get
|
|
2
2
|
from .._060_autonomous_code_portals import autonomous
|
|
3
3
|
from .._080_pure_code_portals import pure
|
|
4
|
-
from .._090_swarming_portals import SwarmingPortal
|
|
4
|
+
from .._090_swarming_portals import SwarmingPortal
|
|
5
|
+
from .._100_top_level_API import get_portal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pythagoras
|
|
3
|
-
Version: 0.20.
|
|
3
|
+
Version: 0.20.10
|
|
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
|
|
@@ -61,7 +61,7 @@ data science, machine learning, and AI workflows.
|
|
|
61
61
|
Pythagoras offers:
|
|
62
62
|
|
|
63
63
|
* seamless parallel execution of Python code, locally or
|
|
64
|
-
in diverse distributed environments of any scale;
|
|
64
|
+
in diverse distributed environments of virtually any scale;
|
|
65
65
|
* ubiquitous caching for intermediate program states,
|
|
66
66
|
with intelligent data and code change tracking;
|
|
67
67
|
* simple and budget-friendly orchestration backend.
|
|
@@ -46,11 +46,11 @@ 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=
|
|
49
|
+
pythagoras/_090_swarming_portals/swarming_portals.py,sha256=92f0f95c25775e98bce777e007774b6dcbad27351a41f053c498c47e5519b753,12019
|
|
50
50
|
pythagoras/_090_swarming_portals/system_utils.py,sha256=d125a0b705b9f8477712179c49441daaf2cd2b0b0d4494b6ac977b2df87b50b5,1370
|
|
51
|
-
pythagoras/_100_top_level_API/__init__.py,sha256=
|
|
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
|
|
53
|
-
pythagoras/_100_top_level_API/top_level_API.py,sha256=
|
|
53
|
+
pythagoras/_100_top_level_API/top_level_API.py,sha256=4b63575b86df2fdf28e93c67e8d33411e05bd67cf016d3d297ec9635ebc04081,906
|
|
54
54
|
pythagoras/_800_signatures_and_converters/__init__.py,sha256=d9420254db0c62903fe5419612cef536f219ec319e81b7efc3e783a113aac93b,167
|
|
55
55
|
pythagoras/_800_signatures_and_converters/base_16_32_convertors.py,sha256=66356d2a38e33203201d484cfb543da8b6160832a1965aaaf73e1880a2f4a828,1236
|
|
56
56
|
pythagoras/_800_signatures_and_converters/current_date_gmt_str.py,sha256=2beac61f2ad112cc8175832aeef5abbf715d01a71ea56429bce7d3fe6ad9a8d3,268
|
|
@@ -60,7 +60,7 @@ pythagoras/_800_signatures_and_converters/random_signatures.py,sha256=c174f28c04
|
|
|
60
60
|
pythagoras/_900_project_stats_collector/__init__.py,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
|
|
61
61
|
pythagoras/_900_project_stats_collector/project_analyzer.py,sha256=d06e9d7b516cb7424ef777e70abe9d5220e09b0b19476326b8974b4dc3917f89,3506
|
|
62
62
|
pythagoras/__init__.py,sha256=94303c01a7bde4078fdbd90c0b142807a023fa352c473c3a544a2180b7254ae9,1062
|
|
63
|
-
pythagoras/core/__init__.py,sha256=
|
|
64
|
-
pythagoras-0.20.
|
|
65
|
-
pythagoras-0.20.
|
|
66
|
-
pythagoras-0.20.
|
|
63
|
+
pythagoras/core/__init__.py,sha256=a6c3ec6f7d3e69221be505fd344061b774b0eb5c2f18431f39abb9426cb5d0cc,233
|
|
64
|
+
pythagoras-0.20.10.dist-info/WHEEL,sha256=1f21b63a61110964f543b6041e8b7da078f20c09d500a32cb79eee5c3d655f54,79
|
|
65
|
+
pythagoras-0.20.10.dist-info/METADATA,sha256=855a563ba37a03a947eafd7fed54aa24e0ff4bf7d5839ee0e9efabf459ed42f6,4188
|
|
66
|
+
pythagoras-0.20.10.dist-info/RECORD,,
|
|
File without changes
|