Skip to content
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

Increase timeout of running interpreterInfo.py script on CI #20780

Merged
merged 3 commits into from
Mar 1, 2023
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
3 changes: 3 additions & 0 deletions src/client/proposedApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
{
Expand All @@ -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([
{
Expand All @@ -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([
{
Expand Down
5 changes: 4 additions & 1 deletion src/client/pythonEnvironments/base/info/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { PythonExecutableInfo, PythonVersion } from '.';
import { isCI } from '../../../common/constants';
import {
interpreterInfo as getInterpreterInfoCommand,
InterpreterInfoJson,
Expand Down Expand Up @@ -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`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class PythonEnvInfoCache extends PythonEnvsWatcher<PythonEnvCollectionCha
.reverse(); // Reversed so indexes do not change when deleting
invalidIndexes.forEach((index) => {
const env = this.envs.splice(index, 1)[0];
traceVerbose(`Removing invalid env from cache ${env.id}`);
this.fire({ old: env, new: undefined });
});
if (envs) {
Expand Down