-
Notifications
You must be signed in to change notification settings - Fork 29
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
Enable experiment operations when experiment(s) are running in the queue #3832
Changes from all commits
7a2270e
ed25fc6
2c9eb22
1b21bed
c37f388
fca9961
2f63386
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -664,11 +664,11 @@ | |
}, | ||
{ | ||
"command": "dvc.applyExperiment", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.branchExperiment", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.checkout", | ||
|
@@ -708,7 +708,7 @@ | |
}, | ||
{ | ||
"command": "dvc.experimentGarbageCollect", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.findInFolder", | ||
|
@@ -752,35 +752,35 @@ | |
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsAndQueue", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsAndRun", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running && !dvc.experiment.checkpoints" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsAndResume", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running && dvc.experiment.checkpoints" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsResetAndRun", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running && dvc.experiment.checkpoints" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.pushExperiments", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.queueExperiment", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.removeExperiments", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.removeExperimentQueue", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.removeExperimentsTableFilters", | ||
|
@@ -808,15 +808,15 @@ | |
}, | ||
{ | ||
"command": "dvc.runExperiment", | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running && !dvc.experiment.checkpoints" | ||
"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 && dvc.experiment.checkpoints" | ||
"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 && dvc.experiment.checkpoints" | ||
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running.workspace && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.startExperimentsQueue", | ||
|
@@ -1029,59 +1029,64 @@ | |
], | ||
"editor/title": [ | ||
{ | ||
"command": "dvc.runExperiment", | ||
"command": "dvc.stopAllRunningExperiments", | ||
"group": "navigation@0", | ||
"when": "dvc.params.file.active && !dvc.experiment.running && dvc.commands.available && !dvc.experiment.checkpoints" | ||
"when": "dvc.params.file.active && dvc.experiment.running && dvc.commands.available" | ||
}, | ||
{ | ||
"command": "dvc.runExperiment", | ||
"command": "dvc.stopAllRunningExperiments", | ||
"group": "navigation@0", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running && dvc.commands.available && !dvc.experiment.checkpoints" | ||
"when": "dvc.experiments.webview.active && dvc.experiment.running && dvc.commands.available" | ||
}, | ||
{ | ||
"command": "dvc.stopAllRunningExperiments", | ||
"group": "navigation@0", | ||
"when": "dvc.experiment.running && dvc.commands.available" | ||
"command": "dvc.runExperiment", | ||
"group": "navigation@1", | ||
"when": "dvc.params.file.active && !dvc.experiment.running.workspace && dvc.commands.available && !dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.resetAndRunCheckpointExperiment", | ||
"command": "dvc.runExperiment", | ||
"group": "navigation@1", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running && dvc.commands.available && dvc.experiment.checkpoints" | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available && !dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.resetAndRunCheckpointExperiment", | ||
"group": "navigation@1", | ||
"when": "dvc.params.file.active && !dvc.experiment.running && dvc.commands.available && dvc.experiment.checkpoints" | ||
"group": "navigation@2", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.resumeCheckpointExperiment", | ||
"command": "dvc.resetAndRunCheckpointExperiment", | ||
"group": "navigation@2", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running && dvc.commands.available && dvc.experiment.checkpoints" | ||
"when": "dvc.params.file.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.resumeCheckpointExperiment", | ||
"group": "navigation@2", | ||
"when": "dvc.params.file.active && !dvc.experiment.running && dvc.commands.available && dvc.experiment.checkpoints" | ||
"group": "navigation@3", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.startExperimentsQueue", | ||
"command": "dvc.resumeCheckpointExperiment", | ||
"group": "navigation@3", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running && dvc.commands.available" | ||
"when": "dvc.params.file.active && !dvc.experiment.running.workspace && dvc.commands.available && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.startExperimentsQueue", | ||
"group": "navigation@3", | ||
"when": "dvc.params.file.active && !dvc.experiment.running && dvc.commands.available" | ||
"group": "navigation@4", | ||
"when": "dvc.experiments.webview.active && dvc.commands.available" | ||
}, | ||
{ | ||
"command": "dvc.queueExperiment", | ||
"command": "dvc.startExperimentsQueue", | ||
"group": "navigation@4", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running && dvc.commands.available" | ||
"when": "dvc.params.file.active && dvc.commands.available" | ||
}, | ||
{ | ||
"command": "dvc.queueExperiment", | ||
"group": "navigation@4", | ||
"when": "dvc.params.file.active && !dvc.experiment.running && dvc.commands.available" | ||
"group": "navigation@5", | ||
"when": "dvc.experiments.webview.active && !dvc.experiment.running.workspace && dvc.commands.available" | ||
}, | ||
{ | ||
"command": "dvc.queueExperiment", | ||
"group": "navigation@5", | ||
"when": "dvc.params.file.active && !dvc.experiment.running.workspace && dvc.commands.available" | ||
} | ||
], | ||
"view/item/context": [ | ||
|
@@ -1158,42 +1163,42 @@ | |
{ | ||
"command": "dvc.views.experiments.applyExperiment", | ||
"group": "inline@1", | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running.workspace" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [F] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to add stop inline as a follow up |
||
}, | ||
{ | ||
"command": "dvc.views.experiments.branchExperiment", | ||
"group": "inline@2", | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.views.experimentsTree.removeExperiment", | ||
"group": "inline@3", | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(experiment|queued)$/ && !dvc.experiment.running" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(experiment|queued)$/ && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.views.experimentsTree.pushExperiment", | ||
"group": "1_share@0", | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running.workspace" | ||
}, | ||
{ | ||
"command": "dvc.views.experiments.runExperiment", | ||
"group": "2_modify@1", | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(workspace|commit|experiment|queued)$/ && !dvc.experiment.running && !dvc.experiment.checkpoints" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(workspace|commit|experiment|queued)$/ && !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|commit|experiment|queued)$/ && !dvc.experiment.running && dvc.experiment.checkpoints" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(workspace|commit|experiment|queued)$/ && !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|commit|experiment|queued)$/ && !dvc.experiment.running && dvc.experiment.checkpoints" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(workspace|commit|experiment|queued)$/ && !dvc.experiment.running.workspace && dvc.experiment.checkpoints" | ||
}, | ||
{ | ||
"command": "dvc.views.experiments.queueExperiment", | ||
"group": "2_modify@3", | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(workspace|commit|experiment|queued)$/ && !dvc.experiment.running" | ||
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(workspace|commit|experiment|queued)$/ && !dvc.experiment.running.workspace" | ||
} | ||
], | ||
"view/title": [ | ||
|
@@ -1214,17 +1219,17 @@ | |
}, | ||
{ | ||
"command": "dvc.runExperiment", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running && !dvc.experiment.checkpoints", | ||
"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 && dvc.experiment.checkpoints", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints", | ||
"group": "navigation@1" | ||
}, | ||
{ | ||
"command": "dvc.resumeCheckpointExperiment", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running && dvc.experiment.checkpoints", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints", | ||
"group": "navigation@2" | ||
}, | ||
{ | ||
|
@@ -1249,27 +1254,27 @@ | |
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsAndRun", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running && !dvc.experiment.checkpoints", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && !dvc.experiment.checkpoints", | ||
"group": "2_modify@1" | ||
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsAndResume", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running && dvc.experiment.checkpoints", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints", | ||
"group": "2_modify@1" | ||
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsResetAndRun", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running && dvc.experiment.checkpoints", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace && dvc.experiment.checkpoints", | ||
"group": "2_modify@2" | ||
}, | ||
{ | ||
"command": "dvc.modifyExperimentParamsAndQueue", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace", | ||
"group": "2_modify@3" | ||
}, | ||
{ | ||
"command": "dvc.queueExperiment", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running", | ||
"when": "view == dvc.views.experimentsTree && !dvc.experiment.running.workspace", | ||
"group": "3_queue@1" | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ import { definedAndNonEmpty, reorderListSubset } from '../../util/array' | |
import { | ||
EXPERIMENT_WORKSPACE_ID, | ||
Executor, | ||
ExpShowOutput | ||
ExpShowOutput, | ||
ExperimentStatus | ||
} from '../../cli/dvc/contract' | ||
import { flattenMapValues } from '../../util/map' | ||
import { ModelWithPersistence } from '../../persistence/model' | ||
|
@@ -39,10 +40,11 @@ export type SelectedExperimentWithColor = Experiment & { | |
} | ||
|
||
export enum ExperimentType { | ||
WORKSPACE = 'workspace', | ||
COMMIT = 'commit', | ||
EXPERIMENT = 'experiment', | ||
QUEUED = 'queued' | ||
RUNNING = 'running', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [F] We need this to prevent actions being run from the |
||
QUEUED = 'queued', | ||
WORKSPACE = 'workspace' | ||
} | ||
|
||
export class ExperimentsModel extends ModelWithPersistence { | ||
|
@@ -166,6 +168,10 @@ export class ExperimentsModel extends ModelWithPersistence { | |
return this.running.length > 0 | ||
} | ||
|
||
public hasRunningWorkspaceExperiment() { | ||
return this.running.some(({ executor }) => executor === Executor.WORKSPACE) | ||
} | ||
|
||
public hasCheckpoints() { | ||
return this.checkpoints | ||
} | ||
|
@@ -372,9 +378,7 @@ export class ExperimentsModel extends ModelWithPersistence { | |
return this.getExperimentsByCommit(commit)?.map(experiment => ({ | ||
...experiment, | ||
hasChildren: false, | ||
type: isQueued(experiment.status) | ||
? ExperimentType.QUEUED | ||
: ExperimentType.EXPERIMENT | ||
type: this.getExperimentType(experiment.status) | ||
})) | ||
} | ||
|
||
|
@@ -556,6 +560,17 @@ export class ExperimentsModel extends ModelWithPersistence { | |
} | ||
} | ||
|
||
private getExperimentType(status?: ExperimentStatus) { | ||
if (isQueued(status)) { | ||
return ExperimentType.QUEUED | ||
} | ||
if (isRunning(status)) { | ||
return ExperimentType.RUNNING | ||
} | ||
|
||
return ExperimentType.EXPERIMENT | ||
} | ||
|
||
private getDisplayColor(id: string) { | ||
const color = this.coloredStatus[id] | ||
if (!color) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] We only want to suppress actions when there is an experiment running in the workspace.