thds.mops 3.9.20250902220321__py3-none-any.whl → 3.9.20250903002041__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.

@@ -99,9 +99,6 @@ 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
-
105
102
  This Future will be used to retrieve the result of a shim invocation, and will
106
103
  maintain the lock while it is being retrieved.
107
104
  """
@@ -193,43 +193,34 @@ 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
- release_lock_in_current_process = lock.maintain_to_release(lock_owned)
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
197
199
 
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
- )
212
- )
200
+ future_result_getter = PostShimResultGetter[T](memo_uri, p_unwrap_value_or_error)
201
+
202
+ with _BEFORE_INVOCATION_SEMAPHORE:
203
+ log_invocation(f"Invoking {memo_uri}")
204
+ upload_invocation_and_deps()
213
205
 
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
206
+ # can't hold the semaphore while we block on the shim, though.
207
+ shim = shim_builder(func, args_, kwargs_)
208
+ future_or_shim_result = shim( # ACTUAL INVOCATION (handoff to remote shim) HAPPENS HERE
209
+ (
210
+ memo_uri,
211
+ *metadata.format_invocation_cli_args(
212
+ metadata.InvocationMetadata.new(pipeline_id, invoked_at, lock_owned.writer_id)
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
221
+ )
222
+ else: # it's a synchronous shim - just process the result directly.
223
+ future_result_getter.release_lock = lock.maintain_to_release(lock_owned)
224
+ return futures.resolved(future_result_getter(future_or_shim_result))
234
225
 
235
226
  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.20250902220321
3
+ Version: 3.9.20250903002041
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=4pUlUJiwxKaFYFlQpgJ2sS1jeYlf-HlTLfRzrhvQdW8,4200
96
- thds/mops/pure/runner/local.py,sha256=CFlhqHdd2JpmpdVrKHuugJ7tfeKhwTIKCizuqMMxpQI,11278
95
+ thds/mops/pure/runner/get_results.py,sha256=1K6qf_Vg2YfUPfUuu103WyYsfS3e_ju6W7Z_PV01-pU,4053
96
+ thds/mops/pure/runner/local.py,sha256=0DN1iafxJdnXx0vKZ1jD6dh34aAWK2pgdKUFvK9wDLY,11023
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.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,,
112
+ thds_mops-3.9.20250903002041.dist-info/METADATA,sha256=n-oxzj9sEJsKaJmuYjPSn7Et1iPN8qOF-Xo2qSVVadE,2225
113
+ thds_mops-3.9.20250903002041.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
114
+ thds_mops-3.9.20250903002041.dist-info/entry_points.txt,sha256=qKvCAaB80syXfxVR3xx6x9J0YJdaQWkIbVSw-NwFgMw,322
115
+ thds_mops-3.9.20250903002041.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
116
+ thds_mops-3.9.20250903002041.dist-info/RECORD,,