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

Bump min version of DVC to 2.58.1 (Enable live plots for experiments running outside of the workspace) #3965

Merged
merged 2 commits into from
May 28, 2023
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/contract.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Plot } from '../../plots/webview/contract'

export const MIN_CLI_VERSION = '2.57.0'
export const MIN_CLI_VERSION = '2.58.1'
export const LATEST_TESTED_CLI_VERSION = '2.58.1'
export const MAX_CLI_VERSION = '3'

Expand Down
34 changes: 2 additions & 32 deletions extension/src/experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,13 @@ import {
pickFiltersToRemove
} from './model/filterBy/quickPick'
import { Color } from './model/status/colors'
import {
FetchedExperiment,
hasFinishedWorkspaceExperiment
} from './model/status/collect'
import { UNSELECTED } from './model/status'
import { starredSort } from './model/sortBy/constants'
import { pickSortsToRemove, pickSortToAdd } from './model/sortBy/quickPick'
import { ColumnsModel } from './columns/model'
import { ExperimentsData } from './data'
import { stopWorkspaceExperiment } from './processExecution'
import {
Experiment,
ColumnType,
TableData,
isRunning
} from './webview/contract'
import { Experiment, ColumnType, TableData } from './webview/contract'
import { WebviewMessages } from './webview/messages'
import { DecorationProvider } from './model/decorationProvider'
import { starredFilter } from './model/filterBy/constants'
Expand Down Expand Up @@ -227,17 +218,6 @@ export class Experiments extends BaseRepository<TableData> {
return status
}

public checkForFinishedWorkspaceExperiment(
fetchedExperiments: FetchedExperiment[]
) {
if (!hasFinishedWorkspaceExperiment(fetchedExperiments)) {
return
}

this.experiments.unselectWorkspace()
this.notifyChanged()
}

public getSorts() {
return this.experiments.getSorts()
}
Expand Down Expand Up @@ -345,9 +325,7 @@ export class Experiments extends BaseRepository<TableData> {
}

public async selectExperimentsToPlot() {
const experiments = this.experiments
.getWorkspaceCommitsAndExperiments()
.filter(({ status }) => !isRunning(status))
const experiments = this.experiments.getWorkspaceCommitsAndExperiments()

const selected = await pickExperimentsToPlot(
experiments,
Expand Down Expand Up @@ -439,14 +417,6 @@ export class Experiments extends BaseRepository<TableData> {
return this.experiments.getSelectedRevisions()
}

public setRevisionCollected(revisions: string[]) {
this.experiments.setRevisionCollected(revisions)
}

public getFinishedExperiments() {
return this.experiments.getFinishedExperiments()
}

public getExperiments() {
return this.experiments.getExperiments()
}
Expand Down
3 changes: 3 additions & 0 deletions extension/src/experiments/model/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ const setWorkspaceAsRunning = (
) {
acc.workspace.executor = Executor.WORKSPACE
acc.workspace.status = ExperimentStatus.RUNNING
}

if (dvcLiveOnly) {
acc.runningExperiments.unshift({
executor: Executor.WORKSPACE,
id: EXPERIMENT_WORKSPACE_ID
Expand Down
15 changes: 10 additions & 5 deletions extension/src/experiments/model/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('ExperimentsModel', () => {
expect(experimentsModel.getSelectedRevisions()).toHaveLength(7)
})

it('should swap an experiment running in the workspace for the workspace and not select an experiment running in the queue', () => {
it('should not swap an experiment running in the workspace for the workspace and not prevent selection of an experiment running in the queue', () => {
const params = {
params: {
'params.yaml': {
Expand All @@ -231,6 +231,9 @@ describe('ExperimentsModel', () => {
}
}
}
const runningExpName = 'selectable-nuffy'
const runningTaskName = 'selectable-task'

const data = generateTestExpShowOutput(
{},
{
Expand All @@ -242,7 +245,7 @@ describe('ExperimentsModel', () => {
name: Executor.WORKSPACE,
state: ExperimentStatus.RUNNING
},
name: 'unselectable-nuffy',
name: runningExpName,
rev: EXPERIMENT_WORKSPACE_ID
},
{},
Expand All @@ -255,7 +258,7 @@ describe('ExperimentsModel', () => {
name: Executor.DVC_TASK,
state: ExperimentStatus.RUNNING
},
name: 'unselectable-task',
name: runningTaskName,
rev: EXPERIMENT_WORKSPACE_ID
}
],
Expand All @@ -267,7 +270,7 @@ describe('ExperimentsModel', () => {
model.transformAndSet(data, false, '')

expect(model.getSelectedRevisions().map(({ id }) => id)).toStrictEqual([
EXPERIMENT_WORKSPACE_ID
runningExpName
])

model.setSelected([])
Expand All @@ -277,9 +280,11 @@ describe('ExperimentsModel', () => {
expect(model.getSelectedRevisions().map(({ id }) => id)).toStrictEqual([
EXPERIMENT_WORKSPACE_ID,
'testBranch',
runningExpName,
'exp-2',
'exp-3',
'exp-4'
'exp-4',
runningTaskName
])
})

Expand Down
59 changes: 2 additions & 57 deletions extension/src/experiments/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from './collect'
import {
collectColoredStatus,
collectFinishedRunningExperiments,
collectSelectable,
collectSelectedColors,
collectStartedRunningExperiments
Expand All @@ -21,12 +20,10 @@ import {
Experiment,
isQueued,
isRunning,
isRunningInQueue,
RunningExperiment
} from '../webview/contract'
import { definedAndNonEmpty, reorderListSubset } from '../../util/array'
import {
EXPERIMENT_WORKSPACE_ID,
Executor,
ExpShowOutput,
ExperimentStatus
Expand Down Expand Up @@ -68,7 +65,6 @@ export class ExperimentsModel extends ModelWithPersistence {

private currentSorts: SortDefinition[]
private running: RunningExperiment[] = []
private finishedRunning: { [id: string]: string } = {}
private startedRunning: Set<string> = new Set()

constructor(dvcRoot: string, workspaceState: Memento) {
Expand Down Expand Up @@ -146,10 +142,6 @@ export class ExperimentsModel extends ModelWithPersistence {
({ id: expId }) => expId === id
)

if (experiment && isRunning(experiment.status)) {
return this.preventSelectionOfRunningExperiment(experiment)
}

if (isQueued(experiment?.status)) {
return UNSELECTED
}
Expand All @@ -166,10 +158,6 @@ export class ExperimentsModel extends ModelWithPersistence {
return this.coloredStatus[id]
}

public unselectWorkspace() {
this.coloredStatus[EXPERIMENT_WORKSPACE_ID] = UNSELECTED
}

public hasRunningExperiment() {
return this.running.length > 0
}
Expand All @@ -182,16 +170,6 @@ export class ExperimentsModel extends ModelWithPersistence {
return this.checkpoints
}

public setRevisionCollected(revisions: string[]) {
for (const { id } of this.getExperimentsAndQueued().filter(({ label }) =>
revisions.includes(label)
)) {
if (this.finishedRunning[id]) {
delete this.finishedRunning[id]
}
}
}

public canSelect() {
return canSelect(this.coloredStatus)
}
Expand Down Expand Up @@ -270,9 +248,7 @@ export class ExperimentsModel extends ModelWithPersistence {
}

public setSelected(selectedExperiments: Experiment[]) {
const possibleToSelect = collectSelectable(selectedExperiments, {
...this.workspace
})
const possibleToSelect = collectSelectable(selectedExperiments)

const { availableColors, coloredStatus } = collectSelectedColors(
possibleToSelect,
Expand Down Expand Up @@ -432,10 +408,6 @@ export class ExperimentsModel extends ModelWithPersistence {
}))
}

public getFinishedExperiments() {
return this.finishedRunning
}

public setNbfCommitsToShow(numberOfCommitsToShow: number, branch: string) {
this.numberOfCommitsToShow[branch] = numberOfCommitsToShow
this.persistNbOfCommitsToShow()
Expand Down Expand Up @@ -524,8 +496,7 @@ export class ExperimentsModel extends ModelWithPersistence {
this.experimentsByCommit,
this.coloredStatus,
this.availableColors,
this.startedRunning,
this.finishedRunning
this.startedRunning
)
this.startedRunning = new Set()

Expand All @@ -540,14 +511,6 @@ export class ExperimentsModel extends ModelWithPersistence {
stillRunning
)

this.finishedRunning = collectFinishedRunningExperiments(
{ ...this.finishedRunning },
this.getExperimentsAndQueued(),
this.running,
stillRunning,
this.coloredStatus
)

this.running = stillRunning
}

Expand All @@ -568,24 +531,6 @@ export class ExperimentsModel extends ModelWithPersistence {
)
}

private preventSelectionOfRunningExperiment(
experiment: Experiment
): Color | undefined | typeof UNSELECTED {
if (isRunningInQueue(experiment)) {
return UNSELECTED
}

const { executor, id } = experiment
if (
executor === Executor.WORKSPACE &&
id !== EXPERIMENT_WORKSPACE_ID &&
!this.isSelected(id) &&
!this.isSelected(EXPERIMENT_WORKSPACE_ID)
) {
return this.toggleStatus(EXPERIMENT_WORKSPACE_ID)
}
}

private persistSorts() {
return this.persist(PersistenceKey.EXPERIMENTS_SORT_BY, this.currentSorts)
}
Expand Down
Loading