Repository navigation
Add conda support to nightly flake test #10523
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
Changes from 1 commit
b260c2a
885f972
d3f04f6
11c6097
db60ded
fca098e
ba0fc56
d4f3fee
fb16261
bfb4cec
43cf4a1
8e11f39
2573ea0
c418e11
318b82c
cd9112a
fd76344
a83acca
be983b2
39f5e4b
dcd6c0f
21eab4b
87fbdbb
96b4395
587bafc
94b75fd
7712c47
b9fc139
6f85ffb
130fc50
48cc263
bcdfdaf
04d6caa
1f03b7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,12 @@ const condaRetryMessages = [ | |
| 'The directory is not empty' | ||
| ]; | ||
|
|
||
| /** | ||
| * This class exists so that the environment variable fetching can be cached in between tests. Normally | ||
| * this cache resides in memory for the duration of the EnvironmentActivationService's lifetime, but in the case | ||
| * of our functional tests, we want the cached data to exist outside of each test (where each test will destroy the EnvironmentActivationService) | ||
| * This gives each test a 3 or 4 second speedup. | ||
| */ | ||
| export class EnvironmentActivationServiceCache { | ||
| private static useStatic = false; | ||
| private static staticMap = new Map<string, InMemoryCache<NodeJS.ProcessEnv | undefined>>(); | ||
|
|
@@ -180,11 +186,15 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi | |
| const command = `${activationCommand} && echo '${getEnvironmentPrefix}' && python ${printEnvPyFile.fileToCommandArgument()}`; | ||
| traceVerbose(`Activating Environment to capture Environment variables, ${command}`); | ||
|
|
||
| // Conda activate can hang on certain systems. Fail after 30 seconds. | ||
| // Do some wrapping of the call. For two reasons: | ||
| // 1) Conda activate can hang on certain systems. Fail after 30 seconds. | ||
| // See the discussion from hidesoon in this issue: https://github.com/Microsoft/vscode-python/issues/4424 | ||
| // His issue is conda never finishing during activate. This is a conda issue, but we | ||
| // should at least tell the user. | ||
| // 2) Retry because of this issue here: https://github.com/microsoft/vscode-python/issues/9244 | ||
| // This happens on AzDo machines a bunch when using Conda (and we can't dictate the conda version in order to get the fix) | ||
| let result: ExecutionResult<string> | undefined; | ||
| let tryCount = 1; | ||
| while (!result) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels dangerous to keep trying indefinitely. I'd gate this to 10-20 or other retries. I.e. max out at 5-10-20 seconds.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay sure. I suppose it's possible it could get stuck indefinitely. In reply to: 391128679 [](ancestors = 391128679) |
||
| try { | ||
| result = await processService.shellExec(command, { | ||
|
|
@@ -201,9 +211,10 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi | |
| // Special case. Conda for some versions will state a file is in use. If | ||
| // that's the case, wait and try again. This happens especially on AzDo | ||
| const excString = exc.toString(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might want to add comments about the issue this is trying to solve (probably link to issue number). Right now its not obvious that we're trying to work around some conda issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I.e. its not obvious as to why we even need a retry.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll link to the issue and explain here that conda sucks. In reply to: 391126817 [](ancestors = 391126817) |
||
| if (condaRetryMessages.find(m => excString.includes(m))) { | ||
| if (condaRetryMessages.find(m => excString.includes(m)) && tryCount < 10) { | ||
| traceInfo(`Conda is busy, attempting to retry ...`); | ||
| result = undefined; | ||
| tryCount += 1; | ||
| await sleep(500); | ||
| } else { | ||
| throw exc; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding some comments explaining the purpose of this class would be useful.
Specially for core extension devs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
In reply to: 391124953 [](ancestors = 391124953)