Skip to content

Commit c4b18e9

Browse files
authored
Bump min version of DVC to 2.58.1 (Enable live plots for experiments running outside of the workspace) (#3965)
* rework plotting of running experiments * remove more dead code
1 parent ff0979c commit c4b18e9

File tree

12 files changed

+57
-644
lines changed

12 files changed

+57
-644
lines changed

extension/src/cli/dvc/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Plot } from '../../plots/webview/contract'
22

3-
export const MIN_CLI_VERSION = '2.57.0'
3+
export const MIN_CLI_VERSION = '2.58.1'
44
export const LATEST_TESTED_CLI_VERSION = '2.58.1'
55
export const MAX_CLI_VERSION = '3'
66

extension/src/experiments/index.ts

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,13 @@ import {
2121
pickFiltersToRemove
2222
} from './model/filterBy/quickPick'
2323
import { Color } from './model/status/colors'
24-
import {
25-
FetchedExperiment,
26-
hasFinishedWorkspaceExperiment
27-
} from './model/status/collect'
2824
import { UNSELECTED } from './model/status'
2925
import { starredSort } from './model/sortBy/constants'
3026
import { pickSortsToRemove, pickSortToAdd } from './model/sortBy/quickPick'
3127
import { ColumnsModel } from './columns/model'
3228
import { ExperimentsData } from './data'
3329
import { stopWorkspaceExperiment } from './processExecution'
34-
import {
35-
Experiment,
36-
ColumnType,
37-
TableData,
38-
isRunning
39-
} from './webview/contract'
30+
import { Experiment, ColumnType, TableData } from './webview/contract'
4031
import { WebviewMessages } from './webview/messages'
4132
import { DecorationProvider } from './model/decorationProvider'
4233
import { starredFilter } from './model/filterBy/constants'
@@ -227,17 +218,6 @@ export class Experiments extends BaseRepository<TableData> {
227218
return status
228219
}
229220

230-
public checkForFinishedWorkspaceExperiment(
231-
fetchedExperiments: FetchedExperiment[]
232-
) {
233-
if (!hasFinishedWorkspaceExperiment(fetchedExperiments)) {
234-
return
235-
}
236-
237-
this.experiments.unselectWorkspace()
238-
this.notifyChanged()
239-
}
240-
241221
public getSorts() {
242222
return this.experiments.getSorts()
243223
}
@@ -345,9 +325,7 @@ export class Experiments extends BaseRepository<TableData> {
345325
}
346326

347327
public async selectExperimentsToPlot() {
348-
const experiments = this.experiments
349-
.getWorkspaceCommitsAndExperiments()
350-
.filter(({ status }) => !isRunning(status))
328+
const experiments = this.experiments.getWorkspaceCommitsAndExperiments()
351329

352330
const selected = await pickExperimentsToPlot(
353331
experiments,
@@ -439,14 +417,6 @@ export class Experiments extends BaseRepository<TableData> {
439417
return this.experiments.getSelectedRevisions()
440418
}
441419

442-
public setRevisionCollected(revisions: string[]) {
443-
this.experiments.setRevisionCollected(revisions)
444-
}
445-
446-
public getFinishedExperiments() {
447-
return this.experiments.getFinishedExperiments()
448-
}
449-
450420
public getExperiments() {
451421
return this.experiments.getExperiments()
452422
}

extension/src/experiments/model/collect.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ const setWorkspaceAsRunning = (
300300
) {
301301
acc.workspace.executor = Executor.WORKSPACE
302302
acc.workspace.status = ExperimentStatus.RUNNING
303+
}
304+
305+
if (dvcLiveOnly) {
303306
acc.runningExperiments.unshift({
304307
executor: Executor.WORKSPACE,
305308
id: EXPERIMENT_WORKSPACE_ID

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ describe('ExperimentsModel', () => {
221221
expect(experimentsModel.getSelectedRevisions()).toHaveLength(7)
222222
})
223223

224-
it('should swap an experiment running in the workspace for the workspace and not select an experiment running in the queue', () => {
224+
it('should not swap an experiment running in the workspace for the workspace and not prevent selection of an experiment running in the queue', () => {
225225
const params = {
226226
params: {
227227
'params.yaml': {
@@ -231,6 +231,9 @@ describe('ExperimentsModel', () => {
231231
}
232232
}
233233
}
234+
const runningExpName = 'selectable-nuffy'
235+
const runningTaskName = 'selectable-task'
236+
234237
const data = generateTestExpShowOutput(
235238
{},
236239
{
@@ -242,7 +245,7 @@ describe('ExperimentsModel', () => {
242245
name: Executor.WORKSPACE,
243246
state: ExperimentStatus.RUNNING
244247
},
245-
name: 'unselectable-nuffy',
248+
name: runningExpName,
246249
rev: EXPERIMENT_WORKSPACE_ID
247250
},
248251
{},
@@ -255,7 +258,7 @@ describe('ExperimentsModel', () => {
255258
name: Executor.DVC_TASK,
256259
state: ExperimentStatus.RUNNING
257260
},
258-
name: 'unselectable-task',
261+
name: runningTaskName,
259262
rev: EXPERIMENT_WORKSPACE_ID
260263
}
261264
],
@@ -267,7 +270,7 @@ describe('ExperimentsModel', () => {
267270
model.transformAndSet(data, false, '')
268271

269272
expect(model.getSelectedRevisions().map(({ id }) => id)).toStrictEqual([
270-
EXPERIMENT_WORKSPACE_ID
273+
runningExpName
271274
])
272275

273276
model.setSelected([])
@@ -277,9 +280,11 @@ describe('ExperimentsModel', () => {
277280
expect(model.getSelectedRevisions().map(({ id }) => id)).toStrictEqual([
278281
EXPERIMENT_WORKSPACE_ID,
279282
'testBranch',
283+
runningExpName,
280284
'exp-2',
281285
'exp-3',
282-
'exp-4'
286+
'exp-4',
287+
runningTaskName
283288
])
284289
})
285290

extension/src/experiments/model/index.ts

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
} from './collect'
1010
import {
1111
collectColoredStatus,
12-
collectFinishedRunningExperiments,
1312
collectSelectable,
1413
collectSelectedColors,
1514
collectStartedRunningExperiments
@@ -21,12 +20,10 @@ import {
2120
Experiment,
2221
isQueued,
2322
isRunning,
24-
isRunningInQueue,
2523
RunningExperiment
2624
} from '../webview/contract'
2725
import { definedAndNonEmpty, reorderListSubset } from '../../util/array'
2826
import {
29-
EXPERIMENT_WORKSPACE_ID,
3027
Executor,
3128
ExpShowOutput,
3229
ExperimentStatus
@@ -68,7 +65,6 @@ export class ExperimentsModel extends ModelWithPersistence {
6865

6966
private currentSorts: SortDefinition[]
7067
private running: RunningExperiment[] = []
71-
private finishedRunning: { [id: string]: string } = {}
7268
private startedRunning: Set<string> = new Set()
7369

7470
constructor(dvcRoot: string, workspaceState: Memento) {
@@ -146,10 +142,6 @@ export class ExperimentsModel extends ModelWithPersistence {
146142
({ id: expId }) => expId === id
147143
)
148144

149-
if (experiment && isRunning(experiment.status)) {
150-
return this.preventSelectionOfRunningExperiment(experiment)
151-
}
152-
153145
if (isQueued(experiment?.status)) {
154146
return UNSELECTED
155147
}
@@ -166,10 +158,6 @@ export class ExperimentsModel extends ModelWithPersistence {
166158
return this.coloredStatus[id]
167159
}
168160

169-
public unselectWorkspace() {
170-
this.coloredStatus[EXPERIMENT_WORKSPACE_ID] = UNSELECTED
171-
}
172-
173161
public hasRunningExperiment() {
174162
return this.running.length > 0
175163
}
@@ -182,16 +170,6 @@ export class ExperimentsModel extends ModelWithPersistence {
182170
return this.checkpoints
183171
}
184172

185-
public setRevisionCollected(revisions: string[]) {
186-
for (const { id } of this.getExperimentsAndQueued().filter(({ label }) =>
187-
revisions.includes(label)
188-
)) {
189-
if (this.finishedRunning[id]) {
190-
delete this.finishedRunning[id]
191-
}
192-
}
193-
}
194-
195173
public canSelect() {
196174
return canSelect(this.coloredStatus)
197175
}
@@ -270,9 +248,7 @@ export class ExperimentsModel extends ModelWithPersistence {
270248
}
271249

272250
public setSelected(selectedExperiments: Experiment[]) {
273-
const possibleToSelect = collectSelectable(selectedExperiments, {
274-
...this.workspace
275-
})
251+
const possibleToSelect = collectSelectable(selectedExperiments)
276252

277253
const { availableColors, coloredStatus } = collectSelectedColors(
278254
possibleToSelect,
@@ -432,10 +408,6 @@ export class ExperimentsModel extends ModelWithPersistence {
432408
}))
433409
}
434410

435-
public getFinishedExperiments() {
436-
return this.finishedRunning
437-
}
438-
439411
public setNbfCommitsToShow(numberOfCommitsToShow: number, branch: string) {
440412
this.numberOfCommitsToShow[branch] = numberOfCommitsToShow
441413
this.persistNbOfCommitsToShow()
@@ -524,8 +496,7 @@ export class ExperimentsModel extends ModelWithPersistence {
524496
this.experimentsByCommit,
525497
this.coloredStatus,
526498
this.availableColors,
527-
this.startedRunning,
528-
this.finishedRunning
499+
this.startedRunning
529500
)
530501
this.startedRunning = new Set()
531502

@@ -540,14 +511,6 @@ export class ExperimentsModel extends ModelWithPersistence {
540511
stillRunning
541512
)
542513

543-
this.finishedRunning = collectFinishedRunningExperiments(
544-
{ ...this.finishedRunning },
545-
this.getExperimentsAndQueued(),
546-
this.running,
547-
stillRunning,
548-
this.coloredStatus
549-
)
550-
551514
this.running = stillRunning
552515
}
553516

@@ -568,24 +531,6 @@ export class ExperimentsModel extends ModelWithPersistence {
568531
)
569532
}
570533

571-
private preventSelectionOfRunningExperiment(
572-
experiment: Experiment
573-
): Color | undefined | typeof UNSELECTED {
574-
if (isRunningInQueue(experiment)) {
575-
return UNSELECTED
576-
}
577-
578-
const { executor, id } = experiment
579-
if (
580-
executor === Executor.WORKSPACE &&
581-
id !== EXPERIMENT_WORKSPACE_ID &&
582-
!this.isSelected(id) &&
583-
!this.isSelected(EXPERIMENT_WORKSPACE_ID)
584-
) {
585-
return this.toggleStatus(EXPERIMENT_WORKSPACE_ID)
586-
}
587-
}
588-
589534
private persistSorts() {
590535
return this.persist(PersistenceKey.EXPERIMENTS_SORT_BY, this.currentSorts)
591536
}

0 commit comments

Comments
 (0)