Skip to content

Commit

Permalink
remove checkpoint model and file system watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Apr 17, 2023
1 parent ead10f9 commit cd43a2d
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 513 deletions.
117 changes: 0 additions & 117 deletions extension/src/experiments/checkpoints/collect.test.ts

This file was deleted.

22 changes: 0 additions & 22 deletions extension/src/experiments/checkpoints/collect.ts

This file was deleted.

59 changes: 0 additions & 59 deletions extension/src/experiments/checkpoints/model.test.ts

This file was deleted.

21 changes: 0 additions & 21 deletions extension/src/experiments/checkpoints/model.ts

This file was deleted.

42 changes: 20 additions & 22 deletions extension/src/experiments/data/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path'
import { EventEmitter } from 'vscode'
import { Event, EventEmitter } from 'vscode'
import { collectFiles } from './collect'
import {
EXPERIMENTS_GIT_LOGS_REFS,
Expand All @@ -19,8 +19,14 @@ import { ExperimentsModel } from '../model'
export const QUEUED_EXPERIMENT_PATH = join(DOT_DVC, 'tmp', 'exps')

export class ExperimentsData extends BaseData<ExpShowOutput> {
public readonly onDidChangeDvcYaml: Event<void>

private readonly experiments: ExperimentsModel

private readonly dvcYamlChanged: EventEmitter<void> = this.dispose.track(
new EventEmitter<void>()
)

constructor(
dvcRoot: string,
internalCommands: InternalCommands,
Expand All @@ -31,34 +37,23 @@ export class ExperimentsData extends BaseData<ExpShowOutput> {
dvcRoot,
internalCommands,
updatesPaused,
[
{
name: 'partialUpdate',
process: () => this.update(ExperimentFlag.NO_FETCH)
},
{ name: 'fullUpdate', process: () => this.update() }
],
[{ name: 'update', process: () => this.update() }],
['dvc.lock', 'dvc.yaml', 'params.yaml', DOT_DVC]
)

this.experiments = experiments

this.onDidChangeDvcYaml = this.dvcYamlChanged.event

void this.watchExpGitRefs()
void this.managedUpdate(QUEUED_EXPERIMENT_PATH)
void this.managedUpdate()
}

public managedUpdate(path?: string) {
if (
path?.includes(QUEUED_EXPERIMENT_PATH) ||
this.processManager.isOngoingOrQueued('fullUpdate')
) {
return this.processManager.run('fullUpdate')
}

return this.processManager.run('partialUpdate')
public managedUpdate() {
return this.processManager.run('update')
}

public async update(...args: (ExperimentFlag | string)[]): Promise<void> {
public async update(): Promise<void> {
const flags = this.experiments.getIsBranchesView()
? [ExperimentFlag.ALL_BRANCHES]
: [
Expand All @@ -68,8 +63,7 @@ export class ExperimentsData extends BaseData<ExpShowOutput> {
const data = await this.internalCommands.executeCommand<ExpShowOutput>(
AvailableCommands.EXP_SHOW,
this.dvcRoot,
...flags,
...args
...flags
)

this.collectFiles(data)
Expand Down Expand Up @@ -103,10 +97,14 @@ export class ExperimentsData extends BaseData<ExpShowOutput> {
return
}

if (path.endsWith('dvc.yaml')) {
this.dvcYamlChanged.fire()
}

if (
watchedRelPaths.some(watchedRelPath => path.includes(watchedRelPath))
) {
return this.managedUpdate(path)
return this.managedUpdate()
}
}
)
Expand Down
Loading

0 comments on commit cd43a2d

Please sign in to comment.