python-fedci 0.2.0__py3-none-any.whl → 0.2.1__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.
fedci/server.py CHANGED
@@ -202,17 +202,9 @@ class Server:
202
202
 
203
203
  all_tests = get_all_possible_tests(set(self.schema.keys()), max_cond_size)
204
204
 
205
- if progress_bar:
206
- from tqdm import tqdm
207
- all_tests = tqdm(
208
- all_tests,
209
- position=_progress_bar_position,
210
- leave=_progress_bar_position == 0,
211
- )
212
-
213
205
  if workers > 1:
214
- # Parallelise at the test level: each test runs in its own thread.
215
- # NetworkClient sockets are thread-local so concurrent calls are safe.
206
+ from concurrent.futures import as_completed
207
+
216
208
  lock = threading.Lock()
217
209
 
218
210
  def _run_test(args):
@@ -227,8 +219,26 @@ class Server:
227
219
  return (x, y, frozenset(s)), result
228
220
 
229
221
  with ThreadPoolExecutor(max_workers=workers) as pool:
230
- results = dict(pool.map(_run_test, all_tests))
222
+ futures = [pool.submit(_run_test, args) for args in all_tests]
223
+ if progress_bar:
224
+ from tqdm import tqdm
225
+ completed = tqdm(
226
+ as_completed(futures),
227
+ total=len(futures),
228
+ position=_progress_bar_position,
229
+ leave=_progress_bar_position == 0,
230
+ )
231
+ else:
232
+ completed = as_completed(futures)
233
+ results = dict(f.result() for f in completed)
231
234
  else:
235
+ if progress_bar:
236
+ from tqdm import tqdm
237
+ all_tests = tqdm(
238
+ all_tests,
239
+ position=_progress_bar_position,
240
+ leave=_progress_bar_position == 0,
241
+ )
232
242
  results = {}
233
243
  for x, y, s in all_tests:
234
244
  if on_test_start is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fedci
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A small package for federated independence tests
5
5
  Author-email: Maximilian Hahn <max.hahn@gmx.de>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -6,11 +6,11 @@ fedci/masking.py,sha256=0sNSl0yLa0gJq8wNUkzeDnpDD_8KxIC7IWBAdixdfsM,3634
6
6
  fedci/modeling.py,sha256=BGfaJvqejGn2cFlz2Y9iOVNxmRKYjgYhCYalrqiZKbE,12006
7
7
  fedci/network.py,sha256=mATDNaFt6dL8-6sZUQiUXg4vNO1sf7UaLpjFfSxGrHQ,6785
8
8
  fedci/results.py,sha256=8vqiC-IjwL-YyNuY1u03ku93ATQIp1p_RsrOGI_AlJ4,6041
9
- fedci/server.py,sha256=2tWc_eXa-rlDgcyETWwClpD6Q_Co1OWJmLIgaDwCLDQ,10768
9
+ fedci/server.py,sha256=wM1nL5odTRlBhAxoMCN7EIlB-C89wO0dVfXzVBJEGBs,11186
10
10
  fedci/testing.py,sha256=AxdO12iaPQsUJ4vv-fjpr8gUwf7bWZ_1xsAO7Nlhq4M,5052
11
11
  fedci/utils.py,sha256=JfaP_tGIg2TEDRjALtm2eFVJ4eBpo9eYiTZXjZjPl1U,2702
12
- python_fedci-0.2.0.dist-info/licenses/LICENSE,sha256=Iwyf1NjIYj-xnIJJNdukONRRDPZskVflWZrI-AWv7sg,34576
13
- python_fedci-0.2.0.dist-info/METADATA,sha256=-iJ0tyIFlV-PE4BhGAmZl3QLBNvpmSyAt1aOT0IDA14,10550
14
- python_fedci-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
15
- python_fedci-0.2.0.dist-info/top_level.txt,sha256=cqbR8aI0m4KvYOXgv94Lg1XmKxIBBAFKyDmJD1zefDQ,6
16
- python_fedci-0.2.0.dist-info/RECORD,,
12
+ python_fedci-0.2.1.dist-info/licenses/LICENSE,sha256=Iwyf1NjIYj-xnIJJNdukONRRDPZskVflWZrI-AWv7sg,34576
13
+ python_fedci-0.2.1.dist-info/METADATA,sha256=L3qvuasOr9W7JLiCIKGdjps6UFft8gt8ZMwf5SuoCfw,10550
14
+ python_fedci-0.2.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
15
+ python_fedci-0.2.1.dist-info/top_level.txt,sha256=cqbR8aI0m4KvYOXgv94Lg1XmKxIBBAFKyDmJD1zefDQ,6
16
+ python_fedci-0.2.1.dist-info/RECORD,,