xoscar 0.3.0__cp311-cp311-win_amd64.whl → 0.3.2__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.

Potentially problematic release.


This version of xoscar might be problematic. Click here for more details.

xoscar/__init__.py CHANGED
@@ -50,7 +50,6 @@ from ._utils import create_actor_ref
50
50
 
51
51
  # make sure methods are registered
52
52
  from .backends import indigen, test
53
- from .entrypoints import init_extension_entrypoints
54
53
  from . import _version
55
54
 
56
55
  del indigen, test
@@ -59,6 +58,3 @@ _T = TypeVar("_T")
59
58
  ActorRefType = Union[ActorRef, _T]
60
59
 
61
60
  __version__ = _version.get_versions()["version"]
62
-
63
- init_extension_entrypoints()
64
- del init_extension_entrypoints
Binary file
@@ -26,7 +26,7 @@ from ..context import BaseActorContext
26
26
  from ..core import ActorRef, BufferRef, FileObjectRef, create_local_actor_ref
27
27
  from ..debug import debug_async_timeout, detect_cycle_send
28
28
  from ..errors import CannotCancelTask
29
- from ..utils import dataslots
29
+ from ..utils import dataslots, fix_all_zero_ip
30
30
  from .allocate_strategy import AddressSpecified, AllocateStrategy
31
31
  from .communication import Client, DummyClient, UCXClient
32
32
  from .core import ActorCaller
@@ -187,6 +187,7 @@ class IndigenActorContext(BaseActorContext):
187
187
 
188
188
  async def actor_ref(self, *args, **kwargs):
189
189
  actor_ref = create_actor_ref(*args, **kwargs)
190
+ connect_addr = actor_ref.address
190
191
  local_actor_ref = create_local_actor_ref(actor_ref.address, actor_ref.uid)
191
192
  if local_actor_ref is not None:
192
193
  return local_actor_ref
@@ -195,7 +196,10 @@ class IndigenActorContext(BaseActorContext):
195
196
  )
196
197
  future = await self._call(actor_ref.address, message, wait=False)
197
198
  result = await self._wait(future, actor_ref.address, message)
198
- return self._process_result_message(result)
199
+ res = self._process_result_message(result)
200
+ if res.address != connect_addr:
201
+ res.address = fix_all_zero_ip(res.address, connect_addr)
202
+ return res
199
203
 
200
204
  async def send(
201
205
  self,
xoscar/backends/core.py CHANGED
@@ -85,7 +85,8 @@ class ActorCaller:
85
85
  f"Remote server {client.dest_address} closed"
86
86
  ) from None
87
87
  future = self._client_to_message_futures[client].pop(message.message_id)
88
- future.set_result(message)
88
+ if not future.done():
89
+ future.set_result(message)
89
90
  except DeserializeMessageFailed as e:
90
91
  message_id = e.message_id
91
92
  future = self._client_to_message_futures[client].pop(message_id)
Binary file
xoscar/backends/pool.py CHANGED
@@ -33,7 +33,6 @@ from .._utils import TypeDispatcher, create_actor_ref, to_binary
33
33
  from ..api import Actor
34
34
  from ..core import ActorRef, BufferRef, FileObjectRef, register_local_pool
35
35
  from ..debug import debug_async_timeout, record_message_trace
36
- from ..entrypoints import init_extension_entrypoints
37
36
  from ..errors import (
38
37
  ActorAlreadyExist,
39
38
  ActorNotExist,
@@ -188,8 +187,6 @@ class AbstractActorPool(ABC):
188
187
  self._asyncio_task_timeout_detector_task = (
189
188
  register_asyncio_task_timeout_detector()
190
189
  )
191
- # load third party extensions.
192
- init_extension_entrypoints()
193
190
  # init metrics
194
191
  metric_configs = self._config.get_metric_configs()
195
192
  metric_backend = metric_configs.get("backend")
xoscar/collective/uv.dll CHANGED
Binary file
Binary file
Binary file
xoscar/utils.py CHANGED
@@ -462,3 +462,41 @@ def is_windows():
462
462
 
463
463
  def is_linux():
464
464
  return sys.platform.startswith("linux")
465
+
466
+
467
+ def is_v4_zero_ip(ip_port_addr: str) -> bool:
468
+ return ip_port_addr.startswith("0.0.0.0:")
469
+
470
+
471
+ def is_v6_zero_ip(ip_port_addr: str) -> bool:
472
+ # tcp6 addr ":::123", ":: means all zero"
473
+ arr = ip_port_addr.split(":")
474
+ if len(arr) <= 2: # Not tcp6 or udp6
475
+ return False
476
+ for part in arr[0:-1]:
477
+ if part != "":
478
+ if int(part, 16) != 0:
479
+ return False
480
+ return True
481
+
482
+
483
+ def fix_all_zero_ip(remote_addr: str, connect_addr: str) -> str:
484
+ """
485
+ Use connect_addr to fix ActorRef.address return by remote server.
486
+ When remote server listen on "0.0.0.0:port" or ":::port", it will return ActorRef.address set to listening addr,
487
+ it cannot be use by client for the following interaction unless we fix it.
488
+ (client will treat 0.0.0.0 as 127.0.0.1)
489
+
490
+ NOTE: Server might return a different addr from a pool for load-balance purpose.
491
+ """
492
+ if remote_addr == connect_addr:
493
+ return remote_addr
494
+ if not is_v4_zero_ip(remote_addr) and not is_v6_zero_ip(remote_addr):
495
+ # Remote server returns on non-zero ip
496
+ return remote_addr
497
+ if is_v4_zero_ip(connect_addr) or is_v6_zero_ip(connect_addr):
498
+ # Client connect to local server
499
+ return remote_addr
500
+ remote_port = remote_addr.split(":")[-1]
501
+ connect_ip = ":".join(connect_addr.split(":")[0:-1]) # Remote the port
502
+ return f"{connect_ip}:{remote_port}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xoscar
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -18,11 +18,12 @@ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
19
19
  Classifier: Topic :: Software Development :: Libraries
20
20
  Description-Content-Type: text/markdown
21
- Requires-Dist: numpy >=1.14.0
21
+ Requires-Dist: numpy <2.0.0,>=1.14.0
22
22
  Requires-Dist: pandas >=1.0.0
23
23
  Requires-Dist: cloudpickle >=1.5.0
24
24
  Requires-Dist: psutil >=5.9.0
25
25
  Requires-Dist: tblib >=1.7.0
26
+ Requires-Dist: packaging
26
27
  Requires-Dist: pickle5 ; python_version < "3.8"
27
28
  Requires-Dist: uvloop >=0.14.0 ; sys_platform != "win32"
28
29
  Requires-Dist: scipy >=1.0.0 ; sys_platform != "win32" or python_version >= "3.10"
@@ -1,5 +1,5 @@
1
- xoscar/__init__.py,sha256=MfWK519G_Rs8z-zkT5HdrEfJcPa6p6vqU5uvdTJTH5Y,1785
2
- xoscar/_utils.cp311-win_amd64.pyd,sha256=BI3ETE3P8dXxdsVcLIA_fgRS-UF8c-BiU3njvTPEtZw,113152
1
+ xoscar/__init__.py,sha256=dlwtB7dnDp5WME6CZVQY7d9lk1yJ9s___H5UxjGlAd4,1668
2
+ xoscar/_utils.cp311-win_amd64.pyd,sha256=juEr1Sv2CWXbAJzgyBtDCXO9rwtWc8Y1Sc-2su_KTyU,113664
3
3
  xoscar/_utils.pxd,sha256=rlNbTg5lhXA-jCOLksqF4jhUlNn0xw2jx1HxdLa34pc,1193
4
4
  xoscar/_utils.pyx,sha256=5Wvind3AQ3JaMK7Zv9SjhiPO6LEol2hW7_fMncn69go,7300
5
5
  xoscar/_version.py,sha256=bsfCVAo_o9LkiP3AjPsP4SRRqhjuS0t4D1WGJPzbdls,24412
@@ -7,20 +7,19 @@ xoscar/api.py,sha256=B5oXv4vgMxMteh1YNaBmNFDrUFmYa_dCdzfaWwwZnCo,13820
7
7
  xoscar/backend.py,sha256=8G5JwjoOT6Q2slb11eXNApxgcmvNQUCdQzkoIMDwLcQ,1917
8
8
  xoscar/batch.py,sha256=Jk5BSpvMFAV9DrRy0a9tgPvIo_dt8cbJReZBL0cnOPc,8128
9
9
  xoscar/constants.py,sha256=H9ntCahBz5nKO-A6rkrGKy4WB2kNaLZAytkDajKIXqM,780
10
- xoscar/context.cp311-win_amd64.pyd,sha256=zzlJVBymhpTEksIDH3Rc1EDToHadqN2V1DBbFPZj-to,154624
10
+ xoscar/context.cp311-win_amd64.pyd,sha256=UsoRK54uaajgzditdwm45Pyb6Mrpx2P0Y9i60KbrAZ4,155648
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=Z0OX0RpAwBwmn-LOnmExfHzUFg45gjxjkF-AXIuXphU,323072
13
+ xoscar/core.cp311-win_amd64.pyd,sha256=jDsd41TfJf2zILBfkrj462H3gxA_QTWFEsiGrZBynzs,324096
14
14
  xoscar/core.pxd,sha256=dGv62H92PFG98SVILuF641kY-NWFEt1FYqqOX3WY5RQ,1330
15
15
  xoscar/core.pyx,sha256=0YvJW2AHgymyfsAlPGvIFw65J5gTKO3PK2p1wl4VlJ0,22388
16
16
  xoscar/debug.py,sha256=hrmxIH6zvTKasQo6PUUgXu5mgEsR0g87Fvpw7CoHipg,5257
17
17
  xoscar/driver.py,sha256=EjZ7HkdSgwtE9pXGiJXXwgWfxaIn10eZyqKpBhelaoc,1414
18
- xoscar/entrypoints.py,sha256=BOFOyMIeH3LwRCqonP6-HJGXp1gUdOrHX64KnpAFxjI,1684
19
18
  xoscar/errors.py,sha256=hfIAlYuSVfB3dAQYr8hTLAMmfy5en6Y8mihdtw1gTEE,1304
20
19
  xoscar/libcpp.pxd,sha256=XGy887HXdRsvF47s-A7PvHX6Gaf15d_azRscWJY0Hc8,1178
21
20
  xoscar/nvutils.py,sha256=z6RCVs0sgKFm55TTgAYG3qy5f_AKJzjcH2kcRB-wTJQ,21129
22
21
  xoscar/profiling.py,sha256=LUqkj6sSxaFj0ltS7Yk2kFsh5ieHY417xypTYHwQOb4,8275
23
- xoscar/utils.py,sha256=gLZeaF51zYJuea_0NWbkf4wlSVp81uUno3oQ2LkIxhc,15136
22
+ xoscar/utils.py,sha256=ENwjm_ImxD3fA-3FP4qERYv7XuDnB0xvySDjM2LHQug,16578
24
23
  xoscar/aio/__init__.py,sha256=pkMRxXvvUy_aedqw53aIi6ZS0kb7SCoNLjN9HXUQKIk,834
25
24
  xoscar/aio/_threads.py,sha256=-cfEFZUzx5j_3d7M0ub2FQaVZ8MrOG2UVo5ugucEmMY,1348
26
25
  xoscar/aio/base.py,sha256=ytknTCjTjNQbTM7l7QGXqPYYUkD7qq-zVBGVZ34L1Tc,2335
@@ -30,11 +29,11 @@ xoscar/aio/parallelism.py,sha256=egpScbxggXzAdc_evLsNmUyHafuxu62JWAYS-2ISSuI,133
30
29
  xoscar/backends/__init__.py,sha256=g9OllTquu9MRB5nySVoyiRv2z-_OSALWrOhwt7L9WXc,657
31
30
  xoscar/backends/allocate_strategy.py,sha256=DzvTlixwzTANURI2mDLHm3vcaugSPDxU6UQZb89KH0U,5005
32
31
  xoscar/backends/config.py,sha256=7nmvU_19zYR7n-bT8BNasbjntwmobmMiM7wN7O6Lujc,5129
33
- xoscar/backends/context.py,sha256=zhOFZk_RPLaJ9a8ZDQBHcV54E6r3-VnLVO-D3pIr1qA,15685
34
- xoscar/backends/core.py,sha256=4eMQ5a0-_wYs4OhOWuRIZoBojhMhj7wr6qzo2dqXFSg,7582
35
- xoscar/backends/message.cp311-win_amd64.pyd,sha256=j6br0bvvxohc9VvAeuKEOdmcArbBICLlneOwtl3cgis,259584
32
+ xoscar/backends/context.py,sha256=NukXzBwq9ZwuiN1y6RE1hfNGsW589hDtJAVwu-DV9E0,15874
33
+ xoscar/backends/core.py,sha256=bVQxM1E4qMq1-SkfrZM1aolNg1WQv2sHcZxWI1ETyMM,7625
34
+ xoscar/backends/message.cp311-win_amd64.pyd,sha256=2az1IuGpt-4Vj8FdBSUatCRdIazfpZ2laYTjNX9qSNY,261632
36
35
  xoscar/backends/message.pyx,sha256=kD_bqaApizHtMzqH0Baw5GH3N7r26NwOGoVfm7KCXWg,18203
37
- xoscar/backends/pool.py,sha256=mYZ3VXgAgpt1OO0qw0oMrSXMgguKqVmK1-nnwkHMLPo,60874
36
+ xoscar/backends/pool.py,sha256=_PtJn9AHYLwmEqk1FYaNO4_3mQo_AK79UsRS5P3a_RE,60742
38
37
  xoscar/backends/router.py,sha256=GJpSV_LhzINHdTp5jtsMHfPNMkNb1KI-WlqGqhwApGU,7953
39
38
  xoscar/backends/communication/__init__.py,sha256=Z0_RJkPGwLJeapSNt-TiO9DvnpBPu8P4PCooLaAqjkk,1080
40
39
  xoscar/backends/communication/base.py,sha256=wmWTeE4lcB_ohqyJJ6MdzMGcrOqy2RSKRp8y-NDuFdY,7736
@@ -56,8 +55,8 @@ xoscar/collective/common.py,sha256=9c7xq3IOUvfA0I9GnpalUqXZOzmF6IEILv4zL64BYVE,3
56
55
  xoscar/collective/core.py,sha256=Rx1niJ_6rznLG9varP53oqTH_bZabRzgbuP2V6JPu54,24235
57
56
  xoscar/collective/process_group.py,sha256=kTPbrLMJSGhqbiWvTIiz-X3W0rZWd_CFn_zUIlXbOlM,23286
58
57
  xoscar/collective/utils.py,sha256=p3WEVtXvnVhkuO5mRgQBhBRFr1dKHcDKMjrbMyuiyfg,1219
59
- xoscar/collective/uv.dll,sha256=GzdaDYmvmj9KqzTqsM9Xx7FJslFQtMAh1NhVzn_zG2E,618496
60
- xoscar/collective/xoscar_pygloo.cp311-win_amd64.pyd,sha256=HJa0W_g8u72kEyN20ZhOXYSznI6aP1lzxTuDsjCjaTw,849920
58
+ xoscar/collective/uv.dll,sha256=bSZN79NqBDsfQOvBaxDuwybHfc5HIQevKWh5ZUVnIWQ,620544
59
+ xoscar/collective/xoscar_pygloo.cp311-win_amd64.pyd,sha256=QncXGheUQws17BkzdBwC_3Mb2lQenpyTepBmeNQ9MLo,847872
61
60
  xoscar/metrics/__init__.py,sha256=RjXuuYw4I2YYgD8UY2Z5yCZk0Z56xMJ1n40O80Dtxf8,726
62
61
  xoscar/metrics/api.py,sha256=dtJ4QrIqQNXhJedeqOPs4TXKgrRGZFFN50xAd9SCfec,9144
63
62
  xoscar/metrics/backends/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS3Ijp1YgyynoUFLeuU,594
@@ -68,7 +67,7 @@ xoscar/metrics/backends/prometheus/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS
68
67
  xoscar/metrics/backends/prometheus/prometheus_metric.py,sha256=65hb8O3tmsEJ7jgOrIwl_suj9SE5Tmqcfjuk0urkLvE,2120
69
68
  xoscar/serialization/__init__.py,sha256=NOAn046vnHEkx--82BKNinV8EpyOfT5hqfRBGnKl56s,866
70
69
  xoscar/serialization/aio.py,sha256=bL31B2lwrEKA5nztRSeSgDyqsbBN6dCMr6rHwNDGAIk,4715
71
- xoscar/serialization/core.cp311-win_amd64.pyd,sha256=kkuA7gOSfF_q4djQkPM7t-E5GROH0jNyakVIF5bak0M,294400
70
+ xoscar/serialization/core.cp311-win_amd64.pyd,sha256=JSJWVNyzniebPGUWVfeizWSvdZlrJFZkJJm2Uxl6bZg,294912
72
71
  xoscar/serialization/core.pxd,sha256=X-47bqBM2Kzw5SkLqICdKD0gU6CpmLsBxC3kfW--wVk,1013
73
72
  xoscar/serialization/core.pyx,sha256=H6YZos-OHDxqFvu1vKvoH3Fhw3HzGn8dI3YPACFL5C0,31085
74
73
  xoscar/serialization/cuda.py,sha256=Fj4Cpr_YmkGceUCo0mQn8fRvmHP_5WcLdRx6epZ3RC0,3869
@@ -76,7 +75,7 @@ xoscar/serialization/exception.py,sha256=t6yZn_Ate04UE1RbabNh7mu739sdtwarjuPXWhA
76
75
  xoscar/serialization/numpy.py,sha256=C6WVx-Sdl2OHBAvVY34DFjAKXlekMbpc2ni6bR8wxYo,3001
77
76
  xoscar/serialization/pyfury.py,sha256=3ucal29Hr7PX9_1SfB2x43FE2xw_C0rLkVv3foL7qwM,1200
78
77
  xoscar/serialization/scipy.py,sha256=9ph-yoRoNiwUZTwQrn35U60VPirWlncXNAg6EXvqMR4,2554
79
- xoscar-0.3.0.dist-info/METADATA,sha256=xTCPaE-hcyu068f2-F_Xi6gqb_3Nu3LwiQRq-dgxINQ,9438
80
- xoscar-0.3.0.dist-info/WHEEL,sha256=nSybvzWlmdJnHiUQSY-d7V1ycwEVUTqXiTvr2eshg44,102
81
- xoscar-0.3.0.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
82
- xoscar-0.3.0.dist-info/RECORD,,
78
+ xoscar-0.3.2.dist-info/METADATA,sha256=JntIPeg3LYhNWmp19WZeEetJ5ykvrrkPXb2wInUVAOE,9471
79
+ xoscar-0.3.2.dist-info/WHEEL,sha256=nSybvzWlmdJnHiUQSY-d7V1ycwEVUTqXiTvr2eshg44,102
80
+ xoscar-0.3.2.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
81
+ xoscar-0.3.2.dist-info/RECORD,,
xoscar/entrypoints.py DELETED
@@ -1,42 +0,0 @@
1
- # Copyright 2022-2023 XProbe Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- import functools
16
- import logging
17
- import warnings
18
-
19
- logger = logging.getLogger(__name__)
20
-
21
-
22
- # from https://github.com/numba/numba/blob/master/numba/core/entrypoints.py
23
- # Must put this here to avoid extensions re-triggering initialization
24
- @functools.lru_cache(maxsize=None)
25
- def init_extension_entrypoints():
26
- """Execute all `xoscar_extensions` entry points with the name `init`
27
- If extensions have already been initialized, this function does nothing.
28
- """
29
- from pkg_resources import iter_entry_points # type: ignore
30
-
31
- for entry_point in iter_entry_points("xoscar_extensions", "init"):
32
- logger.info("Loading extension: %s", entry_point)
33
- try:
34
- func = entry_point.load()
35
- func()
36
- except Exception as e:
37
- msg = "Xoscar extension module '{}' failed to load due to '{}({})'."
38
- warnings.warn(
39
- msg.format(entry_point.module_name, type(e).__name__, str(e)),
40
- stacklevel=2,
41
- )
42
- logger.info("Extension loading failed for: %s", entry_point)
File without changes