Skip to content

Commit

Permalink
Merge branch 'main' into fix-dvc-details-version-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored May 1, 2023
2 parents d3621a4 + 2b9f6a7 commit c46303f
Show file tree
Hide file tree
Showing 37 changed files with 798 additions and 875 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ These are the VS Code [settings] available for the Extension:
| `dvc.studio.shareExperimentsLive` | Automatically share all new experiment metrics and plots logged with DVCLive to Studio. This option will only take effect once Studio is connected. |
| `dvc.focusedProjects` | A subset of paths to the workspace's available DVC projects. Using this option will override project auto-discovery. |
| `dvc.doNotShowWalkthroughAfterInstall` | Do not prompt to show the Get Started page after installing. Useful for pre-configured development environments |
| `dvc.doNotRecommendAddStudioToken` | Do not prompt to add a [studio.token] to the global DVC config, which enables automatic sharing of experiments to [Studio]. |
| `dvc.doNotRecommendRedHatExtension` | Do not prompt to install the Red Hat YAML extension, which helps with DVC YAML schema validation (`dvc.yaml` and `.dvc` files). |
| `dvc.doNotShowCliUnavailable` | Do not warn when the workspace contains a DVC project but the DVC binary is unavailable. |

Expand All @@ -162,6 +163,9 @@ These are the VS Code [settings] available for the Extension:
[python extension]:
https://marketplace.visualstudio.com/items?itemName=ms-python.python
[studio.token]:
https://dvc.org/doc/user-guide/project-structure/configuration#studio
[Studio]: https://studio.iterative.ai
[workspace level]:
https://code.visualstudio.com/docs/getstarted/settings#_workspace-settings

Expand Down
82 changes: 28 additions & 54 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@
"light": "resources/light/queue-experiment.svg"
}
},
{
"title": "Push Experiment(s)",
"command": "dvc.pushExperiments",
"category": "DVC"
},
{
"title": "Remove Experiment(s)",
"command": "dvc.removeExperiments",
Expand Down Expand Up @@ -382,18 +387,6 @@
"command": "dvc.setupWorkspace",
"category": "DVC"
},
{
"title": "Share Experiment as Branch",
"command": "dvc.shareExperimentAsBranch",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Commit and Share Experiment",
"command": "dvc.shareExperimentAsCommit",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Show Commands",
"command": "dvc.showCommands",
Expand Down Expand Up @@ -518,20 +511,14 @@
"icon": "$(play)"
},
{
"title": "Share as Branch",
"command": "dvc.views.experiments.shareExperimentAsBranch",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Commit and Share",
"command": "dvc.views.experiments.shareExperimentAsCommit",
"title": "Push",
"command": "dvc.views.experiments.pushExperiment",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Share to Studio",
"command": "dvc.views.experiments.shareExperimentToStudio",
"title": "Push",
"command": "dvc.views.experimentsTree.pushExperiment",
"category": "DVC",
"icon": "$(repo-push)"
},
Expand Down Expand Up @@ -588,6 +575,11 @@
"type": "boolean",
"default": null
},
"dvc.doNotRecommendAddStudioToken": {
"description": "Do not prompt to add a studio.token to the global DVC config, which enables automatic sharing of experiments to Studio.",
"type": "boolean",
"default": null
},
"dvc.doNotShowCliUnavailable": {
"description": "Do not warn when the workspace contains a DVC project but the DVC binary is unavailable.",
"type": "boolean",
Expand Down Expand Up @@ -623,7 +615,7 @@
"default": null
},
"dvc.studio.shareExperimentsLive": {
"description": "Automatically share all new experiment metrics and plots logged with DVCLive to Studio. This option will only take effect once Studio is connected.",
"description": "Automatically share all new experiment metrics and plots logged with DVCLive to Studio. This option will only take effect once Studio is connected (studio.token is set).",
"type": "boolean",
"default": false
}
Expand Down Expand Up @@ -774,6 +766,10 @@
"command": "dvc.modifyExperimentParamsResetAndRun",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running && dvc.experiment.checkpoints"
},
{
"command": "dvc.pushExperiments",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running"
},
{
"command": "dvc.queueExperiment",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running"
Expand Down Expand Up @@ -846,14 +842,6 @@
"command": "dvc.showCommands",
"when": "false"
},
{
"command": "dvc.shareExperimentAsBranch",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running"
},
{
"command": "dvc.shareExperimentAsCommit",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running"
},
{
"command": "dvc.showExperiments",
"when": "dvc.commands.available && dvc.project.available"
Expand Down Expand Up @@ -891,39 +879,35 @@
"when": "false"
},
{
"command": "dvc.views.experiments.queueExperiment",
"command": "dvc.views.experiments.pushExperiment",
"when": "false"
},
{
"command": "dvc.views.experimentsTree.removeExperiment",
"command": "dvc.views.experimentsTree.pushExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.removeExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.runExperiment",
"command": "dvc.views.experiments.queueExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.resumeCheckpointExperiment",
"command": "dvc.views.experimentsTree.removeExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"command": "dvc.views.experiments.removeExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentAsBranch",
"command": "dvc.views.experiments.runExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentAsCommit",
"command": "dvc.views.experiments.resumeCheckpointExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentToStudio",
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"when": "false"
},
{
Expand Down Expand Up @@ -1187,20 +1171,10 @@
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(experiment|queued)$/ && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.shareExperimentToStudio",
"command": "dvc.views.experimentsTree.pushExperiment",
"group": "1_share@0",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.shareExperimentAsCommit",
"group": "1_share@1",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.shareExperimentAsBranch",
"group": "1_share@2",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.runExperiment",
"group": "2_modify@1",
Expand Down
29 changes: 15 additions & 14 deletions extension/src/cli/dvc/executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const mockedGetProcessEnv = jest.mocked(getProcessEnv)
const mockedEnv = {
DVCLIVE_OPEN: 'false',
DVC_NO_ANALYTICS: 'true',
GIT_TERMINAL_PROMPT: '0',
PATH: '/some/special/path'
}

Expand Down Expand Up @@ -238,13 +239,13 @@ describe('CliExecutor', () => {
})
})

describe('experimentApply', () => {
describe('expApply', () => {
it('should call createProcess with the correct parameters to apply an existing experiment to the workspace', async () => {
const cwd = ''
const stdout = 'Test output that will be passed along'
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentApply(cwd, 'exp-test')
const output = await dvcExecutor.expApply(cwd, 'exp-test')
expect(output).toStrictEqual(stdout)

expect(mockedCreateProcess).toHaveBeenCalledWith({
Expand All @@ -256,7 +257,7 @@ describe('CliExecutor', () => {
})
})

describe('experimentBranch', () => {
describe('expBranch', () => {
it('should call createProcess with the correct parameters to create a new branch from an existing experiment', async () => {
const cwd = __dirname
const stdout =
Expand All @@ -265,7 +266,7 @@ describe('CliExecutor', () => {
'\t\tgit checkout some-branch'
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentBranch(
const output = await dvcExecutor.expBranch(
cwd,
'exp-0898f',
'some-branch'
Expand All @@ -281,7 +282,7 @@ describe('CliExecutor', () => {
})
})

describe('experimentGarbageCollect', () => {
describe('expGarbageCollect', () => {
it('should call createProcess with the correct parameters to garbage collect experiments', async () => {
const cwd = __dirname
const stdout =
Expand All @@ -290,7 +291,7 @@ describe('CliExecutor', () => {
"Removed 45 experiments. To remove unused cache files use 'dvc gc'. "
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentGarbageCollect(
const output = await dvcExecutor.expGarbageCollect(
cwd,
GcPreserveFlag.WORKSPACE,
GcPreserveFlag.QUEUED
Expand All @@ -306,13 +307,13 @@ describe('CliExecutor', () => {
})
})

describe('experimentPush', () => {
describe('expPush', () => {
it('should call createProcess with the correct parameters to push an existing experiment to the remote', async () => {
const cwd = __dirname
const stdout = ''
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentPush(cwd, 'toric-sail')
const output = await dvcExecutor.expPush(cwd, 'toric-sail')
expect(output).toStrictEqual(stdout)

expect(mockedCreateProcess).toHaveBeenCalledWith({
Expand All @@ -324,13 +325,13 @@ describe('CliExecutor', () => {
})
})

describe('experimentRemove', () => {
describe('expRemove', () => {
it('should call createProcess with the correct parameters to remove an existing experiment from the workspace', async () => {
const cwd = __dirname
const stdout = ''
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentRemove(cwd, 'exp-dfd12')
const output = await dvcExecutor.expRemove(cwd, 'exp-dfd12')
expect(output).toStrictEqual(stdout)

expect(mockedCreateProcess).toHaveBeenCalledWith({
Expand All @@ -342,13 +343,13 @@ describe('CliExecutor', () => {
})
})

describe('experimentRemoveQueue', () => {
describe('expRemoveQueue', () => {
it('should call createProcess with the correct parameters to remove all existing queued experiments from the workspace', async () => {
const cwd = __dirname
const stdout = ''
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentRemoveQueue(cwd)
const output = await dvcExecutor.expRemoveQueue(cwd)
expect(output).toStrictEqual(stdout)

expect(mockedCreateProcess).toHaveBeenCalledWith({
Expand All @@ -360,13 +361,13 @@ describe('CliExecutor', () => {
})
})

describe('experimentRunQueue', () => {
describe('expRunQueue', () => {
it('should call createProcess with the correct parameters to queue an experiment for later execution', async () => {
const cwd = __dirname
const stdout = "Queued experiment 'bbf5c01' for future execution."
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout))

const output = await dvcExecutor.experimentRunQueue(cwd)
const output = await dvcExecutor.expRunQueue(cwd)
expect(output).toStrictEqual(stdout)

expect(mockedCreateProcess).toHaveBeenCalledWith({
Expand Down
Loading

0 comments on commit c46303f

Please sign in to comment.