Skip to content

Commit 4dd8012

Browse files
authored
Remove checkpoints from plots (#3624)
1 parent c0f48cf commit 4dd8012

File tree

17 files changed

+210
-943
lines changed

17 files changed

+210
-943
lines changed

extension/src/experiments/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,6 @@ export class Experiments extends BaseRepository<TableData> {
419419
return this.experiments.getWorkspaceAndCommits()
420420
}
421421

422-
public getCheckpoints(id: string) {
423-
return this.experiments.getCheckpointsWithType(id)
424-
}
425-
426422
public getCommitExperiments(commit: Experiment) {
427423
return this.experiments.getExperimentsByCommitForTree(commit)
428424
}
@@ -443,6 +439,10 @@ export class Experiments extends BaseRepository<TableData> {
443439
return this.experiments.getCommitRevisions()
444440
}
445441

442+
public getExperimentRevisions() {
443+
return this.experiments.getExperimentRevisions()
444+
}
445+
446446
public getFinishedExperiments() {
447447
return this.experiments.getFinishedExperiments()
448448
}
@@ -591,7 +591,7 @@ export class Experiments extends BaseRepository<TableData> {
591591
}
592592

593593
const experiment = await pickExperiment(
594-
this.experiments.getAllRecords(),
594+
this.experiments.getCombinedList(),
595595
this.getFirstThreeColumnOrder(),
596596
Title.SELECT_BASE_EXPERIMENT
597597
)

extension/src/experiments/model/index.test.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,21 @@ beforeEach(() => {
3333
describe('ExperimentsModel', () => {
3434
const runningExperiment = 'exp-12345'
3535

36-
const buildTestExperiment = (
37-
testParam: number,
38-
checkpoint_tip?: string,
39-
name?: string
40-
) => {
36+
const buildTestExperiment = (testParam: number, name?: string) => {
4137
const data = {
4238
params: {
4339
'params.yaml': {
4440
data: { test: testParam }
4541
}
4642
}
4743
} as {
48-
checkpoint_tip?: string
4944
name?: string
5045
params: {
5146
'params.yaml': {
5247
data: { test: number }
5348
}
5449
}
5550
}
56-
if (checkpoint_tip) {
57-
data.checkpoint_tip = checkpoint_tip
58-
}
5951
if (name) {
6052
data.name = name
6153
}
@@ -201,7 +193,7 @@ describe('ExperimentsModel', () => {
201193
''
202194
)
203195

204-
const experiments = model.getAllRecords()
196+
const experiments = model.getCombinedList()
205197

206198
const changed: string[] = []
207199
for (const { deps, sha } of experiments) {
@@ -241,13 +233,13 @@ describe('ExperimentsModel', () => {
241233
experimentsModel.transformAndSet(
242234
{
243235
testBranch: {
244-
baseline: buildTestExperiment(2, undefined, 'testBranch'),
245-
exp1: buildTestExperiment(0, 'tip'),
246-
exp2: buildTestExperiment(0, 'tip'),
247-
exp3: buildTestExperiment(0, 'tip'),
248-
exp4: buildTestExperiment(0, 'tip'),
249-
exp5: buildTestExperiment(0, 'tip'),
250-
tip: buildTestExperiment(0, 'tip', runningExperiment)
236+
baseline: buildTestExperiment(2, 'testBranch'),
237+
exp1: buildTestExperiment(0),
238+
exp2: buildTestExperiment(0),
239+
exp3: buildTestExperiment(0),
240+
exp4: buildTestExperiment(0),
241+
exp5: buildTestExperiment(0),
242+
tip: buildTestExperiment(0, runningExperiment)
251243
},
252244
[EXPERIMENT_WORKSPACE_ID]: {
253245
baseline: buildTestExperiment(3)

extension/src/experiments/model/index.ts

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ export enum ExperimentType {
4949
WORKSPACE = 'workspace',
5050
COMMIT = 'commit',
5151
EXPERIMENT = 'experiment',
52-
CHECKPOINT = 'checkpoint',
5352
QUEUED = 'queued'
5453
}
5554

5655
export class ExperimentsModel extends ModelWithPersistence {
5756
private workspace = {} as Experiment
5857
private commits: Experiment[] = []
5958
private experimentsByCommit: Map<string, Experiment[]> = new Map()
60-
private checkpointsByTip: Map<string, Experiment[]> = new Map()
6159
private availableColors: Color[]
6260
private coloredStatus: ColoredStatus
6361
private starredExperiments: StarredExperiments
@@ -113,18 +111,12 @@ export class ExperimentsModel extends ModelWithPersistence {
113111
dvcLiveOnly: boolean,
114112
commitsOutput: string
115113
) {
116-
const {
117-
workspace,
118-
commits,
119-
experimentsByCommit,
120-
checkpointsByTip,
121-
runningExperiments
122-
} = collectExperiments(data, dvcLiveOnly, commitsOutput)
114+
const { workspace, commits, experimentsByCommit, runningExperiments } =
115+
collectExperiments(data, dvcLiveOnly, commitsOutput)
123116

124117
this.workspace = workspace
125118
this.commits = commits
126119
this.experimentsByCommit = experimentsByCommit
127-
this.checkpointsByTip = checkpointsByTip
128120

129121
this.setColoredStatus(runningExperiments)
130122
}
@@ -243,6 +235,10 @@ export class ExperimentsModel extends ModelWithPersistence {
243235
return this.commits.map(({ id, sha }) => ({ id, sha }))
244236
}
245237

238+
public getExperimentRevisions() {
239+
return this.getExperiments().map(({ id, label }) => ({ id, label }))
240+
}
241+
246242
public getRevisions() {
247243
return this.getCombinedList().map(({ label }) => label)
248244
}
@@ -262,7 +258,7 @@ export class ExperimentsModel extends ModelWithPersistence {
262258

263259
const { availableColors, coloredStatus } = collectSelected(
264260
selectedExperiments.filter(({ status }) => !isQueued(status)),
265-
this.getCombinedList(),
261+
this.getWorkspaceCommitsAndExperiments(),
266262
this.coloredStatus,
267263
this.availableColors
268264
)
@@ -299,10 +295,6 @@ export class ExperimentsModel extends ModelWithPersistence {
299295
]
300296
}
301297

302-
public getAllRecords() {
303-
return [...this.getWorkspaceAndCommits(), ...this.getExperimentsAndQueued()]
304-
}
305-
306298
public getWorkspaceCommitsAndExperiments() {
307299
return [...this.getWorkspaceAndCommits(), ...this.getExperiments()]
308300
}
@@ -316,7 +308,7 @@ export class ExperimentsModel extends ModelWithPersistence {
316308
}
317309

318310
public getExperimentParams(id: string) {
319-
const params = this.getAllRecords().find(
311+
const params = this.getCombinedList().find(
320312
experiment => experiment.id === id
321313
)?.params
322314

@@ -341,15 +333,6 @@ export class ExperimentsModel extends ModelWithPersistence {
341333
)
342334
}
343335

344-
public getCheckpointsWithType(
345-
id: string
346-
): (Experiment & { type: ExperimentType })[] | undefined {
347-
return this.checkpointsByTip.get(id)?.map(checkpoint => ({
348-
...this.addDetails(checkpoint),
349-
type: ExperimentType.CHECKPOINT
350-
}))
351-
}
352-
353336
public getRowData() {
354337
return [
355338
this.addDetails(this.workspace),
@@ -390,12 +373,7 @@ export class ExperimentsModel extends ModelWithPersistence {
390373
}
391374

392375
public getCombinedList() {
393-
return [
394-
this.workspace,
395-
...this.commits,
396-
...this.getExperimentsAndQueued(),
397-
...this.getFlattenedCheckpoints()
398-
]
376+
return [this.workspace, ...this.commits, ...this.getExperimentsAndQueued()]
399377
}
400378

401379
public getExperimentsByCommitForTree(commit: Experiment) {
@@ -455,12 +433,6 @@ export class ExperimentsModel extends ModelWithPersistence {
455433
return sortExperiments(this.getSorts(), experiments)
456434
}
457435

458-
private getFlattenedCheckpoints() {
459-
return flattenMapValues(this.checkpointsByTip).map(checkpoint =>
460-
this.addDetails(checkpoint)
461-
)
462-
}
463-
464436
private setColoredStatus(runningExperiments: RunningExperiment[]) {
465437
this.setRunning(runningExperiments)
466438

0 commit comments

Comments
 (0)