Skip to content

Commit 3609f28

Browse files
author
Kartik Raj
authored
Do not use worker threads to launching binaries (microsoft#23030)
1 parent 0d1cfe8 commit 3609f28

File tree

5 files changed

+6
-58
lines changed

5 files changed

+6
-58
lines changed

src/client/pythonEnvironments/base/locators/lowLevel/condaLocator.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { BasicEnvInfo, IPythonEnvsIterator } from '../../locator';
66
import { Conda, getCondaEnvironmentsTxt } from '../../../common/environmentManagers/conda';
77
import { traceError, traceVerbose } from '../../../../logging';
88
import { FSWatchingLocator } from './fsWatchingLocator';
9-
import { DiscoveryUsingWorkers } from '../../../../common/experiments/groups';
10-
import { inExperiment } from '../../../common/externalDependencies';
119

1210
export class CondaEnvironmentLocator extends FSWatchingLocator {
1311
public readonly providerId: string = 'conda-envs';
@@ -21,10 +19,7 @@ export class CondaEnvironmentLocator extends FSWatchingLocator {
2119
}
2220

2321
// eslint-disable-next-line class-methods-use-this
24-
public async *doIterEnvs(
25-
_: unknown,
26-
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment),
27-
): IPythonEnvsIterator<BasicEnvInfo> {
22+
public async *doIterEnvs(_: unknown, useWorkerThreads = false): IPythonEnvsIterator<BasicEnvInfo> {
2823
const conda = await Conda.getConda(undefined, useWorkerThreads);
2924
if (conda === undefined) {
3025
traceVerbose(`Couldn't locate the conda binary.`);

src/client/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { BasicEnvInfo, IPythonEnvsIterator, Locator, PythonLocatorQuery, IEmitte
88
import { getRegistryInterpreters } from '../../../common/windowsUtils';
99
import { traceError, traceVerbose } from '../../../../logging';
1010
import { isMicrosoftStoreDir } from '../../../common/environmentManagers/microsoftStoreEnv';
11-
import { inExperiment } from '../../../common/externalDependencies';
12-
import { DiscoveryUsingWorkers } from '../../../../common/experiments/groups';
1311
import { PythonEnvsChangedEvent } from '../../watcher';
1412

1513
export const WINDOWS_REG_PROVIDER_ID = 'windows-registry';
@@ -18,10 +16,7 @@ export class WindowsRegistryLocator extends Locator<BasicEnvInfo> {
1816
public readonly providerId: string = WINDOWS_REG_PROVIDER_ID;
1917

2018
// eslint-disable-next-line class-methods-use-this
21-
public iterEnvs(
22-
query?: PythonLocatorQuery,
23-
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment),
24-
): IPythonEnvsIterator<BasicEnvInfo> {
19+
public iterEnvs(query?: PythonLocatorQuery, useWorkerThreads = false): IPythonEnvsIterator<BasicEnvInfo> {
2520
if (useWorkerThreads) {
2621
/**
2722
* Windows registry is slow and often not necessary, so notify completion immediately, but use watcher

src/client/pythonEnvironments/common/environmentManagers/conda.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
readFile,
1111
onDidChangePythonSetting,
1212
exec,
13-
inExperiment,
1413
} from '../externalDependencies';
1514

1615
import { PythonVersion, UNKNOWN_PYTHON_VERSION } from '../../base/info';
@@ -25,7 +24,6 @@ import { OUTPUT_MARKER_SCRIPT } from '../../../common/process/internal/scripts';
2524
import { splitLines } from '../../../common/stringUtils';
2625
import { SpawnOptions } from '../../../common/process/types';
2726
import { sleep } from '../../../common/utils/async';
28-
import { DiscoveryUsingWorkers } from '../../../common/experiments/groups';
2927

3028
export const AnacondaCompanyName = 'Anaconda, Inc.';
3129
export const CONDAPATH_SETTING_KEY = 'condaPath';
@@ -274,11 +272,7 @@ export class Conda {
274272
private readonly useWorkerThreads?: boolean,
275273
) {
276274
if (this.useWorkerThreads === undefined) {
277-
try {
278-
this.useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment);
279-
} catch {
280-
this.useWorkerThreads = false; // Temporarily support for legacy tests
281-
}
275+
this.useWorkerThreads = false;
282276
}
283277
this.shellCommand = shellCommand ?? command;
284278
onDidChangePythonSetting(CONDAPATH_SETTING_KEY, () => {
@@ -302,11 +296,7 @@ export class Conda {
302296
private static async locate(shellPath?: string, useWorkerThread?: boolean): Promise<Conda | undefined> {
303297
let useWorkerThreads: boolean;
304298
if (useWorkerThread === undefined) {
305-
try {
306-
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment);
307-
} catch {
308-
useWorkerThreads = false; // Temporarily support for legacy tests
309-
}
299+
useWorkerThreads = false;
310300
}
311301
traceVerbose(`Searching for conda.`);
312302
const home = getUserHomeDir();

src/client/pythonEnvironments/common/externalDependencies.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { chain, iterable } from '../../common/utils/async';
1111
import { getOSType, OSType } from '../../common/utils/platform';
1212
import { IServiceContainer } from '../../ioc/types';
1313
import { traceError, traceVerbose } from '../../logging';
14-
import { DiscoveryUsingWorkers } from '../../common/experiments/groups';
1514

1615
let internalServiceContainer: IServiceContainer;
1716
export function initializeExternalDependencies(serviceContainer: IServiceContainer): void {
@@ -21,7 +20,7 @@ export function initializeExternalDependencies(serviceContainer: IServiceContain
2120
// processes
2221

2322
export async function shellExecute(command: string, options: ShellOptions = {}): Promise<ExecutionResult<string>> {
24-
const useWorker = inExperiment(DiscoveryUsingWorkers.experiment);
23+
const useWorker = false;
2524
const service = await internalServiceContainer.get<IProcessServiceFactory>(IProcessServiceFactory).create();
2625
options = { ...options, useWorker };
2726
return service.shellExec(command, options);
@@ -31,7 +30,7 @@ export async function exec(
3130
file: string,
3231
args: string[],
3332
options: SpawnOptions = {},
34-
useWorker = inExperiment(DiscoveryUsingWorkers.experiment),
33+
useWorker = false,
3534
): Promise<ExecutionResult<string>> {
3635
const service = await internalServiceContainer.get<IProcessServiceFactory>(IProcessServiceFactory).create();
3736
options = { ...options, useWorker };

src/test/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.testvirtualenvs.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)