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

Add Commands for exp queue, exp run --run-all, and exp gc #251

Merged
merged 12 commits into from
Apr 14, 2021

Conversation

rogermparent
Copy link
Contributor

@rogermparent rogermparent commented Apr 9, 2021

Builds on #266 to adopt the new allcaps enum convention.
Related to #229, which is part of #239.
#268 builds on this.

This PR adds a "Queue Experiments"/dvc exp run --queue command that reports its output via showInformationMessage, and showErrorMessage.

No tests yet, but there is info message functionality which seems to work well.
})
window.showInformationMessage(stdout)
} catch (e) {
window.showErrorMessage(`Failed to queue an Experiment!\n${e.message}`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually format with a newline, and will need to be changed.

Copy link
Contributor Author

@rogermparent rogermparent Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try/catch currently catches all errors, including ones like a locked repo that the others don't catch. We may want to add a common try/catch that handles errors like these for all commands, with the possible exception of the Webview commands which may want to report errors in a webview.

@rogermparent rogermparent marked this pull request as ready for review April 13, 2021 01:14
@rogermparent rogermparent changed the title Add a "Queue Experiments" command Experiments Commands #1: Add a "Queue Experiments" command Apr 13, 2021
@rogermparent rogermparent changed the base branch from master to add-scm-commands April 13, 2021 17:17
Base automatically changed from add-scm-commands to master April 13, 2021 19:17
@rogermparent rogermparent requested a review from mattseddon April 13, 2021 20:19
Copy link
Member

@mattseddon mattseddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 [Q], 2 [C]s. Nothing to stop you merging.

@@ -78,3 +78,10 @@ export const status = async (
const { stdout } = await execCommand(options, Commands.STATUS)
return JSON.parse(stdout)
}

export const queueExperiment = async (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[C] Feels like all of the functions of the form:

  const { stdout } = await execCommand(options, Commands.COMMAND)
  return stdout

could get collapsed to a single function that we pass options and a command now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is solved in #271

extension/src/cli/index.test.ts Outdated Show resolved Hide resolved

disposer.track(
commands.registerCommand('dvc.queueExperiment', async () => {
return queueExperimentCommand(config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] how does config get into this function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see it comes through registerCommands. Could it be stale after a change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it can be stale here, as we only ever have one Config object instantiated and are just passing around its reference.

To make this reference stale, we would have to somehow dispose of the current Config and create a new one mid-run without reactivating the extension, which is a case I could only see happening through Hot Reload, and even that I'm not sure of.

Outside of that situation, config is always a reference to a single Config object stored in the extension and only disposed of at the end of the Extension's lifecycle, so calls made to it through this reference will be just as up-to-date as anywhere else.

* Add "Run Queued Experiments" command

* Add test for "runQueuedExperiments"

* Experiment Commands #3: Add command for `exp gc` with selectable flags (#269)

* Add command for GC

* Change gc to exp gc, and add leading `--` to enum flags

* Add GC command tests and export GC QuickPickItem interface

* Rename exp gc enum entry and reader command

* Change gcExperiments to experimentGarbageCollect

* Replace test() with it() for consistency

* Experiment Commands #4: Addressing comments from 1-3 (#271)

* Change execCommand to resolve to stdout and simplify its consumers

* runDvcCommand => runCommand

* Reorganize command enum to distinguish exp commands with a prefix

* DvcGc => Gc
@rogermparent rogermparent changed the title Experiments Commands #1: Add a "Queue Experiments" command Add Commands for exp queue, exp run --run-all, and exp gc Apr 14, 2021
@rogermparent rogermparent merged commit 1f7c783 into master Apr 14, 2021
@rogermparent rogermparent deleted the queue-exp-command branch April 14, 2021 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants