thds.mops 3.8.20250715194424__py3-none-any.whl → 3.8.20250718170958__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.
Potentially problematic release.
This version of thds.mops might be problematic. Click here for more details.
- thds/mops/pure/core/deferred_work.py +15 -4
- {thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/METADATA +1 -1
- {thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/RECORD +6 -6
- {thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/WHEEL +0 -0
- {thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/entry_points.txt +0 -0
- {thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/top_level.txt +0 -0
|
@@ -3,15 +3,23 @@
|
|
|
3
3
|
# this could be _any_ kind of work, but is only uploads as of initial abstraction.
|
|
4
4
|
# this basic idea was stolen from `pure.core.source` as a form of optimization for
|
|
5
5
|
# uploading Sources and their hashrefs.
|
|
6
|
+
import concurrent.futures
|
|
6
7
|
import typing as ty
|
|
7
8
|
from contextlib import contextmanager
|
|
8
9
|
|
|
9
10
|
from thds import core
|
|
11
|
+
from thds.core import config, refcount
|
|
10
12
|
from thds.core.stack_context import StackContext
|
|
11
13
|
|
|
12
14
|
_DEFERRED_INVOCATION_WORK: StackContext[
|
|
13
15
|
ty.Optional[ty.Dict[ty.Hashable, ty.Callable[[], ty.Any]]]
|
|
14
16
|
] = StackContext("DEFERRED_INVOCATION_WORK", None)
|
|
17
|
+
_MAX_DEFERRED_WORK_THREADS = config.item("max_deferred_work_threads", default=50, parse=int)
|
|
18
|
+
_DEFERRED_WORK_THREADPOOL = refcount.Resource[concurrent.futures.ThreadPoolExecutor](
|
|
19
|
+
lambda: concurrent.futures.ThreadPoolExecutor(
|
|
20
|
+
max_workers=_MAX_DEFERRED_WORK_THREADS(), **core.concurrency.initcontext()
|
|
21
|
+
)
|
|
22
|
+
)
|
|
15
23
|
logger = core.log.getLogger(__name__)
|
|
16
24
|
|
|
17
25
|
|
|
@@ -74,10 +82,13 @@ def perform_all() -> None:
|
|
|
74
82
|
work_items = _DEFERRED_INVOCATION_WORK()
|
|
75
83
|
if work_items:
|
|
76
84
|
logger.info("Performing %s items of deferred work", len(work_items))
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
with _DEFERRED_WORK_THREADPOOL.get() as thread_pool_executor:
|
|
86
|
+
for key, _ in core.parallel.failfast(
|
|
87
|
+
core.parallel.yield_all(dict(work_items).items(), executor_cm=thread_pool_executor)
|
|
88
|
+
):
|
|
89
|
+
# consume iterator but don't keep results in memory.
|
|
90
|
+
logger.debug("Popping deferred work %s from %s", key, id(work_items))
|
|
91
|
+
work_items.pop(key)
|
|
81
92
|
|
|
82
93
|
logger.debug("Done performing deferred work on %s", id(work_items))
|
|
83
94
|
assert not work_items, f"Some deferred work was not performed! {work_items}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: thds.mops
|
|
3
|
-
Version: 3.8.
|
|
3
|
+
Version: 3.8.20250718170958
|
|
4
4
|
Summary: ML Ops tools for Trilliant Health
|
|
5
5
|
Author-email: Trilliant Health <info@trillianthealth.com>
|
|
6
6
|
Project-URL: Repository, https://github.com/TrilliantHealth/ds-monorepo
|
|
@@ -44,7 +44,7 @@ thds/mops/pure/adls/blob_store.py,sha256=ZWr7CKKcI-jz1sWZq4Jwq6LYkhFNxp-EFnNh83E
|
|
|
44
44
|
thds/mops/pure/adls/output_fqn.py,sha256=qnwdubjVwKShzZ5RruD0_85x86DtPwZNSgwADrdhrTs,748
|
|
45
45
|
thds/mops/pure/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
thds/mops/pure/core/content_addressed.py,sha256=RaCPvtM7bf0NnY5lNR5jPcNn2Moh-bmLtC4zOvdWjCU,1202
|
|
47
|
-
thds/mops/pure/core/deferred_work.py,sha256=
|
|
47
|
+
thds/mops/pure/core/deferred_work.py,sha256=OPnEZGQsBYY2FMSmYzm6c0cLBGgZwAs7UDmnDPUlCMM,4270
|
|
48
48
|
thds/mops/pure/core/file_blob_store.py,sha256=N4m4LLrBZaqTJFR4D_eYl03a-n6yQBRsv0ID1bOS9TA,4298
|
|
49
49
|
thds/mops/pure/core/metadata.py,sha256=xAL2iz0pXrcKapmYnNrqSZ8nH2GVakA167NSpAfwiCI,8276
|
|
50
50
|
thds/mops/pure/core/output_naming.py,sha256=ntufOVNJiVPiUM-Azl9mFpDFhIxiB-V2je9dv9AUQhg,2283
|
|
@@ -104,8 +104,8 @@ thds/mops/pure/tools/summarize/cli.py,sha256=7kDtn24ok8oBO3jFjlMmOK3jnZYpMoE_5Y8
|
|
|
104
104
|
thds/mops/pure/tools/summarize/run_summary.py,sha256=LUtvbankAYbss2NCF_XbNl05jkNgxYz_SLyERJlp4sk,5773
|
|
105
105
|
thds/mops/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
106
106
|
thds/mops/testing/deferred_imports.py,sha256=f0ezCgQAtzTqW1yAOb0OWgsB9ZrlztLB894LtpWDaVw,3780
|
|
107
|
-
thds_mops-3.8.
|
|
108
|
-
thds_mops-3.8.
|
|
109
|
-
thds_mops-3.8.
|
|
110
|
-
thds_mops-3.8.
|
|
111
|
-
thds_mops-3.8.
|
|
107
|
+
thds_mops-3.8.20250718170958.dist-info/METADATA,sha256=WowkWj9XmZ6yxtFiEl8GTzuA8V8ZeYPjDU0q-lhbeZg,2225
|
|
108
|
+
thds_mops-3.8.20250718170958.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
109
|
+
thds_mops-3.8.20250718170958.dist-info/entry_points.txt,sha256=qKvCAaB80syXfxVR3xx6x9J0YJdaQWkIbVSw-NwFgMw,322
|
|
110
|
+
thds_mops-3.8.20250718170958.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
|
|
111
|
+
thds_mops-3.8.20250718170958.dist-info/RECORD,,
|
|
File without changes
|
{thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{thds_mops-3.8.20250715194424.dist-info → thds_mops-3.8.20250718170958.dist-info}/top_level.txt
RENAMED
|
File without changes
|