From e388d38d4d966993a9e252618fb505d0aeecc3bc Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 1 Mar 2023 10:57:23 -0800 Subject: [PATCH 1/3] Add verbose logging for change events fired related to envs --- src/client/proposedApi.ts | 3 +++ .../base/locators/composite/envsCollectionCache.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/proposedApi.ts b/src/client/proposedApi.ts index 1b710a888c99..f49d7338975d 100644 --- a/src/client/proposedApi.ts +++ b/src/client/proposedApi.ts @@ -149,6 +149,7 @@ export function buildProposedApi( } if (e.old) { if (e.new) { + traceVerbose('Python API env change detected', env.id, 'update'); onEnvironmentsChanged.fire({ type: 'update', env: convertEnvInfoAndGetReference(e.new) }); reportInterpretersChanged([ { @@ -157,6 +158,7 @@ export function buildProposedApi( }, ]); } else { + traceVerbose('Python API env change detected', env.id, 'remove'); onEnvironmentsChanged.fire({ type: 'remove', env: convertEnvInfoAndGetReference(e.old) }); reportInterpretersChanged([ { @@ -166,6 +168,7 @@ export function buildProposedApi( ]); } } else if (e.new) { + traceVerbose('Python API env change detected', env.id, 'add'); onEnvironmentsChanged.fire({ type: 'add', env: convertEnvInfoAndGetReference(e.new) }); reportInterpretersChanged([ { diff --git a/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts b/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts index b8ae5bcf4cd2..7369f78b78b9 100644 --- a/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts +++ b/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts @@ -5,7 +5,7 @@ import { Event } from 'vscode'; import { isTestExecution } from '../../../../common/constants'; import { traceInfo, traceVerbose } from '../../../../logging'; import { arePathsSame, getFileInfo, pathExists } from '../../../common/externalDependencies'; -import { PythonEnvInfo } from '../../info'; +import { PythonEnvInfo, PythonEnvKind } from '../../info'; import { areEnvsDeepEqual, areSameEnv, getEnvPath } from '../../info/env'; import { BasicPythonEnvCollectionChangedEvent, @@ -126,6 +126,7 @@ export class PythonEnvInfoCache extends PythonEnvsWatcher { const env = this.envs.splice(index, 1)[0]; + traceVerbose(`Removing invalid env from cache ${env.id}`); this.fire({ old: env, new: undefined }); }); if (envs) { From 74e1678b09f1854690567dbb1977d9853e014c93 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 1 Mar 2023 11:03:07 -0800 Subject: [PATCH 2/3] lint --- .../base/locators/composite/envsCollectionCache.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts b/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts index 7369f78b78b9..acf7626e6935 100644 --- a/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts +++ b/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts @@ -5,7 +5,7 @@ import { Event } from 'vscode'; import { isTestExecution } from '../../../../common/constants'; import { traceInfo, traceVerbose } from '../../../../logging'; import { arePathsSame, getFileInfo, pathExists } from '../../../common/externalDependencies'; -import { PythonEnvInfo, PythonEnvKind } from '../../info'; +import { PythonEnvInfo } from '../../info'; import { areEnvsDeepEqual, areSameEnv, getEnvPath } from '../../info/env'; import { BasicPythonEnvCollectionChangedEvent, From a1a84306acec72e46abc2831b694fb0f1a1fad5e Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 1 Mar 2023 13:53:26 -0800 Subject: [PATCH 3/3] Increase timeout to 30seconds on CI --- src/client/pythonEnvironments/base/info/interpreter.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/pythonEnvironments/base/info/interpreter.ts b/src/client/pythonEnvironments/base/info/interpreter.ts index f696bd40d173..5341a8f561ae 100644 --- a/src/client/pythonEnvironments/base/info/interpreter.ts +++ b/src/client/pythonEnvironments/base/info/interpreter.ts @@ -2,6 +2,7 @@ // Licensed under the MIT License. import { PythonExecutableInfo, PythonVersion } from '.'; +import { isCI } from '../../../common/constants'; import { interpreterInfo as getInterpreterInfoCommand, InterpreterInfoJson, @@ -80,13 +81,15 @@ export async function getInterpreterInfo( '', ); + // Sometimes on CI, the python process takes a long time to start up. This is a workaround for that. + const standardTimeout = isCI ? 30000 : 15000; // Try shell execing the command, followed by the arguments. This will make node kill the process if it // takes too long. // Sometimes the python path isn't valid, timeout if that's the case. // See these two bugs: // https://github.com/microsoft/vscode-python/issues/7569 // https://github.com/microsoft/vscode-python/issues/7760 - const result = await shellExecute(quoted, { timeout: timeout ?? 15000 }); + const result = await shellExecute(quoted, { timeout: timeout ?? standardTimeout }); if (result.stderr) { traceError( `Stderr when executing script with >> ${quoted} << stderr: ${result.stderr}, still attempting to parse output`,