xoscar 0.4.3__cp310-cp310-macosx_10_9_universal2.whl → 0.4.4__cp310-cp310-macosx_10_9_universal2.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.

Binary file
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()
Binary file
Binary file
@@ -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,7 @@
1
- xoscar-0.4.3.dist-info/RECORD,,
2
- xoscar-0.4.3.dist-info/WHEEL,sha256=Sooupui5EnBW-HNXjQU0OJoerPN0TT-a4xxlvmpUy2g,115
3
- xoscar-0.4.3.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
- xoscar-0.4.3.dist-info/METADATA,sha256=yjX43U8k5yWIL-iE4YJTgASXov3hTrVzs09TiBakmk4,9042
1
+ xoscar-0.4.4.dist-info/RECORD,,
2
+ xoscar-0.4.4.dist-info/WHEEL,sha256=Sooupui5EnBW-HNXjQU0OJoerPN0TT-a4xxlvmpUy2g,115
3
+ xoscar-0.4.4.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
+ xoscar-0.4.4.dist-info/METADATA,sha256=TuGS9WGtsTsESIq1SuBw9PeqUon1r14dsMrwZbJSQ-k,9042
5
5
  xoscar/_utils.pyx,sha256=UR1FtYXAYKIdEWR9HulEpMbSOrkQWi6xGz63d4IQmG0,7059
6
6
  xoscar/backend.py,sha256=is436OPkZfSpQXaoqTRVta5eoye_pp45RFgCstAk2hU,1850
7
7
  xoscar/core.pxd,sha256=4lBq8J0kjcXcsGuvN7Kv4xcL5liHwTTFWlqyK7XAEnw,1280
@@ -10,7 +10,7 @@ xoscar/context.pxd,sha256=qKa0OyDPZtVymftSh447m-RzFZgmz8rGqQBa7qlauvc,725
10
10
  xoscar/batch.py,sha256=DpArS0L3WYJ_HVPG-6hSYEwoAFY1mY2-mlC4Jp5M_Dw,7872
11
11
  xoscar/nvutils.py,sha256=qmW4mKLU0WB2yCs198ccQOgLL02zB7Fsa-AotO3NOmg,20412
12
12
  xoscar/constants.py,sha256=QHHSREw6uWBBjQDCFqlNfTvBZgniJPGy42KSIsR8Fqw,787
13
- xoscar/_utils.cpython-310-darwin.so,sha256=Nb-dFofDaZK86LoTbD3OeVLKKQaG2P580xipzwGVbzc,347840
13
+ xoscar/_utils.cpython-310-darwin.so,sha256=7QKuTJms1YVaYBJY_2wDwLpTBq17-zrWPZkt9QW25_g,347840
14
14
  xoscar/__init__.py,sha256=0zX8kKaio3ZIrlzB79WybcravMJw1OxPWjDspTgJFyQ,1608
15
15
  xoscar/api.py,sha256=3hztPoOxg8A_mlhWyWgVP7FMXG0PATA1TP4Rbaj7A-g,13327
16
16
  xoscar/utils.py,sha256=jUw6OICZUPBbmS1b3GE4vLctJf6fCKXrYtLtBuK-Oqc,16483
@@ -20,8 +20,8 @@ xoscar/context.pyx,sha256=8CdgPnWcE9eOp3N600WgDQ03MCi8P73eUOGcfV7Zksg,10942
20
20
  xoscar/errors.py,sha256=wBlQOKsXf0Fc4skN39tDie0YZT-VIAuLNRgoDl2pZcA,1241
21
21
  xoscar/core.pyx,sha256=Aqc2i8Fetsd5wRAPF4kL0ddnBZn3E2HRNCvup79BbQc,21730
22
22
  xoscar/driver.py,sha256=498fowtJr6b3FE8FIOA_Tc1Vwx88nfZw7p0FxrML0h4,1372
23
- xoscar/context.cpython-310-darwin.so,sha256=j5bz6GMDjxIONKvxDJByYCW7pa5mnslkCjr79EJal40,439520
24
- xoscar/core.cpython-310-darwin.so,sha256=AfgXaKSJoC-877niMqYIitw7cygdz9rfwYMgGzcCgBs,900000
23
+ xoscar/context.cpython-310-darwin.so,sha256=kyuicVymS800U_7h_pLHPbRR9f2EJnabffr4H2f1zmM,439520
24
+ xoscar/core.cpython-310-darwin.so,sha256=C7aHnPmpvcCrB1nG2w4o7RFL37ORbsvfLe59EDf_vFI,900000
25
25
  xoscar/profiling.py,sha256=BC5OF0HzSaXv8V7w-y-B8r5gV5DgxHFoTEIF6jCMioQ,8015
26
26
  xoscar/_utils.pxd,sha256=5KYAL3jfPdejsHnrGGT2s--ZUX5SXznQWpHVSno429k,1157
27
27
  xoscar/metrics/__init__.py,sha256=9Badi7rxYikGm2dQiNCrj9GgMRBxwuR3JaEKcFZmfak,705
@@ -47,12 +47,12 @@ xoscar/serialization/cuda.py,sha256=iFUEnN4SiquBIhyieyOrfw3TnKnW-tU_vYgqOxO_DrA,
47
47
  xoscar/serialization/scipy.py,sha256=yOEi0NB8cqQ6e2UnCZ1w006RsB7T725tIL-DM_hNcsU,2482
48
48
  xoscar/serialization/aio.py,sha256=5DySPgDxU43ec7_5Ct44-Oqt7YNSJBfuf8VdQgQlChA,4731
49
49
  xoscar/serialization/core.pyx,sha256=bjR-zXGm9qersk7kYPzpjpMIxDl_Auur4BCubRfKmfA,29626
50
- xoscar/serialization/core.cpython-310-darwin.so,sha256=jMN6Yqx_K9qhWa3jrmQVzbsEDd2GbBBKy82IyROXSQg,804928
50
+ xoscar/serialization/core.cpython-310-darwin.so,sha256=dbT68shHSlnDLfIYgqu-FY60QhzLh53Odm407oK-WEk,804928
51
51
  xoscar/backends/config.py,sha256=EG26f0GwX_f4dAhwTW77RBjiK9h8R_3JrD-rBF1bAq8,4984
52
52
  xoscar/backends/allocate_strategy.py,sha256=tC1Nbq2tJohahUwd-zoRYHEDX65wyuX8tmeY45uWj_w,4845
53
- xoscar/backends/message.cpython-310-darwin.so,sha256=xAxB2ixtZdjTbkvpLlIQ0cMl13UzhKSnrTCvFrzcwc4,754848
53
+ xoscar/backends/message.cpython-310-darwin.so,sha256=YKfL71LWOlcd4EtGJUZYBpzAiJBJ_XQs9S0Z-tIAxV0,754848
54
54
  xoscar/backends/__init__.py,sha256=VHEBQcUWM5bj027W8EUf9PiJUAP7JoMrRw3Tsvy5ySw,643
55
- xoscar/backends/core.py,sha256=YpFOwjD45Hrdv7zk_SELCC-Ni38aYsWTLigowenwjig,9380
55
+ xoscar/backends/core.py,sha256=3hWgmVYddSy341wsinYOr0yFSlICC9SBr-KQ_KeJRLw,10262
56
56
  xoscar/backends/context.py,sha256=Vr_PibRxYCDQ_gYK7r-BOlw9TXw8VQbFsVTH7K7mHPk,15470
57
57
  xoscar/backends/router.py,sha256=mhSvM5KVfV882jricVcpyxAqHEvhS4zL6ivczC6fOTE,7746
58
58
  xoscar/backends/message.pyx,sha256=uyzilPc_7SqNwGUL4U-Zbfqku8bfZyRW_Lt_S3I_LEU,17930
File without changes