-
Notifications
You must be signed in to change notification settings - Fork 28
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 'dvc exp run' command #22
Conversation
ryanraposo
commented
Dec 15, 2020
•
edited
Loading
edited
- Can be accessed via VS Code's command palette (Ctrl+Shift+P) or the extension's command view
- Can be bound to keyboard shortcuts in expected ways
- Uses a labeled integrated terminal to run the command in context automatically
Works on my machine! Some thoughts:
That said, even just the change of adding this button is worth merging, leaving iterations like the points I mentioned to their own Issues/PRs. |
@@ -91,6 +91,14 @@ export class Extension { | |||
}) | |||
) | |||
|
|||
this.dispose.track( | |||
commands.registerCommand('dvc-integration.runExperiment', () => { | |||
const terminal = window.createTerminal('DVC') |
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.
If I understand correctly, the "rise or run" behavior I mentioned before would probably hook into the extension here and keep track of terminal
across invocations. I hope to do this kind of technique for Webview invocations as well.
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.
I think I actually removed the context of this comment before posting, but by "rise or run" I essentially mean that we may want to use a single Terminal for DVC operations, only spawning a new one when the original is closed.
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.
Yep, we can also check window.terminals
which is an array of existing terminals to achieve simple get/create behaviour.
Agreed!
That's a great insight & idea.
That was my thinking also. Thanks for an excellent review and all your help generally @rogermparent, really has been a pleasure so far. 🙂 |
@ryanraposo Do you want to do any touch-ups? I'm not sure if you have merge permissions, but if not I can merge this in right now. |
I can merge it, and we'll stick with leaving improvements to future PRs like discussed :) |
this.dispose.track( | ||
commands.registerCommand('dvc-integration.runExperiment', () => { | ||
const terminal = window.createTerminal('DVC') | ||
terminal.sendText('dvc exp run') |
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.
quick question - what is the working directory for this? what will be the mechanism to define this?
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.
cwd is an optional parameter for createTerminal, and if it isn't defined the current workspace (opened folder) is used for the terminal, with the same being true for general VS Code behavior when it comes to integrated terminals
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.
okay, the question - is that what users would expect for this action?
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.
@shcheklein my thoughts on improving expected integration:
-
Since VS Code git integration is analogous and built-in, it can be argued that it should serve as a model for expected behavior. Git commands (via command palette or UI) use Ouput (read-only) channels, so they are more appropriate here.
-
Commands with labels in a sidebar (Activity Bar) tree view like we have is unexpected. IMO this is partly because of the additional access VS Code contributes for all commands automatically.
-
Contextual usage (right click) would be useful/expected for this command. We should add it to the Explorer view and to editors with relevant files open, and use a 'WHEN' condition to limit its appearance to file type; with exceptions or failures being handled/indicated in Output.
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.
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.
Note also the Output channel with output from git, bottom right. These channels are typically per-extension/source and though it isn't clear from the screenshot, they are labelled (hover) and can be cycled/toggled via dropdown like terminals.
In normal use, they are feeds that don't show themselves even when actions cause output. Tasks in VS Code use a 'terminal' with unique behaviour (also read only), show when triggered, and are re-used by only that task specifically.
One certainty (given this approach) is that Tasks shouldn't be emulated too closely, as our commands aren't Tasks in VS Code terms.
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.
An important note (for @rogermparent also): the VS Code API gives us a number of tools for event monitoring. They're generally underutilized and I can already see them being the foundation for some complex solves in this project.
An example: OnDidChange event listener for particular documents--our webviews can be very dynamic with simple code if we leverage these tools in cases where updates can be inferred from changes to a file.
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.
An important note (for @rogermparent also): the VS Code API gives us a number of tools for event monitoring. They're generally underutilized and I can already see them being the foundation for some complex solves in this project.
An example: OnDidChange event listener for particular documents--our webviews can be very dynamic with simple code if we leverage these tools in cases where updates can be inferred from changes to a file.
That is incredibly useful to know. Monitoring files like params.yaml
and/or dvc.yaml
will likely be absolutely core in this project. I'm open to simplifying the webviews too whenever possible- they'll need some state for things like sorting, but ideally as little as possible if I understand correctly.
@iterative/engineering Are there any files other than dvc.yaml
and params.yaml
that would use useful to watch for changes? I can see this feature being used for user config, but there may also be some files where watching will be useful for monitoring when DVC actions happen outside of the plugin- maybe dvc.lock
?.
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.
Yeah! I was hoping it'd take some stress off. Was mistaken about the 'OnDidChange' format. Here's the more accurate snippet:
const fileWatcher = vscode.workspace.createFileSystemWatcher(pattern);
fileWatcher.onDidChange(() => doThing());
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.
@rogermparent as we come to displaying metrics (the bottom part) - they might come from us tracking changes to a directory.
clearly all changes to the workspace (e.g. even to detect that it's dirty).
Changes to dvc.lock, .dvc files that correspond to data and data itself potentially to update it's status in the files tree (when we get there).
It might be tricky though, since we'll need to do find and track changes to files recursively.