xoscar 0.7.0rc1__cp311-cp311-win_amd64.whl → 0.7.1__cp311-cp311-win_amd64.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.
xoscar/__init__.py CHANGED
@@ -33,6 +33,7 @@ from .api import (
33
33
  wait_actor_pool_recovered,
34
34
  get_pool_config,
35
35
  generator,
36
+ wait_for,
36
37
  )
37
38
  from .backends import allocate_strategy
38
39
  from .backends.pool import MainActorPoolType
Binary file
xoscar/api.py CHANGED
@@ -26,6 +26,7 @@ from numbers import Number
26
26
  from typing import (
27
27
  TYPE_CHECKING,
28
28
  Any,
29
+ Awaitable,
29
30
  Dict,
30
31
  Generic,
31
32
  List,
@@ -181,6 +182,39 @@ async def create_actor_pool(
181
182
  )
182
183
 
183
184
 
185
+ async def wait_for(fut: Awaitable[Any], timeout: int | float | None = None) -> Any:
186
+ # asyncio.wait_for() on Xoscar actor call cannot work as expected,
187
+ # because when time out, the future will be cancelled, but an actor call will catch this error,
188
+ # and send a CancelMessage to the dest pool, if the CancelMessage cannot be processed correctly(e.g. the dest pool hangs),
189
+ # the time out will never happen. Thus this PR added a new API so that no matter the CancelMessage delivered or not,
190
+ # the timeout will happen as expected.
191
+ loop = asyncio.get_running_loop()
192
+ new_fut = loop.create_future()
193
+ task = asyncio.ensure_future(fut)
194
+
195
+ def on_done(f: asyncio.Future):
196
+ if new_fut.done():
197
+ return
198
+ if f.cancelled():
199
+ new_fut.cancel()
200
+ elif f.exception():
201
+ new_fut.set_exception(f.exception()) # type: ignore
202
+ else:
203
+ new_fut.set_result(f.result())
204
+
205
+ task.add_done_callback(on_done)
206
+
207
+ try:
208
+ return await asyncio.wait_for(new_fut, timeout)
209
+ except asyncio.TimeoutError:
210
+ if not task.done():
211
+ try:
212
+ task.cancel() # Try to cancel without waiting
213
+ except Exception:
214
+ logger.warning("Failed to cancel task", exc_info=True)
215
+ raise
216
+
217
+
184
218
  def buffer_ref(address: str, buffer: Any) -> BufferRef:
185
219
  """
186
220
  Init buffer ref according address and buffer.
Binary file
xoscar/collective/uv.dll CHANGED
Binary file
Binary file
Binary file
xoscar/utils.py CHANGED
@@ -89,7 +89,7 @@ def wrap_exception(
89
89
  ) -> BaseException:
90
90
  """Generate an exception wraps the cause exception."""
91
91
 
92
- def __init__(self):
92
+ def __init__(self, *args, **kwargs):
93
93
  pass
94
94
 
95
95
  def __getattr__(self, item):
xoscar/virtualenv/core.py CHANGED
@@ -40,7 +40,7 @@ class VirtualEnvManager(ABC):
40
40
  pass
41
41
 
42
42
  @abstractmethod
43
- def get_python_path(self) -> str:
43
+ def get_python_path(self) -> str | None:
44
44
  pass
45
45
 
46
46
  @abstractmethod
xoscar/virtualenv/uv.py CHANGED
@@ -51,12 +51,19 @@ class UVVirtualEnvManager(VirtualEnvManager):
51
51
  # Handle known pip-related kwargs
52
52
  if "index_url" in kwargs and kwargs["index_url"]:
53
53
  cmd += ["-i", kwargs["index_url"]]
54
- if "extra_index_url" in kwargs and kwargs["extra_index_url"]:
55
- cmd += ["--extra-index-url", kwargs["extra_index_url"]]
56
- if "find_links" in kwargs and kwargs["find_links"]:
57
- cmd += ["-f", kwargs["find_links"]]
58
- if "trusted_host" in kwargs and kwargs["trusted_host"]:
59
- cmd += ["--trusted-host", kwargs["trusted_host"]]
54
+ param_and_option = [
55
+ ("extra_index_url", "--extra-index-url"),
56
+ ("find_links", "-f"),
57
+ ("trusted_host", "--trusted-host"),
58
+ ]
59
+ for param, option in param_and_option:
60
+ if param in kwargs and kwargs[param]:
61
+ param_value = kwargs[param]
62
+ if isinstance(param_value, list):
63
+ for it in param_value:
64
+ cmd += [option, it]
65
+ else:
66
+ cmd += [option, param_value]
60
67
 
61
68
  self._install_process = process = subprocess.Popen(cmd)
62
69
  returncode = process.wait()
@@ -71,8 +78,10 @@ class UVVirtualEnvManager(VirtualEnvManager):
71
78
  self._install_process.terminate()
72
79
  self._install_process.wait()
73
80
 
74
- def get_python_path(self) -> str:
75
- return str(self.env_path.joinpath("bin/python"))
81
+ def get_python_path(self) -> str | None:
82
+ if self.env_path.exists():
83
+ return str(self.env_path.joinpath("bin/python"))
84
+ return None
76
85
 
77
86
  def get_lib_path(self) -> str:
78
87
  return sysconfig.get_path("purelib", vars={"base": str(self.env_path)})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xoscar
3
- Version: 0.7.0rc1
3
+ Version: 0.7.1
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -1,16 +1,16 @@
1
- xoscar/__init__.py,sha256=dlwtB7dnDp5WME6CZVQY7d9lk1yJ9s___H5UxjGlAd4,1668
2
- xoscar/_utils.cp311-win_amd64.pyd,sha256=RZn6Rq_k7uaJVIh5ozncS2kW0GM6dyREyfi_CWOpwZc,113664
1
+ xoscar/__init__.py,sha256=lzCXUmkuIjcjkiNQFekysdJR_ZhlbjcfR5ka1bZZNQg,1683
2
+ xoscar/_utils.cp311-win_amd64.pyd,sha256=EQBVRr7zj_YPnhSJQ5fP-tFcRaSaJI46nSok5ogzW9w,106496
3
3
  xoscar/_utils.pxd,sha256=rlNbTg5lhXA-jCOLksqF4jhUlNn0xw2jx1HxdLa34pc,1193
4
4
  xoscar/_utils.pyx,sha256=TWScgqmJGYzjbWBOShBLkq07ldfYEQ5fw6V4OytX_IA,7626
5
5
  xoscar/_version.py,sha256=bsfCVAo_o9LkiP3AjPsP4SRRqhjuS0t4D1WGJPzbdls,24412
6
- xoscar/api.py,sha256=B5oXv4vgMxMteh1YNaBmNFDrUFmYa_dCdzfaWwwZnCo,13820
6
+ xoscar/api.py,sha256=QQDHn-_FiDExmOxEk8BUnq4Qrx13VX3shSlEEqPQJo0,15175
7
7
  xoscar/backend.py,sha256=8G5JwjoOT6Q2slb11eXNApxgcmvNQUCdQzkoIMDwLcQ,1917
8
8
  xoscar/batch.py,sha256=Jk5BSpvMFAV9DrRy0a9tgPvIo_dt8cbJReZBL0cnOPc,8128
9
9
  xoscar/constants.py,sha256=GJ1KEOxwnqksc9K_GH42TSWpQECeC6ti3KJmE3PUcTw,810
10
- xoscar/context.cp311-win_amd64.pyd,sha256=z4FxtyfyH8w5vw9u6jVsZzFXPIqvF1UyyFzfMQLrStA,155648
10
+ xoscar/context.cp311-win_amd64.pyd,sha256=uxuulCQ8nX5b1e9BVZ2Habpe0pJcrZouKuKknLPTiaw,152576
11
11
  xoscar/context.pxd,sha256=6n6IAbmArSRq8EjcsbS6npW8xP1jI0qOoS1fF0oyj-o,746
12
12
  xoscar/context.pyx,sha256=FOJVerGOvxe2USryXEQA0rpaFX_ScxISH6QWKUcahY8,11310
13
- xoscar/core.cp311-win_amd64.pyd,sha256=EW3MixCUFWs82Ed85Dxi6Rh5BTJP3EOPwZMxMPghyzI,327680
13
+ xoscar/core.cp311-win_amd64.pyd,sha256=oazyJdzba8_NxKvWIn_c934gGqre0BznPZd4ckBhSiw,302592
14
14
  xoscar/core.pxd,sha256=9IZP7dYGfnF1I-obIls8R8b6forxDOPbiM3v5nVslLk,1368
15
15
  xoscar/core.pyx,sha256=U6jCZN74MQHi7HkQRaVGm_w5q-FMsw0nnE3aU6533_Q,22756
16
16
  xoscar/debug.py,sha256=hrmxIH6zvTKasQo6PUUgXu5mgEsR0g87Fvpw7CoHipg,5257
@@ -19,7 +19,7 @@ xoscar/errors.py,sha256=hfIAlYuSVfB3dAQYr8hTLAMmfy5en6Y8mihdtw1gTEE,1304
19
19
  xoscar/libcpp.pxd,sha256=XGy887HXdRsvF47s-A7PvHX6Gaf15d_azRscWJY0Hc8,1178
20
20
  xoscar/nvutils.py,sha256=z6RCVs0sgKFm55TTgAYG3qy5f_AKJzjcH2kcRB-wTJQ,21129
21
21
  xoscar/profiling.py,sha256=LUqkj6sSxaFj0ltS7Yk2kFsh5ieHY417xypTYHwQOb4,8275
22
- xoscar/utils.py,sha256=wiDLdRUi4hgdrKVehzDMVRpym8oEcbdpo900o3BpoMM,17000
22
+ xoscar/utils.py,sha256=lYZWgnyTLL3vowzJ37ycPPPeaxQPhunGsYadRc0sAaM,17017
23
23
  xoscar/aio/__init__.py,sha256=ZLJlVJJH5EhItKD6tLTBri-4FV4kT1O2qdIfBC-df98,691
24
24
  xoscar/aio/base.py,sha256=ytknTCjTjNQbTM7l7QGXqPYYUkD7qq-zVBGVZ34L1Tc,2335
25
25
  xoscar/aio/file.py,sha256=x1wrvDgtTFMv-6gjSPpBU26jAO5uEAlXGGnFtx7uevQ,1545
@@ -30,7 +30,7 @@ xoscar/backends/allocate_strategy.py,sha256=DzvTlixwzTANURI2mDLHm3vcaugSPDxU6UQZ
30
30
  xoscar/backends/config.py,sha256=86j0g_Xrl8ENPzBWi296yWg9QEcljvdKK-yJbfYTvQ0,5532
31
31
  xoscar/backends/context.py,sha256=qWwksx8JxYcKR-LQA3PvXh4ReuuTTEyDaLbjpxGXcTA,16766
32
32
  xoscar/backends/core.py,sha256=fbekAxys_t1Dv7if-1R6uVvC_yAxNkXLeQ1V1ZSAfC0,11161
33
- xoscar/backends/message.cp311-win_amd64.pyd,sha256=JNuf0qd_mfTh0i2BLrCksNTycYN8ySsVzYQn4OtfoTg,281600
33
+ xoscar/backends/message.cp311-win_amd64.pyd,sha256=1VmU5K3adiDba8-3-IG_FtuOdFj7aDZf7mr_wSuqb0M,246784
34
34
  xoscar/backends/message.pyx,sha256=lBEjMJv4VyxmeO9lHXJJazOajbFnTLak4PSBcLoPZvU,20331
35
35
  xoscar/backends/pool.py,sha256=bS_m8XBkfQQsCOaLEzM6HkV5e78dPPp1bCH6yjvPEss,62153
36
36
  xoscar/backends/router.py,sha256=EjfNpQUrhFU15eYe1kRPueziHgI2gfDViUzm7ruvXDE,10817
@@ -57,8 +57,8 @@ xoscar/collective/common.py,sha256=9c7xq3IOUvfA0I9GnpalUqXZOzmF6IEILv4zL64BYVE,3
57
57
  xoscar/collective/core.py,sha256=191aPxbUgWpjzrqyozndImDAQhZFmqoQdBkHFLDfXN0,24239
58
58
  xoscar/collective/process_group.py,sha256=kTPbrLMJSGhqbiWvTIiz-X3W0rZWd_CFn_zUIlXbOlM,23286
59
59
  xoscar/collective/utils.py,sha256=p3WEVtXvnVhkuO5mRgQBhBRFr1dKHcDKMjrbMyuiyfg,1219
60
- xoscar/collective/uv.dll,sha256=Ub3SLLnKWOcLl9E3w3ZXa18hNz2xmTKLz-Cdj3_IMF0,620544
61
- xoscar/collective/xoscar_pygloo.cp311-win_amd64.pyd,sha256=WPROh5U3jIRr11kqfHo5SVuj-N6zmPv2lQf1EnfOkyc,831488
60
+ xoscar/collective/uv.dll,sha256=jDAnx_UyjG2HnAZ_TicDInXMPeVqbdy4AuVH9aKGUws,620544
61
+ xoscar/collective/xoscar_pygloo.cp311-win_amd64.pyd,sha256=f_iMxs7gHR9M6CPBxBDDnLfjw6iw4QvYj2RaNDdiMcw,831488
62
62
  xoscar/metrics/__init__.py,sha256=RjXuuYw4I2YYgD8UY2Z5yCZk0Z56xMJ1n40O80Dtxf8,726
63
63
  xoscar/metrics/api.py,sha256=dtJ4QrIqQNXhJedeqOPs4TXKgrRGZFFN50xAd9SCfec,9144
64
64
  xoscar/metrics/backends/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS3Ijp1YgyynoUFLeuU,594
@@ -69,7 +69,7 @@ xoscar/metrics/backends/prometheus/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS
69
69
  xoscar/metrics/backends/prometheus/prometheus_metric.py,sha256=65hb8O3tmsEJ7jgOrIwl_suj9SE5Tmqcfjuk0urkLvE,2120
70
70
  xoscar/serialization/__init__.py,sha256=tS8C49yrW_geWNEsbgW3phK1q4YN1ojI6CN-vroIFYM,876
71
71
  xoscar/serialization/aio.py,sha256=7YLXgkWpQ3ANy-TZ1qO8Mt4_J3cZFhFh2FEgUgxMT60,4873
72
- xoscar/serialization/core.cp311-win_amd64.pyd,sha256=_fF9v9HJOcVYkIw2VDITQAE-NSEmDhiMXltyVHMntAU,294400
72
+ xoscar/serialization/core.cp311-win_amd64.pyd,sha256=KT3qoPxrOwAodk8rEAKdufsZWP0fDDLAQ7biRHCAYQY,267264
73
73
  xoscar/serialization/core.pxd,sha256=X-47bqBM2Kzw5SkLqICdKD0gU6CpmLsBxC3kfW--wVk,1013
74
74
  xoscar/serialization/core.pyx,sha256=ZKexLRnRwZXXn2045kR7xfM_szcoPNrDuouQCWtpFp8,30570
75
75
  xoscar/serialization/cuda.py,sha256=Fj4Cpr_YmkGceUCo0mQn8fRvmHP_5WcLdRx6epZ3RC0,3869
@@ -79,9 +79,9 @@ xoscar/serialization/numpy.py,sha256=C6WVx-Sdl2OHBAvVY34DFjAKXlekMbpc2ni6bR8wxYo
79
79
  xoscar/serialization/pyfury.py,sha256=3ucal29Hr7PX9_1SfB2x43FE2xw_C0rLkVv3foL7qwM,1200
80
80
  xoscar/serialization/scipy.py,sha256=9ph-yoRoNiwUZTwQrn35U60VPirWlncXNAg6EXvqMR4,2554
81
81
  xoscar/virtualenv/__init__.py,sha256=rhJ7I6x7aXjKOCzSqsKLwqFJMh4YC2sqchEIJNEfI58,1151
82
- xoscar/virtualenv/core.py,sha256=9Uo3_0lrv8-tuxqi8Zt7PbAjAn015ozA5tNwFOpo94o,1387
83
- xoscar/virtualenv/uv.py,sha256=lHYh_vTljCKjV1YFn4jrE4V2ns8VlMO2PJF1xCdDfvI,3046
84
- xoscar-0.7.0rc1.dist-info/METADATA,sha256=RLZL0BHnO5IYoIgEDs5BayxsCszNxEivQPoTbhNozu8,9363
85
- xoscar-0.7.0rc1.dist-info/WHEEL,sha256=y4n9_669c4ZQLyT56MHjc_JUbnwtaZfMVMycweN557o,102
86
- xoscar-0.7.0rc1.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
87
- xoscar-0.7.0rc1.dist-info/RECORD,,
82
+ xoscar/virtualenv/core.py,sha256=FeLmheIkQk0JOayVdUBEMyltAQhidQqbHguCMTHB0Sw,1394
83
+ xoscar/virtualenv/uv.py,sha256=v1LvpxtUu2ja4Cy2EqD-BGxb8zZle5Zj-91QPZH_C10,3273
84
+ xoscar-0.7.1.dist-info/METADATA,sha256=9OmPACIrv37yJ6XfD5h9B6ynOc30kt5plHupHPUpOEg,9360
85
+ xoscar-0.7.1.dist-info/WHEEL,sha256=y4n9_669c4ZQLyT56MHjc_JUbnwtaZfMVMycweN557o,102
86
+ xoscar-0.7.1.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
87
+ xoscar-0.7.1.dist-info/RECORD,,