Skip to content
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/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export abstract class BaseData<
protected readonly dvcRoot: string
protected readonly processManager: ProcessManager
protected readonly internalCommands: InternalCommands
protected collectedFiles: string[] = []

private collectedFiles: string[] = []
private readonly staticFiles: string[]

private readonly updated: EventEmitter<T> = this.dispose.track(
Expand Down
38 changes: 33 additions & 5 deletions extension/src/experiments/data/collect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import expShowFixture from '../../test/fixtures/expShow/output'

describe('collectFiles', () => {
it('should collect all of the available files from the test fixture', () => {
expect(collectFiles(expShowFixture)).toStrictEqual([
expect(collectFiles(expShowFixture, [])).toStrictEqual([
'params.yaml',
join('nested', 'params.yaml'),
'summary.json'
Expand All @@ -21,7 +21,7 @@ describe('collectFiles', () => {
}
}

expect(collectFiles(workspace)).toStrictEqual([])
expect(collectFiles(workspace, [])).toStrictEqual([])
})

it('should handle a missing params key', () => {
Expand All @@ -37,7 +37,7 @@ describe('collectFiles', () => {
}
}

expect(collectFiles(workspace)).toStrictEqual(['logs.json'])
expect(collectFiles(workspace, [])).toStrictEqual(['logs.json'])
})

it('should handle a missing metrics key', () => {
Expand All @@ -53,7 +53,7 @@ describe('collectFiles', () => {
}
}

expect(collectFiles(workspace)).toStrictEqual(['params.yaml'])
expect(collectFiles(workspace, [])).toStrictEqual(['params.yaml'])
})

it('should collect all of the available files from a more complex example', () => {
Expand All @@ -76,7 +76,7 @@ describe('collectFiles', () => {
}
} as ExperimentsOutput

expect(collectFiles(workspace).sort()).toStrictEqual([
expect(collectFiles(workspace, []).sort()).toStrictEqual([
'further/nested/params.yaml',
'logs.json',
'metrics.json',
Expand All @@ -85,4 +85,32 @@ describe('collectFiles', () => {
'summary.json'
])
})

it('should not remove a previously collected file if it is deleted (removal breaks live updates logged by dvclive)', () => {
const workspace = {
workspace: {
baseline: {
data: {
executor: 'workspace',
metrics: {},
params: {
'params.yaml': {
data: {
epochs: 100
}
}
},
queued: false,
running: true,
timestamp: null
}
}
}
} as ExperimentsOutput

expect(collectFiles(workspace, ['dvclive.json'])).toStrictEqual([
'params.yaml',
'dvclive.json'
])
})
})
18 changes: 11 additions & 7 deletions extension/src/experiments/data/collect.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { ExperimentsOutput } from '../../cli/reader'

export const collectFiles = (data: ExperimentsOutput): string[] => {
const files = new Set<string>(
Object.keys({
...data?.workspace?.baseline?.data?.params,
...data?.workspace?.baseline?.data?.metrics
}).filter(Boolean)
)
export const collectFiles = (
data: ExperimentsOutput,
existingFiles: string[]
): string[] => {
const files = new Set<string>([
...Object.keys({
...data?.workspace.baseline?.data?.params,
...data?.workspace.baseline?.data?.metrics
}).filter(Boolean),
...existingFiles
])

return [...files]
}
2 changes: 1 addition & 1 deletion extension/src/experiments/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> {
}

public collectFiles(data: ExperimentsOutput) {
return collectFiles(data)
return collectFiles(data, this.collectedFiles)
}

public managedUpdate(path?: string) {
Expand Down