Skip to content

Commit

Permalink
Remove redundant checkpoints code (#5204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored Jan 17, 2024
1 parent 6509e93 commit f3a0be1
Show file tree
Hide file tree
Showing 28 changed files with 35 additions and 585 deletions.
131 changes: 8 additions & 123 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,24 +271,12 @@
"light": "resources/light/queue-experiment.svg"
}
},
{
"title": "Modify Workspace Param(s) and Resume",
"command": "dvc.modifyWorkspaceParamsAndResume",
"category": "DVC",
"icon": "$(debug-continue-small)"
},
{
"title": "Modify Workspace Param(s) and Run",
"command": "dvc.modifyWorkspaceParamsAndRun",
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Modify Workspace Param(s) and Run",
"command": "dvc.modifyWorkspaceParamsResetAndRun",
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Modify Remote",
"command": "dvc.modifyRemote",
Expand Down Expand Up @@ -358,12 +346,6 @@
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Resume Experiment",
"command": "dvc.resumeCheckpointExperiment",
"category": "DVC",
"icon": "$(debug-continue-small)"
},
{
"title": "Start Processing Queued Experiments",
"command": "dvc.startExperimentsQueue",
Expand All @@ -385,12 +367,6 @@
"command": "dvc.removeStudioUrl",
"category": "DVC"
},
{
"title": "Run Experiment",
"command": "dvc.resetAndRunCheckpointExperiment",
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Select for Compare",
"command": "dvc.selectForCompare",
Expand Down Expand Up @@ -557,18 +533,6 @@
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Modify Param(s) and Resume",
"command": "dvc.views.experiments.resumeCheckpointExperiment",
"category": "DVC",
"icon": "$(debug-continue-small)"
},
{
"title": "Modify Param(s) and Run",
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Push",
"command": "dvc.views.experiments.pushExperiment",
Expand Down Expand Up @@ -825,15 +789,7 @@
},
{
"command": "dvc.modifyWorkspaceParamsAndRun",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints"
},
{
"command": "dvc.modifyWorkspaceParamsAndResume",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints"
},
{
"command": "dvc.modifyWorkspaceParamsResetAndRun",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints"
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace"
},
{
"command": "dvc.pushExperiments",
Expand Down Expand Up @@ -885,15 +841,7 @@
},
{
"command": "dvc.runExperiment",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints"
},
{
"command": "dvc.resumeCheckpointExperiment",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints"
},
{
"command": "dvc.resetAndRunCheckpointExperiment",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints"
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace"
},
{
"command": "dvc.startExperimentsQueue",
Expand Down Expand Up @@ -1003,14 +951,6 @@
"command": "dvc.views.experiments.runExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.resumeCheckpointExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.showLogs",
"when": "false"
Expand Down Expand Up @@ -1156,32 +1096,12 @@
{
"command": "dvc.runExperiment",
"group": "navigation@1",
"when": "dvc.experiments.file.active && !dvc.experiment.running.workspace && dvc.commands.available && !dvc.experiment.checkpoints"
"when": "dvc.experiments.file.active && !dvc.experiment.running.workspace && dvc.commands.available"
},
{
"command": "dvc.runExperiment",
"group": "navigation@1",
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available && !dvc.experiment.checkpoints"
},
{
"command": "dvc.resetAndRunCheckpointExperiment",
"group": "navigation@2",
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints"
},
{
"command": "dvc.resetAndRunCheckpointExperiment",
"group": "navigation@2",
"when": "dvc.experiments.file.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints"
},
{
"command": "dvc.resumeCheckpointExperiment",
"group": "navigation@3",
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints"
},
{
"command": "dvc.resumeCheckpointExperiment",
"group": "navigation@3",
"when": "dvc.experiments.file.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints"
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available"
},
{
"command": "dvc.startExperimentsQueue",
Expand Down Expand Up @@ -1308,17 +1228,7 @@
{
"command": "dvc.views.experiments.runExperiment",
"group": "2_modify@1",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == workspace && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints"
},
{
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"group": "2_modify@1",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == workspace && !dvc.experiment.running.workspace && dvc.experiment.checkpoints"
},
{
"command": "dvc.views.experiments.resumeCheckpointExperiment",
"group": "2_modify@2",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == workspace && !dvc.experiment.running.workspace && dvc.experiment.checkpoints"
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == workspace && !dvc.experiment.running.workspace"
},
{
"command": "dvc.views.experiments.queueExperiment",
Expand Down Expand Up @@ -1354,19 +1264,9 @@
},
{
"command": "dvc.runExperiment",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints",
"group": "navigation@1"
},
{
"command": "dvc.resetAndRunCheckpointExperiment",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace",
"group": "navigation@1"
},
{
"command": "dvc.resumeCheckpointExperiment",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints",
"group": "navigation@2"
},
{
"command": "dvc.stopAllRunningExperiments",
"when": "view == dvc.views.experimentsTree && !dvc.experiments.webview.active && dvc.experiment.running",
Expand All @@ -1384,19 +1284,9 @@
},
{
"command": "dvc.modifyWorkspaceParamsAndRun",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints",
"group": "2_modify@1"
},
{
"command": "dvc.modifyWorkspaceParamsAndResume",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace",
"group": "2_modify@1"
},
{
"command": "dvc.modifyWorkspaceParamsResetAndRun",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints",
"group": "2_modify@2"
},
{
"command": "dvc.modifyWorkspaceParamsAndQueue",
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace",
Expand Down Expand Up @@ -1549,12 +1439,7 @@
{
"view": "dvc.views.actions",
"contents": "[$(beaker) Show Experiments](command:dvc.showExperiments)\n[$(graph-scatter) Show Plots](command:dvc.showPlots)\n[$(play) Run Experiment](command:dvc.runExperiment)",
"when": "!dvc.experiment.checkpoints"
},
{
"view": "dvc.views.actions",
"contents": "[$(beaker) Show Experiments](command:dvc.showExperiments)\n[$(graph-scatter) Show Plots](command:dvc.showPlots)\n[$(play) Run Experiment](command:dvc.resetAndRunCheckpointExperiment)",
"when": "dvc.experiment.checkpoints"
"when": "true"
},
{
"view": "dvc.views.studio",
Expand Down
1 change: 0 additions & 1 deletion extension/src/cli/dvc/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export enum QueueSubCommand {
export enum ExperimentFlag {
NO_FETCH = '--no-fetch',
QUEUE = '--queue',
RESET = '--reset',
NUM_COMMIT = '-n',
REV = '--rev'
}
Expand Down
12 changes: 1 addition & 11 deletions extension/src/cli/dvc/runner.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { EventEmitter, Event } from 'vscode'
import {
Args,
Command,
ExperimentFlag,
ExperimentSubCommand
} from './constants'
import { Args, Command, ExperimentSubCommand } from './constants'
import { getOptions } from './options'
import { CliResult, CliStarted, ICli, typeCheckCommands } from '..'
import { getCommandString } from '../command'
Expand All @@ -22,7 +17,6 @@ import {
} from '../util'

export const autoRegisteredCommands = {
EXPERIMENT_RESET_AND_RUN: 'runExperimentReset',
EXPERIMENT_RUN: 'runExperiment'
} as const

Expand Down Expand Up @@ -94,10 +88,6 @@ export class DvcRunner extends Disposable implements ICli {
)
}

public runExperimentReset(dvcRoot: string, ...args: Args) {
return this.runExperiment(dvcRoot, ExperimentFlag.RESET, ...args)
}

public async run(cwd: string, ...args: Args) {
await this.pseudoTerminal.openCurrentInstance()
if (!this.pseudoTerminal.isBlocked()) {
Expand Down
6 changes: 0 additions & 6 deletions extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ export enum RegisteredCliCommands {
EXPERIMENT_PUSH = 'dvc.pushExperiments',
EXPERIMENT_REMOVE = 'dvc.removeExperiments',
EXPERIMENT_REMOVE_QUEUE = 'dvc.removeExperimentQueue',
EXPERIMENT_RESET_AND_RUN = 'dvc.resetAndRunCheckpointExperiment',
EXPERIMENT_RESUME = 'dvc.resumeCheckpointExperiment',
EXPERIMENT_RUN = 'dvc.runExperiment',
QUEUE_EXPERIMENT = 'dvc.queueExperiment',
QUEUE_START = 'dvc.startExperimentsQueue',
Expand All @@ -20,14 +18,10 @@ export enum RegisteredCliCommands {
EXPERIMENT_VIEW_SHOW_LOGS = 'dvc.views.experiments.showLogs',

EXPERIMENT_VIEW_QUEUE = 'dvc.views.experiments.queueExperiment',
EXPERIMENT_VIEW_RESUME = 'dvc.views.experiments.resumeCheckpointExperiment',
EXPERIMENT_VIEW_RUN = 'dvc.views.experiments.runExperiment',
EXPERIMENT_VIEW_RESET_AND_RUN = 'dvc.views.experiments.resetAndRunCheckpointExperiment',

MODIFY_WORKSPACE_PARAMS_AND_QUEUE = 'dvc.modifyWorkspaceParamsAndQueue',
MODIFY_WORKSPACE_PARAMS_AND_RESUME = 'dvc.modifyWorkspaceParamsAndResume',
MODIFY_WORKSPACE_PARAMS_AND_RUN = 'dvc.modifyWorkspaceParamsAndRun',
MODIFY_WORKSPACE_PARAMS_RESET_AND_RUN = 'dvc.modifyWorkspaceParamsResetAndRun',

ADD_TARGET = 'dvc.addTarget',
CHECKOUT = 'dvc.checkout',
Expand Down
53 changes: 2 additions & 51 deletions extension/src/experiments/commands/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,52 +41,15 @@ const registerExperimentCwdCommands = (
experiments.modifyWorkspaceParamsAndQueue(dvcRoot)
)

const modifyWorkspaceParamsAndRun = () =>
experiments.modifyWorkspaceParamsAndRun(AvailableCommands.EXPERIMENT_RUN)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.MODIFY_WORKSPACE_PARAMS_AND_RESUME,
modifyWorkspaceParamsAndRun
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.MODIFY_WORKSPACE_PARAMS_AND_RUN,
modifyWorkspaceParamsAndRun
)

const modifyWorkspaceParamsAndRunFromView = ({
dvcRoot
}: ExperimentDetails) =>
experiments.modifyWorkspaceParamsAndRun(
AvailableCommands.EXPERIMENT_RUN,
dvcRoot
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_VIEW_RESUME,
modifyWorkspaceParamsAndRunFromView
() => experiments.modifyWorkspaceParamsAndRun()
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_VIEW_RUN,
modifyWorkspaceParamsAndRunFromView
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.MODIFY_WORKSPACE_PARAMS_RESET_AND_RUN,
() =>
experiments.modifyWorkspaceParamsAndRun(
AvailableCommands.EXPERIMENT_RESET_AND_RUN
)
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_VIEW_RESET_AND_RUN,
({ dvcRoot }: ExperimentDetails) =>
experiments.modifyWorkspaceParamsAndRun(
AvailableCommands.EXPERIMENT_RESET_AND_RUN,
dvcRoot
)
experiments.modifyWorkspaceParamsAndRun(dvcRoot)
)

internalCommands.registerExternalCliCommand(
Expand Down Expand Up @@ -240,18 +203,6 @@ const registerExperimentRunCommands = (
)
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_RESUME,
() => experiments.getCwdThenRun(AvailableCommands.EXPERIMENT_RUN)
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_RESET_AND_RUN,
showSetupOrExecuteCommand(setup, () =>
experiments.getCwdThenRun(AvailableCommands.EXPERIMENT_RESET_AND_RUN)
)
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.QUEUE_START,
() =>
Expand Down
Loading

0 comments on commit f3a0be1

Please sign in to comment.