Skip to content

Commit 32c10e4

Browse files
author
Kartik Raj
authored
Add verbose logging for change events fired related to envs (#20780)
For #20292
1 parent be75eb2 commit 32c10e4

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/client/proposedApi.ts

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export function buildProposedApi(
149149
}
150150
if (e.old) {
151151
if (e.new) {
152+
traceVerbose('Python API env change detected', env.id, 'update');
152153
onEnvironmentsChanged.fire({ type: 'update', env: convertEnvInfoAndGetReference(e.new) });
153154
reportInterpretersChanged([
154155
{
@@ -157,6 +158,7 @@ export function buildProposedApi(
157158
},
158159
]);
159160
} else {
161+
traceVerbose('Python API env change detected', env.id, 'remove');
160162
onEnvironmentsChanged.fire({ type: 'remove', env: convertEnvInfoAndGetReference(e.old) });
161163
reportInterpretersChanged([
162164
{
@@ -166,6 +168,7 @@ export function buildProposedApi(
166168
]);
167169
}
168170
} else if (e.new) {
171+
traceVerbose('Python API env change detected', env.id, 'add');
169172
onEnvironmentsChanged.fire({ type: 'add', env: convertEnvInfoAndGetReference(e.new) });
170173
reportInterpretersChanged([
171174
{

src/client/pythonEnvironments/base/info/interpreter.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
import { PythonExecutableInfo, PythonVersion } from '.';
5+
import { isCI } from '../../../common/constants';
56
import {
67
interpreterInfo as getInterpreterInfoCommand,
78
InterpreterInfoJson,
@@ -80,13 +81,15 @@ export async function getInterpreterInfo(
8081
'',
8182
);
8283

84+
// Sometimes on CI, the python process takes a long time to start up. This is a workaround for that.
85+
const standardTimeout = isCI ? 30000 : 15000;
8386
// Try shell execing the command, followed by the arguments. This will make node kill the process if it
8487
// takes too long.
8588
// Sometimes the python path isn't valid, timeout if that's the case.
8689
// See these two bugs:
8790
// https://github.com/microsoft/vscode-python/issues/7569
8891
// https://github.com/microsoft/vscode-python/issues/7760
89-
const result = await shellExecute(quoted, { timeout: timeout ?? 15000 });
92+
const result = await shellExecute(quoted, { timeout: timeout ?? standardTimeout });
9093
if (result.stderr) {
9194
traceError(
9295
`Stderr when executing script with >> ${quoted} << stderr: ${result.stderr}, still attempting to parse output`,

src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export class PythonEnvInfoCache extends PythonEnvsWatcher<PythonEnvCollectionCha
126126
.reverse(); // Reversed so indexes do not change when deleting
127127
invalidIndexes.forEach((index) => {
128128
const env = this.envs.splice(index, 1)[0];
129+
traceVerbose(`Removing invalid env from cache ${env.id}`);
129130
this.fire({ old: env, new: undefined });
130131
});
131132
if (envs) {

0 commit comments

Comments
 (0)