xoscar 0.4.3__cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.4.4__cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.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 xoscar might be problematic. Click here for more details.

xoscar/backends/core.py CHANGED
@@ -208,6 +208,40 @@ class ActorCallerThreadLocal:
208
208
  _ = [task.cancel() for task in self._clients.values()]
209
209
 
210
210
 
211
+ def _cancel_all_tasks(loop):
212
+ to_cancel = asyncio.all_tasks(loop)
213
+ if not to_cancel:
214
+ return
215
+
216
+ for task in to_cancel:
217
+ task.cancel()
218
+
219
+ loop.run_until_complete(asyncio.gather(*to_cancel, return_exceptions=True))
220
+
221
+ for task in to_cancel:
222
+ if task.cancelled():
223
+ continue
224
+ if task.exception() is not None:
225
+ loop.call_exception_handler(
226
+ {
227
+ "message": "unhandled exception during asyncio.run() shutdown",
228
+ "exception": task.exception(),
229
+ "task": task,
230
+ }
231
+ )
232
+
233
+
234
+ def _safe_run_forever(loop):
235
+ loop.run_forever()
236
+ _cancel_all_tasks(loop)
237
+
238
+
239
+ def _safe_exit_thread(loop, thread):
240
+ # To avoid _enter_buffered_busy: could not acquire lock
241
+ loop.call_soon_threadsafe(loop.stop)
242
+ thread.join()
243
+
244
+
211
245
  class ActorCaller:
212
246
  __slots__ = "_thread_local"
213
247
 
@@ -215,9 +249,11 @@ class ActorCaller:
215
249
  pass
216
250
 
217
251
  _close_loop = asyncio.new_event_loop()
218
- _close_thread = threading.Thread(target=_close_loop.run_forever, daemon=True)
252
+ _close_thread = threading.Thread(
253
+ target=_safe_run_forever, args=(_close_loop,), daemon=True
254
+ )
219
255
  _close_thread.start()
220
- atexit.register(_close_loop.call_soon_threadsafe, _close_loop.stop)
256
+ atexit.register(_safe_exit_thread, _close_loop, _close_thread)
221
257
 
222
258
  def __init__(self):
223
259
  self._thread_local = threading.local()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xoscar
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -1,7 +1,3 @@
1
- xoscar-0.4.3.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
2
- xoscar-0.4.3.dist-info/RECORD,,
3
- xoscar-0.4.3.dist-info/METADATA,sha256=yjX43U8k5yWIL-iE4YJTgASXov3hTrVzs09TiBakmk4,9042
4
- xoscar-0.4.3.dist-info/WHEEL,sha256=Zqf17R98VQuI9JZEwsfDDfsqkexN9tbZpiCgdvPM64U,154
5
1
  xoscar/errors.py,sha256=wBlQOKsXf0Fc4skN39tDie0YZT-VIAuLNRgoDl2pZcA,1241
6
2
  xoscar/nvutils.py,sha256=qmW4mKLU0WB2yCs198ccQOgLL02zB7Fsa-AotO3NOmg,20412
7
3
  xoscar/utils.py,sha256=jUw6OICZUPBbmS1b3GE4vLctJf6fCKXrYtLtBuK-Oqc,16483
@@ -41,7 +37,7 @@ xoscar/metrics/backends/console/__init__.py,sha256=h_JgzSqV5lP6vQ6XX_17kE4IY4BRn
41
37
  xoscar/backends/context.py,sha256=Vr_PibRxYCDQ_gYK7r-BOlw9TXw8VQbFsVTH7K7mHPk,15470
42
38
  xoscar/backends/message.cpython-310-aarch64-linux-gnu.so,sha256=ptMQ5SmlZ5oy_Tl-9ZrtN6EItqzoR_TFY3-iYN6gmRE,3069392
43
39
  xoscar/backends/__init__.py,sha256=VHEBQcUWM5bj027W8EUf9PiJUAP7JoMrRw3Tsvy5ySw,643
44
- xoscar/backends/core.py,sha256=YpFOwjD45Hrdv7zk_SELCC-Ni38aYsWTLigowenwjig,9380
40
+ xoscar/backends/core.py,sha256=3hWgmVYddSy341wsinYOr0yFSlICC9SBr-KQ_KeJRLw,10262
45
41
  xoscar/backends/allocate_strategy.py,sha256=tC1Nbq2tJohahUwd-zoRYHEDX65wyuX8tmeY45uWj_w,4845
46
42
  xoscar/backends/pool.py,sha256=Z7Wdab9dBF3SdQpmzgZhY0d09oTvg5gpFgzYH7vuc4w,59841
47
43
  xoscar/backends/router.py,sha256=mhSvM5KVfV882jricVcpyxAqHEvhS4zL6ivczC6fOTE,7746
@@ -77,3 +73,7 @@ xoscar/serialization/numpy.py,sha256=5Kem87CvpJmzUMp3QHk4WeHU30FoQWTJJP2SwIcaQG0
77
73
  xoscar/serialization/pyfury.py,sha256=sifOnVMYoS82PzZEkzkfxesmMHei23k5UAUUKUyoOYQ,1163
78
74
  xoscar/serialization/core.cpython-310-aarch64-linux-gnu.so,sha256=BcEG4y3c4hy23J2Nf5yTR8Zq5S174PcVHk-Izg83f0Y,3203272
79
75
  xoscar/serialization/cuda.py,sha256=iFUEnN4SiquBIhyieyOrfw3TnKnW-tU_vYgqOxO_DrA,3758
76
+ xoscar-0.4.4.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
77
+ xoscar-0.4.4.dist-info/RECORD,,
78
+ xoscar-0.4.4.dist-info/METADATA,sha256=TuGS9WGtsTsESIq1SuBw9PeqUon1r14dsMrwZbJSQ-k,9042
79
+ xoscar-0.4.4.dist-info/WHEEL,sha256=Zqf17R98VQuI9JZEwsfDDfsqkexN9tbZpiCgdvPM64U,154
File without changes