Skip to content

Do not use worker threads to launching binaries #23030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { BasicEnvInfo, IPythonEnvsIterator } from '../../locator';
import { Conda, getCondaEnvironmentsTxt } from '../../../common/environmentManagers/conda';
import { traceError, traceVerbose } from '../../../../logging';
import { FSWatchingLocator } from './fsWatchingLocator';
import { DiscoveryUsingWorkers } from '../../../../common/experiments/groups';
import { inExperiment } from '../../../common/externalDependencies';

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

// eslint-disable-next-line class-methods-use-this
public async *doIterEnvs(
_: unknown,
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment),
): IPythonEnvsIterator<BasicEnvInfo> {
public async *doIterEnvs(_: unknown, useWorkerThreads = false): IPythonEnvsIterator<BasicEnvInfo> {
const conda = await Conda.getConda(undefined, useWorkerThreads);
if (conda === undefined) {
traceVerbose(`Couldn't locate the conda binary.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { BasicEnvInfo, IPythonEnvsIterator, Locator, PythonLocatorQuery, IEmitte
import { getRegistryInterpreters } from '../../../common/windowsUtils';
import { traceError, traceVerbose } from '../../../../logging';
import { isMicrosoftStoreDir } from '../../../common/environmentManagers/microsoftStoreEnv';
import { inExperiment } from '../../../common/externalDependencies';
import { DiscoveryUsingWorkers } from '../../../../common/experiments/groups';
import { PythonEnvsChangedEvent } from '../../watcher';

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

// eslint-disable-next-line class-methods-use-this
public iterEnvs(
query?: PythonLocatorQuery,
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment),
): IPythonEnvsIterator<BasicEnvInfo> {
public iterEnvs(query?: PythonLocatorQuery, useWorkerThreads = false): IPythonEnvsIterator<BasicEnvInfo> {
if (useWorkerThreads) {
/**
* Windows registry is slow and often not necessary, so notify completion immediately, but use watcher
Expand Down
14 changes: 2 additions & 12 deletions src/client/pythonEnvironments/common/environmentManagers/conda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
readFile,
onDidChangePythonSetting,
exec,
inExperiment,
} from '../externalDependencies';

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

export const AnacondaCompanyName = 'Anaconda, Inc.';
export const CONDAPATH_SETTING_KEY = 'condaPath';
Expand Down Expand Up @@ -274,11 +272,7 @@ export class Conda {
private readonly useWorkerThreads?: boolean,
) {
if (this.useWorkerThreads === undefined) {
try {
this.useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment);
} catch {
this.useWorkerThreads = false; // Temporarily support for legacy tests
}
this.useWorkerThreads = false;
}
this.shellCommand = shellCommand ?? command;
onDidChangePythonSetting(CONDAPATH_SETTING_KEY, () => {
Expand All @@ -302,11 +296,7 @@ export class Conda {
private static async locate(shellPath?: string, useWorkerThread?: boolean): Promise<Conda | undefined> {
let useWorkerThreads: boolean;
if (useWorkerThread === undefined) {
try {
useWorkerThreads = inExperiment(DiscoveryUsingWorkers.experiment);
} catch {
useWorkerThreads = false; // Temporarily support for legacy tests
}
useWorkerThreads = false;
}
traceVerbose(`Searching for conda.`);
const home = getUserHomeDir();
Expand Down
5 changes: 2 additions & 3 deletions src/client/pythonEnvironments/common/externalDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { chain, iterable } from '../../common/utils/async';
import { getOSType, OSType } from '../../common/utils/platform';
import { IServiceContainer } from '../../ioc/types';
import { traceError, traceVerbose } from '../../logging';
import { DiscoveryUsingWorkers } from '../../common/experiments/groups';

let internalServiceContainer: IServiceContainer;
export function initializeExternalDependencies(serviceContainer: IServiceContainer): void {
Expand All @@ -21,7 +20,7 @@ export function initializeExternalDependencies(serviceContainer: IServiceContain
// processes

export async function shellExecute(command: string, options: ShellOptions = {}): Promise<ExecutionResult<string>> {
const useWorker = inExperiment(DiscoveryUsingWorkers.experiment);
const useWorker = false;
const service = await internalServiceContainer.get<IProcessServiceFactory>(IProcessServiceFactory).create();
options = { ...options, useWorker };
return service.shellExec(command, options);
Expand All @@ -31,7 +30,7 @@ export async function exec(
file: string,
args: string[],
options: SpawnOptions = {},
useWorker = inExperiment(DiscoveryUsingWorkers.experiment),
useWorker = false,
): Promise<ExecutionResult<string>> {
const service = await internalServiceContainer.get<IProcessServiceFactory>(IProcessServiceFactory).create();
options = { ...options, useWorker };
Expand Down

This file was deleted.