thds.mops 3.9.20250902211636__py3-none-any.whl → 3.9.20250902220321__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/runner/get_results.py +3 -0
- thds/mops/pure/runner/local.py +36 -27
- {thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/METADATA +1 -1
- {thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/RECORD +7 -7
- {thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/WHEEL +0 -0
- {thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/entry_points.txt +0 -0
- {thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/top_level.txt +0 -0
|
@@ -99,6 +99,9 @@ def lock_maintaining_future(
|
|
|
99
99
|
) -> concurrent.futures.Future[futures.R1]:
|
|
100
100
|
"""Create a Future that will be used to retrieve the result of a shim invocation.
|
|
101
101
|
|
|
102
|
+
Most commonly, this will be partially applied and only lazily invoked
|
|
103
|
+
when the user calls `.result()` or some other method on the Future.
|
|
104
|
+
|
|
102
105
|
This Future will be used to retrieve the result of a shim invocation, and will
|
|
103
106
|
maintain the lock while it is being retrieved.
|
|
104
107
|
"""
|
thds/mops/pure/runner/local.py
CHANGED
|
@@ -193,34 +193,43 @@ def invoke_via_shim_or_return_memoized( # noqa: C901
|
|
|
193
193
|
# If something about our invocation fails,
|
|
194
194
|
# we fail just as we would have previously, without any attempt to go
|
|
195
195
|
# 'back' to waiting for someone else to compute the result.
|
|
196
|
-
lock.maintain_to_release(lock_owned)
|
|
197
|
-
# we don't actually need the release_lock here, because it will get
|
|
198
|
-
# 'recreated' in the PostShimResultGetter below, which is also where it gets called
|
|
196
|
+
release_lock_in_current_process = lock.maintain_to_release(lock_owned)
|
|
199
197
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
)
|
|
214
|
-
)
|
|
215
|
-
)
|
|
216
|
-
if hasattr(future_or_shim_result, "add_done_callback"):
|
|
217
|
-
# if the shim returns a Future, we wrap it.
|
|
218
|
-
logger.debug("Shim returned a Future; wrapping it for post-shim result retrieval.")
|
|
219
|
-
return futures.make_lazy(lock_maintaining_future)(
|
|
220
|
-
lock_owned, future_result_getter, future_or_shim_result
|
|
198
|
+
try:
|
|
199
|
+
with _BEFORE_INVOCATION_SEMAPHORE:
|
|
200
|
+
log_invocation(f"Invoking {memo_uri}")
|
|
201
|
+
upload_invocation_and_deps()
|
|
202
|
+
|
|
203
|
+
# can't hold the semaphore while we block on the shim, though.
|
|
204
|
+
shim = shim_builder(func, args_, kwargs_)
|
|
205
|
+
future_or_shim_result = shim( # ACTUAL INVOCATION (handoff to remote shim) HAPPENS HERE
|
|
206
|
+
(
|
|
207
|
+
memo_uri,
|
|
208
|
+
*metadata.format_invocation_cli_args(
|
|
209
|
+
metadata.InvocationMetadata.new(pipeline_id, invoked_at, lock_owned.writer_id)
|
|
210
|
+
),
|
|
211
|
+
)
|
|
221
212
|
)
|
|
222
|
-
|
|
223
|
-
future_result_getter
|
|
224
|
-
|
|
213
|
+
|
|
214
|
+
future_result_getter = PostShimResultGetter[T](memo_uri, p_unwrap_value_or_error)
|
|
215
|
+
if hasattr(future_or_shim_result, "add_done_callback"):
|
|
216
|
+
# if the shim returns a Future, we wrap it.
|
|
217
|
+
logger.debug("Shim returned a Future; wrapping it for post-shim result retrieval.")
|
|
218
|
+
return futures.make_lazy(lock_maintaining_future)(
|
|
219
|
+
lock_owned, future_result_getter, future_or_shim_result
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
else: # it's a synchronous shim - just process the result directly.
|
|
223
|
+
future_result_getter.release_lock = release_lock_in_current_process
|
|
224
|
+
return futures.resolved(future_result_getter(future_or_shim_result))
|
|
225
|
+
|
|
226
|
+
except Exception:
|
|
227
|
+
try:
|
|
228
|
+
release_lock_in_current_process()
|
|
229
|
+
except Exception:
|
|
230
|
+
logger.exception(
|
|
231
|
+
f"Failed to release lock {lock_owned.writer_id} after failed invocation."
|
|
232
|
+
)
|
|
233
|
+
raise
|
|
225
234
|
|
|
226
235
|
return create_invocation_and_result_future
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: thds.mops
|
|
3
|
-
Version: 3.9.
|
|
3
|
+
Version: 3.9.20250902220321
|
|
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
|
|
@@ -92,8 +92,8 @@ thds/mops/pure/pickling/pickles.py,sha256=CSlnjLssE0Ad8YzqyaKqWCSNyW5LiMFKiXO6hW
|
|
|
92
92
|
thds/mops/pure/pickling/remote.py,sha256=7JXZRGnLI5y5dqElIDrhIlaRv6Q_zQ_78aqNhO7O4KY,8478
|
|
93
93
|
thds/mops/pure/pickling/sha256_b64.py,sha256=HL0cPixHPZYuZDVDBscxsnI-3a2amWEfw-LseOX-PyY,2916
|
|
94
94
|
thds/mops/pure/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
95
|
-
thds/mops/pure/runner/get_results.py,sha256=
|
|
96
|
-
thds/mops/pure/runner/local.py,sha256=
|
|
95
|
+
thds/mops/pure/runner/get_results.py,sha256=4pUlUJiwxKaFYFlQpgJ2sS1jeYlf-HlTLfRzrhvQdW8,4200
|
|
96
|
+
thds/mops/pure/runner/local.py,sha256=CFlhqHdd2JpmpdVrKHuugJ7tfeKhwTIKCizuqMMxpQI,11278
|
|
97
97
|
thds/mops/pure/runner/shim_builder.py,sha256=obs2-NipAB8w0NR8o90UQX_bmHYS69c-raL2JPw8yM4,821
|
|
98
98
|
thds/mops/pure/runner/simple_shims.py,sha256=r-kLmpSCwzjfzF-Ku43YKvrHMLpZR5jDmweo4Vk07O4,1069
|
|
99
99
|
thds/mops/pure/runner/strings.py,sha256=PYAYMxZ2ehgahKIBXJilENNE6OrdNkueNBel8LPsoh8,26
|
|
@@ -109,8 +109,8 @@ thds/mops/pure/tools/summarize/cli.py,sha256=7kDtn24ok8oBO3jFjlMmOK3jnZYpMoE_5Y8
|
|
|
109
109
|
thds/mops/pure/tools/summarize/run_summary.py,sha256=w45qiQr7elrHDiK9Hgs85gtU3gwLuXa447ih1Y23BBY,5776
|
|
110
110
|
thds/mops/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
111
111
|
thds/mops/testing/deferred_imports.py,sha256=f0ezCgQAtzTqW1yAOb0OWgsB9ZrlztLB894LtpWDaVw,3780
|
|
112
|
-
thds_mops-3.9.
|
|
113
|
-
thds_mops-3.9.
|
|
114
|
-
thds_mops-3.9.
|
|
115
|
-
thds_mops-3.9.
|
|
116
|
-
thds_mops-3.9.
|
|
112
|
+
thds_mops-3.9.20250902220321.dist-info/METADATA,sha256=9ikxjI9losOmD74Vmv62sZfISIloyiRycqkfMWBjEQw,2225
|
|
113
|
+
thds_mops-3.9.20250902220321.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
114
|
+
thds_mops-3.9.20250902220321.dist-info/entry_points.txt,sha256=qKvCAaB80syXfxVR3xx6x9J0YJdaQWkIbVSw-NwFgMw,322
|
|
115
|
+
thds_mops-3.9.20250902220321.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
|
|
116
|
+
thds_mops-3.9.20250902220321.dist-info/RECORD,,
|
|
File without changes
|
{thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{thds_mops-3.9.20250902211636.dist-info → thds_mops-3.9.20250902220321.dist-info}/top_level.txt
RENAMED
|
File without changes
|