Skip to content

Commit 9497767

Browse files
authored
Exclude queued experiments from dvc root collection (#5833)
1 parent e8e153d commit 9497767

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

extension/src/cli/dvc/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const TEMP_PLOTS_DIR = join(DOT_DVC, 'tmp', 'plots')
1212

1313
export const FIELD_SEPARATOR = '::'
1414

15-
const TEMP_EXP_DIR = join(DOT_DVC, 'tmp', 'exps')
15+
export const TEMP_EXP_DIR = join(DOT_DVC, 'tmp', 'exps')
1616
const TEMP_EXP_RUN_DIR = join(TEMP_EXP_DIR, 'run')
1717
export const DVCLIVE_ONLY_RUNNING_SIGNAL_FILE = join(
1818
TEMP_EXP_RUN_DIR,

extension/src/fileSystem/index.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,19 @@ describe('findDvcRootPaths', () => {
337337
new Set([dvcDemoPath, mockFirstDvcRoot, mockSecondDvcRoot])
338338
)
339339
})
340+
341+
it('should exclude queued experiment directories', async () => {
342+
const queuedExpDir = join(dvcDemoPath, DOT_DVC, 'tmp', 'exps', 'tmp_2xr')
343+
344+
mockedFindFiles.mockResolvedValue([
345+
convertAsFindDvcConfigFile(dvcDemoPath),
346+
convertAsFindDvcConfigFile(queuedExpDir)
347+
])
348+
349+
const dvcRoots = await findDvcRootPaths()
350+
351+
expect(dvcRoots).toStrictEqual(new Set([dvcDemoPath]))
352+
})
340353
})
341354

342355
describe('findAbsoluteDvcRootPath', () => {

extension/src/fileSystem/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { gitPath } from '../cli/git/constants'
3030
import { createValidInteger } from '../util/number'
3131
import { processExists } from '../process/execution'
3232
import { getFirstWorkspaceFolder } from '../vscode/workspaceFolders'
33-
import { DOT_DVC, FULLY_NESTED_DVC } from '../cli/dvc/constants'
33+
import { DOT_DVC, FULLY_NESTED_DVC, TEMP_EXP_DIR } from '../cli/dvc/constants'
3434
import { delay } from '../util/time'
3535
import { PlotConfigData, PlotConfigDataAxis } from '../pipeline/quickPick'
3636

@@ -72,9 +72,13 @@ export const findDvcRootPaths = async (): Promise<Set<string>> => {
7272

7373
const nested = await findFiles(FULLY_NESTED_DVC)
7474
if (definedAndNonEmpty(nested)) {
75-
dvcRoots.push(
76-
...nested.map(nestedRoot => standardizePath(dirname(dirname(nestedRoot))))
77-
)
75+
for (const nestedRoot of nested) {
76+
const dvcRoot = standardizePath(dirname(dirname(nestedRoot)))
77+
if (dvcRoot.includes(TEMP_EXP_DIR)) {
78+
continue
79+
}
80+
dvcRoots.push(dvcRoot)
81+
}
7882
}
7983

8084
return new Set(sortCollectedArray(dvcRoots))

extension/src/pipeline/data.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { AvailableCommands, InternalCommands } from '../commands/internal'
33
import { BaseData } from '../data'
44
import { findFiles } from '../fileSystem/workspace'
55
import { isPathInProject } from '../fileSystem'
6+
import { TEMP_EXP_DIR } from '../cli/dvc/constants'
67

78
export class PipelineData extends BaseData<{
89
dag: string
@@ -57,7 +58,8 @@ export class PipelineData extends BaseData<{
5758
return this.notifyChanged({ dag, stages })
5859
}
5960

60-
private findDvcYamls() {
61-
return findFiles('**/dvc.yaml')
61+
private async findDvcYamls() {
62+
const dvcYamls = await findFiles('**/dvc.yaml')
63+
return dvcYamls.filter(file => !file.includes(TEMP_EXP_DIR))
6264
}
6365
}

0 commit comments

Comments
 (0)