xoscar 0.7.0rc1__tar.gz → 0.7.2__tar.gz
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-0.7.0rc1 → xoscar-0.7.2}/PKG-INFO +1 -1
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/__init__.py +1 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/api.py +34 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/utils.py +1 -1
- xoscar-0.7.2/xoscar/virtualenv/core.py +90 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/virtualenv/uv.py +21 -8
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar.egg-info/PKG-INFO +1 -1
- xoscar-0.7.0rc1/xoscar/virtualenv/core.py +0 -52
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/MANIFEST.in +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/pyproject.toml +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/setup.cfg +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/setup.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/versioneer.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/_utils.pxd +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/_utils.pyx +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/_version.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/aio/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/aio/base.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/aio/file.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/aio/lru.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/aio/parallelism.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backend.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/allocate_strategy.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/base.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/core.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/dummy.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/errors.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/socket.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/ucx.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/communication/utils.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/config.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/context.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/core.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/__main__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/backend.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/driver.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/fate_sharing.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/pool.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/indigen/shared_memory.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/message.pyi +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/message.pyx +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/pool.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/router.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/test/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/test/backend.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/backends/test/pool.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/batch.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/collective/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/collective/common.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/collective/core.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/collective/process_group.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/collective/utils.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/collective/xoscar_pygloo.pyi +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/constants.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/context.pxd +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/context.pyx +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/core.pxd +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/core.pyx +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/debug.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/driver.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/errors.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/libcpp.pxd +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/api.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/backends/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/backends/console/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/backends/console/console_metric.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/backends/metric.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/backends/prometheus/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/metrics/backends/prometheus/prometheus_metric.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/nvutils.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/profiling.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/aio.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/core.pxd +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/core.pyi +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/core.pyx +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/cuda.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/exception.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/mlx.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/numpy.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/pyfury.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/serialization/scipy.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar/virtualenv/__init__.py +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar.egg-info/SOURCES.txt +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar.egg-info/dependency_links.txt +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar.egg-info/not-zip-safe +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar.egg-info/requires.txt +0 -0
- {xoscar-0.7.0rc1 → xoscar-0.7.2}/xoscar.egg-info/top_level.txt +0 -0
|
@@ -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.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Copyright 2022-2025 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
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import importlib
|
|
18
|
+
from abc import ABC, abstractmethod
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class VirtualEnvManager(ABC):
|
|
23
|
+
@classmethod
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def is_available(cls):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def __init__(self, env_path: Path):
|
|
29
|
+
self.env_path = env_path.resolve()
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def create_env(self, python_path: Path | None = None) -> None:
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@abstractmethod
|
|
36
|
+
def install_packages(self, packages: list[str], **kwargs):
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def process_packages(packages: list[str]) -> list[str]:
|
|
41
|
+
"""
|
|
42
|
+
Process a list of package names, replacing placeholders like #system_<package>#
|
|
43
|
+
with the installed version of the corresponding package from the system environment.
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
"#system_torch#" -> "torch==2.1.0" (if torch 2.1.0 is installed)
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
packages (list[str]): A list of package names, which may include placeholders.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
list[str]: A new list with resolved package names and versions.
|
|
53
|
+
|
|
54
|
+
Raises:
|
|
55
|
+
RuntimeError: If a specified system package is not found in the environment.
|
|
56
|
+
"""
|
|
57
|
+
processed = []
|
|
58
|
+
|
|
59
|
+
for pkg in packages:
|
|
60
|
+
if pkg.startswith("#system_") and pkg.endswith("#"):
|
|
61
|
+
real_pkg = pkg[
|
|
62
|
+
len("#system_") : -1
|
|
63
|
+
] # Extract actual package name, e.g., "torch"
|
|
64
|
+
try:
|
|
65
|
+
version = importlib.metadata.version(real_pkg)
|
|
66
|
+
except importlib.metadata.PackageNotFoundError:
|
|
67
|
+
raise RuntimeError(
|
|
68
|
+
f"System package '{real_pkg}' not found. Cannot resolve '{pkg}'."
|
|
69
|
+
)
|
|
70
|
+
processed.append(f"{real_pkg}=={version}")
|
|
71
|
+
else:
|
|
72
|
+
processed.append(pkg)
|
|
73
|
+
|
|
74
|
+
return processed
|
|
75
|
+
|
|
76
|
+
@abstractmethod
|
|
77
|
+
def cancel_install(self):
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
@abstractmethod
|
|
81
|
+
def get_python_path(self) -> str | None:
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
@abstractmethod
|
|
85
|
+
def get_lib_path(self) -> str:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
def remove_env(self):
|
|
90
|
+
pass
|
|
@@ -46,17 +46,28 @@ class UVVirtualEnvManager(VirtualEnvManager):
|
|
|
46
46
|
if not packages:
|
|
47
47
|
return
|
|
48
48
|
|
|
49
|
+
# extend the ability of pip
|
|
50
|
+
# maybe replace #system_torch# to the real version
|
|
51
|
+
packages = self.process_packages(packages)
|
|
52
|
+
|
|
49
53
|
cmd = ["uv", "pip", "install", "-p", str(self.env_path)] + packages
|
|
50
54
|
|
|
51
55
|
# Handle known pip-related kwargs
|
|
52
56
|
if "index_url" in kwargs and kwargs["index_url"]:
|
|
53
57
|
cmd += ["-i", kwargs["index_url"]]
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
param_and_option = [
|
|
59
|
+
("extra_index_url", "--extra-index-url"),
|
|
60
|
+
("find_links", "-f"),
|
|
61
|
+
("trusted_host", "--trusted-host"),
|
|
62
|
+
]
|
|
63
|
+
for param, option in param_and_option:
|
|
64
|
+
if param in kwargs and kwargs[param]:
|
|
65
|
+
param_value = kwargs[param]
|
|
66
|
+
if isinstance(param_value, list):
|
|
67
|
+
for it in param_value:
|
|
68
|
+
cmd += [option, it]
|
|
69
|
+
else:
|
|
70
|
+
cmd += [option, param_value]
|
|
60
71
|
|
|
61
72
|
self._install_process = process = subprocess.Popen(cmd)
|
|
62
73
|
returncode = process.wait()
|
|
@@ -71,8 +82,10 @@ class UVVirtualEnvManager(VirtualEnvManager):
|
|
|
71
82
|
self._install_process.terminate()
|
|
72
83
|
self._install_process.wait()
|
|
73
84
|
|
|
74
|
-
def get_python_path(self) -> str:
|
|
75
|
-
|
|
85
|
+
def get_python_path(self) -> str | None:
|
|
86
|
+
if self.env_path.exists():
|
|
87
|
+
return str(self.env_path.joinpath("bin/python"))
|
|
88
|
+
return None
|
|
76
89
|
|
|
77
90
|
def get_lib_path(self) -> str:
|
|
78
91
|
return sysconfig.get_path("purelib", vars={"base": str(self.env_path)})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Copyright 2022-2025 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
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
from abc import ABC, abstractmethod
|
|
18
|
-
from pathlib import Path
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class VirtualEnvManager(ABC):
|
|
22
|
-
@classmethod
|
|
23
|
-
@abstractmethod
|
|
24
|
-
def is_available(cls):
|
|
25
|
-
pass
|
|
26
|
-
|
|
27
|
-
def __init__(self, env_path: Path):
|
|
28
|
-
self.env_path = env_path.resolve()
|
|
29
|
-
|
|
30
|
-
@abstractmethod
|
|
31
|
-
def create_env(self, python_path: Path | None = None) -> None:
|
|
32
|
-
pass
|
|
33
|
-
|
|
34
|
-
@abstractmethod
|
|
35
|
-
def install_packages(self, packages: list[str], **kwargs):
|
|
36
|
-
pass
|
|
37
|
-
|
|
38
|
-
@abstractmethod
|
|
39
|
-
def cancel_install(self):
|
|
40
|
-
pass
|
|
41
|
-
|
|
42
|
-
@abstractmethod
|
|
43
|
-
def get_python_path(self) -> str:
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def get_lib_path(self) -> str:
|
|
48
|
-
pass
|
|
49
|
-
|
|
50
|
-
@abstractmethod
|
|
51
|
-
def remove_env(self):
|
|
52
|
-
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|