xoscar 0.7.4__cp311-cp311-macosx_11_0_arm64.whl → 0.7.6__cp311-cp311-macosx_11_0_arm64.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
@@ -186,8 +186,8 @@ class MainActorPool(MainActorPoolBase):
186
186
  # as the double fork may result in a new process as the parent.
187
187
  psutil.Process(main_pool_pid)
188
188
  except psutil.NoSuchProcess:
189
- logger.info("Exit due to main pool %s exit.", main_pool_pid)
190
- os._exit(0)
189
+ logger.error("Exit due to main pool %s exit.", main_pool_pid)
190
+ os._exit(233) # Special exit code for debugging.
191
191
  except Exception as e:
192
192
  logger.exception("Check ppid failed: %s", e)
193
193
  time.sleep(10)
@@ -286,8 +286,12 @@ class MainActorPool(MainActorPoolBase):
286
286
  "-sn",
287
287
  shm.name,
288
288
  ]
289
+ # We need to inherit the parent environment to ensure the subprocess works correctly on Windows.
290
+ new_env = dict(os.environ)
291
+ env = actor_pool_config.get_pool_config(process_index).get("env") or {}
292
+ new_env.update(env)
289
293
  logger.info("Creating sub pool via command: %s", cmd)
290
- process = await create_subprocess_exec(*cmd)
294
+ process = await create_subprocess_exec(*cmd, env=new_env)
291
295
 
292
296
  def _get_external_addresses():
293
297
  try:
Binary file
Binary file
@@ -0,0 +1,84 @@
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
+ import logging
16
+ import re
17
+ import subprocess
18
+ import sys
19
+ import threading
20
+ from contextlib import contextmanager
21
+ from typing import BinaryIO, Callable, Iterator, List, Optional, TextIO, Union
22
+
23
+ logger = logging.getLogger(__name__)
24
+
25
+ ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
26
+
27
+
28
+ def clean_ansi(text: str) -> str:
29
+ """Remove ANSI escape sequences from text."""
30
+ return ansi_escape.sub("", text)
31
+
32
+
33
+ def stream_reader(
34
+ stream: BinaryIO, log_func: Callable[[str], None], output_stream: TextIO
35
+ ) -> None:
36
+ """
37
+ Read from the stream, write to logger, and also write to the terminal.
38
+ """
39
+ for line in iter(stream.readline, b""):
40
+ decoded = line.decode(errors="replace")
41
+ output_stream.write(decoded)
42
+ output_stream.flush()
43
+ log_func(clean_ansi(decoded.rstrip("\n")))
44
+
45
+
46
+ @contextmanager
47
+ def run_subprocess_with_logger(
48
+ cmd: Union[str, List[str]], cwd: Optional[str] = None, env: Optional[dict] = None
49
+ ) -> Iterator[subprocess.Popen]:
50
+ """
51
+ Run a subprocess, redirect stdout to logger.info and stderr to logger.error.
52
+ Returns the Popen object as a context manager.
53
+
54
+ :param cmd: Command to execute
55
+ :param kwargs: Additional arguments passed to subprocess.Popen
56
+ :yield: The subprocess.Popen object
57
+ """
58
+
59
+ process = subprocess.Popen(
60
+ cmd,
61
+ stdout=subprocess.PIPE,
62
+ stderr=subprocess.PIPE,
63
+ cwd=cwd,
64
+ env=env,
65
+ bufsize=1,
66
+ )
67
+
68
+ threads = [
69
+ threading.Thread(
70
+ target=stream_reader, args=(process.stdout, logger.info, sys.stdout)
71
+ ),
72
+ threading.Thread(
73
+ target=stream_reader, args=(process.stderr, logger.error, sys.stderr)
74
+ ),
75
+ ]
76
+ for t in threads:
77
+ t.start()
78
+
79
+ try:
80
+ yield process
81
+ finally:
82
+ process.wait()
83
+ for t in threads:
84
+ t.join()
xoscar/virtualenv/uv.py CHANGED
@@ -24,6 +24,7 @@ from pathlib import Path
24
24
  from typing import Optional
25
25
 
26
26
  from .core import VirtualEnvManager
27
+ from .utils import run_subprocess_with_logger
27
28
 
28
29
  UV_PATH = os.getenv("XOSCAR_UV_PATH")
29
30
  logger = logging.getLogger(__name__)
@@ -70,9 +71,17 @@ class UVVirtualEnvManager(VirtualEnvManager):
70
71
  # extend the ability of pip
71
72
  # maybe replace #system_torch# to the real version
72
73
  packages = self.process_packages(packages)
74
+ log = kwargs.pop("log", False)
73
75
 
74
76
  uv_path = UV_PATH or "uv"
75
- cmd = [uv_path, "pip", "install", "-p", str(self.env_path)] + packages
77
+ cmd = [
78
+ uv_path,
79
+ "pip",
80
+ "install",
81
+ "-p",
82
+ str(self.env_path),
83
+ "--color=always",
84
+ ] + packages
76
85
 
77
86
  # Handle known pip-related kwargs
78
87
  if "index_url" in kwargs and kwargs["index_url"]:
@@ -92,8 +101,13 @@ class UVVirtualEnvManager(VirtualEnvManager):
92
101
  cmd += [option, param_value]
93
102
 
94
103
  logger.info("Installing packages via command: %s", cmd)
95
- self._install_process = process = subprocess.Popen(cmd)
96
- returncode = process.wait()
104
+ if not log:
105
+ self._install_process = process = subprocess.Popen(cmd)
106
+ returncode = process.wait()
107
+ else:
108
+ with run_subprocess_with_logger(cmd) as process:
109
+ self._install_process = process
110
+ returncode = process.returncode
97
111
 
98
112
  self._install_process = None # install finished, clear reference
99
113
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xoscar
3
- Version: 0.7.4
3
+ Version: 0.7.6
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -1,5 +1,9 @@
1
+ xoscar-0.7.6.dist-info/RECORD,,
2
+ xoscar-0.7.6.dist-info/WHEEL,sha256=1Yl4xfCXx_BC0nXnlbd5xfzR2RyoNx_gSIEdv2OLRuM,137
3
+ xoscar-0.7.6.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
+ xoscar-0.7.6.dist-info/METADATA,sha256=yFaPaVus0ZE31vkzMxminezb084hGtdOpHiTsFVELgI,9134
1
5
  xoscar/_utils.pyx,sha256=frgVQ5xGp92jBKc4PsPmjOlVsXlKeHWtTOAMfHmBaII,7380
2
- xoscar/_utils.cpython-311-darwin.so,sha256=Greuwqz9kQTyFzyONl-ThCjRwka_uWicy4JIjNzGEOg,170000
6
+ xoscar/_utils.cpython-311-darwin.so,sha256=soXiF6juFuAitVtZ20DlA2ISTpIcs6h5JOU3soP3vyU,170000
3
7
  xoscar/backend.py,sha256=is436OPkZfSpQXaoqTRVta5eoye_pp45RFgCstAk2hU,1850
4
8
  xoscar/core.pxd,sha256=I_C2ka7XryyGnnAVXUVm8xfS1gtIrCs6X-9rswgOcUU,1317
5
9
  xoscar/_version.py,sha256=ClSPrUjgGRGHIkVMQV9XQnkQ-n0akJMnq_rh819nqFE,23719
@@ -10,11 +14,11 @@ xoscar/constants.py,sha256=QHHSREw6uWBBjQDCFqlNfTvBZgniJPGy42KSIsR8Fqw,787
10
14
  xoscar/__init__.py,sha256=sy7Wtn2EuQZI0I4Az_MfsBVZm4G0DRj46qRyExgmnJk,1622
11
15
  xoscar/api.py,sha256=zxNqOjGiTIKuAip9WJ0LOoM7yevD6P5rb-sLynpZ2Zo,14648
12
16
  xoscar/utils.py,sha256=MaKiW4Vphwhh8c0yoqN8G8hbJr1zXgpf49EdvmGc1ZU,16500
13
- xoscar/context.cpython-311-darwin.so,sha256=tB-FyPF9f_e2Ab76LUoJIMFhLDpl8xPVmYEx8PVYTw4,213120
17
+ xoscar/context.cpython-311-darwin.so,sha256=WNuQmYoMYWR82o9K_dd1gUmm8L7fWPbbIVxMWDrqHxA,213120
14
18
  xoscar/debug.py,sha256=9Z8SgE2WaKYQcyDo-5-DxEJQ533v7kWjrvCd28pSx3E,5069
15
19
  xoscar/libcpp.pxd,sha256=DJqBxLFOKL4iRr9Kale5UH3rbvPRD1x5bTSOPHFpz9I,1147
16
20
  xoscar/context.pyx,sha256=8CdgPnWcE9eOp3N600WgDQ03MCi8P73eUOGcfV7Zksg,10942
17
- xoscar/core.cpython-311-darwin.so,sha256=A6Qr32ydN7r5J0kxusqqK3Xax2xw_T3KKWkvS80juvU,412728
21
+ xoscar/core.cpython-311-darwin.so,sha256=hcIYo765EVuqK2jgl20qzY25CNc70BoqLoNIU5Gtj6c,412728
18
22
  xoscar/errors.py,sha256=wBlQOKsXf0Fc4skN39tDie0YZT-VIAuLNRgoDl2pZcA,1241
19
23
  xoscar/core.pyx,sha256=phN-yYV0A0QI8WFi2jCu0nc4CnShTepfDi0V7ZrLYPY,22092
20
24
  xoscar/driver.py,sha256=498fowtJr6b3FE8FIOA_Tc1Vwx88nfZw7p0FxrML0h4,1372
@@ -42,10 +46,10 @@ xoscar/serialization/numpy.py,sha256=5Kem87CvpJmzUMp3QHk4WeHU30FoQWTJJP2SwIcaQG0
42
46
  xoscar/serialization/cuda.py,sha256=iFUEnN4SiquBIhyieyOrfw3TnKnW-tU_vYgqOxO_DrA,3758
43
47
  xoscar/serialization/scipy.py,sha256=yOEi0NB8cqQ6e2UnCZ1w006RsB7T725tIL-DM_hNcsU,2482
44
48
  xoscar/serialization/aio.py,sha256=5DySPgDxU43ec7_5Ct44-Oqt7YNSJBfuf8VdQgQlChA,4731
45
- xoscar/serialization/core.cpython-311-darwin.so,sha256=yGM9eL8RMDghyCeagQk_CGCc3kpmNGb27V9fBKIym8M,365960
49
+ xoscar/serialization/core.cpython-311-darwin.so,sha256=8S5lMayIWBdUCk5z2W_al2c8v3CQqclgLRbhBM0_BDI,365960
46
50
  xoscar/serialization/core.pyx,sha256=bjR-zXGm9qersk7kYPzpjpMIxDl_Auur4BCubRfKmfA,29626
47
51
  xoscar/serialization/mlx.py,sha256=N_cvbTUBKc14XWYsPIMz4kDstyRN1DNhb4BVRgnQm8Y,1872
48
- xoscar/backends/message.cpython-311-darwin.so,sha256=TIOawq8R81kIsworOXlB_ijUzDC0AT0akB9yDK_DDkM,368144
52
+ xoscar/backends/message.cpython-311-darwin.so,sha256=24lqNKZD8Ixx4V0uq0OeVyuBJCeYou92WWZMkPu8vC0,368144
49
53
  xoscar/backends/config.py,sha256=4tZMiXAMMS8qQ4SX_LjONLtSQVfZTx3m-IK3EqbkYdk,5375
50
54
  xoscar/backends/allocate_strategy.py,sha256=tC1Nbq2tJohahUwd-zoRYHEDX65wyuX8tmeY45uWj_w,4845
51
55
  xoscar/backends/__init__.py,sha256=VHEBQcUWM5bj027W8EUf9PiJUAP7JoMrRw3Tsvy5ySw,643
@@ -59,7 +63,7 @@ xoscar/backends/indigen/shared_memory.py,sha256=wqbckbgnd0qNm5KzlP_hklF3F_n8fKnC
59
63
  xoscar/backends/indigen/__init__.py,sha256=tKHP5ClzedBRBpZsLRVErR3EUNbbDm4CY4u0rCFJr44,685
60
64
  xoscar/backends/indigen/fate_sharing.py,sha256=3QUHwq5Cjk9oCKFUISvkqHaoxWZIaXcq8JNOetdBl-A,8655
61
65
  xoscar/backends/indigen/driver.py,sha256=VGzkacYKykegW5qhCuhx01gdgBZEKJjNIyfNCnA6Nm8,952
62
- xoscar/backends/indigen/pool.py,sha256=lzX_bJ07kvUurseZBr1WPL71USBcva62Xo_C6kgo5_g,15857
66
+ xoscar/backends/indigen/pool.py,sha256=uL-tL9uG7HdXIJ8usQOauiqvr2_a0ztMVB2FnLzjdnM,16173
63
67
  xoscar/backends/indigen/__main__.py,sha256=-pfio-Y4Ogbk6lBFksH-gRatp-N6sZ7wuNc-i2YsLJc,510
64
68
  xoscar/backends/test/backend.py,sha256=nv9WFhH5Bbq4Q1HB9yfpciZBaeHT4IQAtzugBWESrUY,1263
65
69
  xoscar/backends/test/__init__.py,sha256=j2ZfD6prD9WjUxRUDC7Eq5Z7N7TkL6fFr59oNyc_vY4,682
@@ -79,8 +83,5 @@ xoscar/aio/parallelism.py,sha256=VSsjk8wP-Bw7tLeUsTyLVNgp91thjxEfE3pCrw_vF5Q,129
79
83
  xoscar/aio/base.py,sha256=9j0f1piwfE5R5GIvV212vSD03ixdaeSzSSsO2kxJZVE,2249
80
84
  xoscar/virtualenv/__init__.py,sha256=65t9_X1DvbanNjFy366SiiWZrRTpa9SXWMXPmqayE-4,1117
81
85
  xoscar/virtualenv/core.py,sha256=dZqwg2IzHsLEERvohZx0rvBINopMRUImqxG3HHGO0q4,2744
82
- xoscar/virtualenv/uv.py,sha256=mR4gevfB8eFMmSLfvOYM-QhyqWyDsqO-V4bkRuhOOWA,4145
83
- xoscar-0.7.4.dist-info/RECORD,,
84
- xoscar-0.7.4.dist-info/WHEEL,sha256=1Yl4xfCXx_BC0nXnlbd5xfzR2RyoNx_gSIEdv2OLRuM,137
85
- xoscar-0.7.4.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
86
- xoscar-0.7.4.dist-info/METADATA,sha256=Er_dlAOGng8Du9y2bXQt42CAe9IG8nOTMjOgzGHVMyo,9134
86
+ xoscar/virtualenv/utils.py,sha256=mL_uATHhj82xec0-0IZ6N8yI-laPAB4t8G3alPUGtPA,2439
87
+ xoscar/virtualenv/uv.py,sha256=pwjOlvwz_ZlO1GQg_yqca-G6Ro_0L7H1Uf5dJPB6lQQ,4526
File without changes