From 50d7948e27d87846f07cfadfb272c54f2c6be3ee Mon Sep 17 00:00:00 2001 From: rogermparent Date: Wed, 21 Apr 2021 15:08:34 -0400 Subject: [PATCH 1/3] Add a "Stop Running Experiment" command --- extension/package.json | 10 ++++++++++ extension/package.nls.json | 1 + extension/src/extension.ts | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/extension/package.json b/extension/package.json index 0928eb4e93..b57776a67d 100644 --- a/extension/package.json +++ b/extension/package.json @@ -70,6 +70,11 @@ "command": "dvc.runQueuedExperiments", "category": "DVC" }, + { + "title": "%command.stopRunningExperiment%", + "command": "dvc.stopRunningExperiment", + "category": "DVC" + }, { "title": "%command.experimentGarbageCollect%", "command": "dvc.experimentGarbageCollect", @@ -175,6 +180,11 @@ "command": "dvc.runQueuedExperiments", "group": "experiments", "when": "scmProvider == dvc" + }, + { + "command": "dvc.stopRunningExperiment", + "group": "experiments", + "when": "scmProvider == dvc" } ], "scm/resourceState/context": [ diff --git a/extension/package.nls.json b/extension/package.nls.json index 0d2162e11d..9e0fed5cbf 100644 --- a/extension/package.nls.json +++ b/extension/package.nls.json @@ -14,6 +14,7 @@ "command.runExperiment": "Run Experiment", "command.runResetExperiment": "Run and Reset Experiment", "command.queueExperiment": "Queue Experiment", + "command.stopRunningExperiment": "Stop Running Experiment", "command.applyExperiment": "Apply Experiment", "command.branchExperiment": "Branch Experiment", "command.removeExperiment": "Remove Experiment", diff --git a/extension/src/extension.ts b/extension/src/extension.ts index 2eaac15c0c..fe284f25c1 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -190,6 +190,12 @@ export class Extension { ) ) + this.dispose.track( + commands.registerCommand('dvc.stopRunningExperiment', () => { + this.runner.stop() + }) + ) + this.gitExtension = this.dispose.track(new GitExtension()) this.gitExtension.ready.then(() => { From 1310fc41fa642f50c7befa7169ede7cdb90a3185 Mon Sep 17 00:00:00 2001 From: rogermparent Date: Wed, 21 Apr 2021 15:14:28 -0400 Subject: [PATCH 2/3] Add optional chain and use returning syntax for stop command --- extension/src/extension.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extension/src/extension.ts b/extension/src/extension.ts index fe284f25c1..6593b2c9cd 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -191,9 +191,9 @@ export class Extension { ) this.dispose.track( - commands.registerCommand('dvc.stopRunningExperiment', () => { - this.runner.stop() - }) + commands.registerCommand('dvc.stopRunningExperiment', () => + this.runner?.stop() + ) ) this.gitExtension = this.dispose.track(new GitExtension()) From 2d2156e155a523b8feffa73ab92f8cde0e0ee6d9 Mon Sep 17 00:00:00 2001 From: Roger Date: Thu, 22 Apr 2021 09:58:45 -0400 Subject: [PATCH 3/3] Remove unnecessary optional chain --- extension/src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/src/extension.ts b/extension/src/extension.ts index 9dec1c868a..e4257a049a 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -192,7 +192,7 @@ export class Extension { this.dispose.track( commands.registerCommand('dvc.stopRunningExperiment', () => - this.runner?.stop() + this.runner.stop() ) )