diff options
| author | MoonEyes <ducoinbenjamin@yahoo.fr> | 2026-11-30 11:12:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-30 11:12:46 +0100 |
| commit | 454df8e954815e716888785df0b2e65ecfc82cf7 (patch) | |
| tree | dd28c3e8709a8e1e1ba7ae99c92f871c10b94200 /scripts | |
| parent | 1b0f657f3d6398a9dce576a4ebeee6fb33711256 (diff) | |
| parent | fb163d9a9c6fee18c29d1796e6b5210d253faa3a (diff) | |
Merge pull request #2678 from bobcatchris/fix/compute-workers-win-venv
COMPUTE-WORKERS-WIN-VENV: launch Windows compute workers with sys._base_executable
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/compute_workers_win.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/compute_workers_win.py b/scripts/compute_workers_win.py index 9fd974e0a..860d91bf3 100644 --- a/scripts/compute_workers_win.py +++ b/scripts/compute_workers_win.py | |||
| @@ -119,6 +119,15 @@ def drain(h): | |||
| 119 | time.sleep(.02) | 119 | time.sleep(.02) |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | def _worker_executable(): | ||
| 123 | # Inside a Windows venv, sys.executable is a launcher stub that spawns the base interpreter as a second process, | ||
| 124 | # filling the two-process Job Object limit before a tool starts. Run the base interpreter directly when available. | ||
| 125 | base = getattr(sys, "_base_executable", None) | ||
| 126 | if base and os.path.isfile(base): | ||
| 127 | return base | ||
| 128 | return sys.executable | ||
| 129 | |||
| 130 | |||
| 122 | @contextlib.contextmanager | 131 | @contextlib.contextmanager |
| 123 | def start(request, mib, lock): | 132 | def start(request, mib, lock): |
| 124 | if type(lock) is not int or lock <= 0: | 133 | if type(lock) is not int or lock <= 0: |
| @@ -133,7 +142,7 @@ def start(request, mib, lock): | |||
| 133 | si = subprocess.STARTUPINFO(lpAttributeList={"handle_list": [lock]}) | 142 | si = subprocess.STARTUPINFO(lpAttributeList={"handle_list": [lock]}) |
| 134 | os.set_handle_inheritable(lock, True) | 143 | os.set_handle_inheritable(lock, True) |
| 135 | try: | 144 | try: |
| 136 | p = subprocess.Popen([sys.executable, "-I", "-B", str(Path(__file__).resolve()), "--shard"], | 145 | p = subprocess.Popen([_worker_executable(), "-I", "-B", str(Path(__file__).resolve()), "--shard"], |
| 137 | stdin=subprocess.PIPE, startupinfo=si, close_fds=True, creationflags=LOW) | 146 | stdin=subprocess.PIPE, startupinfo=si, close_fds=True, creationflags=LOW) |
| 138 | finally: | 147 | finally: |
| 139 | os.set_handle_inheritable(lock, False) | 148 | os.set_handle_inheritable(lock, False) |