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

Exclude queued experiments from dvc root collection #5833

Merged
merged 1 commit into from
Nov 24, 2024
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
2 changes: 1 addition & 1 deletion extension/src/cli/dvc/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const TEMP_PLOTS_DIR = join(DOT_DVC, 'tmp', 'plots')

export const FIELD_SEPARATOR = '::'

const TEMP_EXP_DIR = join(DOT_DVC, 'tmp', 'exps')
export const TEMP_EXP_DIR = join(DOT_DVC, 'tmp', 'exps')
const TEMP_EXP_RUN_DIR = join(TEMP_EXP_DIR, 'run')
export const DVCLIVE_ONLY_RUNNING_SIGNAL_FILE = join(
TEMP_EXP_RUN_DIR,
Expand Down
13 changes: 13 additions & 0 deletions extension/src/fileSystem/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@ describe('findDvcRootPaths', () => {
new Set([dvcDemoPath, mockFirstDvcRoot, mockSecondDvcRoot])
)
})

it('should exclude queued experiment directories', async () => {
const queuedExpDir = join(dvcDemoPath, DOT_DVC, 'tmp', 'exps', 'tmp_2xr')

mockedFindFiles.mockResolvedValue([
convertAsFindDvcConfigFile(dvcDemoPath),
convertAsFindDvcConfigFile(queuedExpDir)
])

const dvcRoots = await findDvcRootPaths()

expect(dvcRoots).toStrictEqual(new Set([dvcDemoPath]))
})
})

describe('findAbsoluteDvcRootPath', () => {
Expand Down
12 changes: 8 additions & 4 deletions extension/src/fileSystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { gitPath } from '../cli/git/constants'
import { createValidInteger } from '../util/number'
import { processExists } from '../process/execution'
import { getFirstWorkspaceFolder } from '../vscode/workspaceFolders'
import { DOT_DVC, FULLY_NESTED_DVC } from '../cli/dvc/constants'
import { DOT_DVC, FULLY_NESTED_DVC, TEMP_EXP_DIR } from '../cli/dvc/constants'
import { delay } from '../util/time'
import { PlotConfigData, PlotConfigDataAxis } from '../pipeline/quickPick'

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

const nested = await findFiles(FULLY_NESTED_DVC)
if (definedAndNonEmpty(nested)) {
dvcRoots.push(
...nested.map(nestedRoot => standardizePath(dirname(dirname(nestedRoot))))
)
for (const nestedRoot of nested) {
const dvcRoot = standardizePath(dirname(dirname(nestedRoot)))
if (dvcRoot.includes(TEMP_EXP_DIR)) {
continue
}
dvcRoots.push(dvcRoot)
}
}

return new Set(sortCollectedArray(dvcRoots))
Expand Down
6 changes: 4 additions & 2 deletions extension/src/pipeline/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AvailableCommands, InternalCommands } from '../commands/internal'
import { BaseData } from '../data'
import { findFiles } from '../fileSystem/workspace'
import { isPathInProject } from '../fileSystem'
import { TEMP_EXP_DIR } from '../cli/dvc/constants'

export class PipelineData extends BaseData<{
dag: string
Expand Down Expand Up @@ -57,7 +58,8 @@ export class PipelineData extends BaseData<{
return this.notifyChanged({ dag, stages })
}

private findDvcYamls() {
return findFiles('**/dvc.yaml')
private async findDvcYamls() {
const dvcYamls = await findFiles('**/dvc.yaml')
return dvcYamls.filter(file => !file.includes(TEMP_EXP_DIR))
}
}
Loading