Skip to content

Commit

Permalink
Merge branch 'main' into latest-dvc-2.56
Browse files Browse the repository at this point in the history
  • Loading branch information
sroy3 authored May 2, 2023
2 parents 887a04a + dece84c commit 4fe37f0
Show file tree
Hide file tree
Showing 33 changed files with 816 additions and 264 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

All notable changes to this project will be documented in this file.

## [0.8.3] - 2023-05-01

### 🚀 New Features and Enhancements

- Use dvc config to store and access studio.token [#3768](https://github.com/iterative/vscode-dvc/pull/3768) by [@mattseddon](https://github.com/mattseddon)
- Integrate remaining share experiment command with the extension (exp push) [#3781](https://github.com/iterative/vscode-dvc/pull/3781) by [@mattseddon](https://github.com/mattseddon)
- Add multi-select versions of exp push [#3792](https://github.com/iterative/vscode-dvc/pull/3792) by [@mattseddon](https://github.com/mattseddon)
- Add push experiment(s) to the command palette [#3793](https://github.com/iterative/vscode-dvc/pull/3793) by [@mattseddon](https://github.com/mattseddon)

### 🐛 Bug Fixes

- Ensure duplicate colors are not made available during collection [#3780](https://github.com/iterative/vscode-dvc/pull/3780) by [@mattseddon](https://github.com/mattseddon)
- Add GIT_TERMINAL_PROMPT=0 to DVC environment variables [#3779](https://github.com/iterative/vscode-dvc/pull/3779) by [@mattseddon](https://github.com/mattseddon)
- Fix available revisions for multi view plots [#3774](https://github.com/iterative/vscode-dvc/pull/3774) by [@sroy3](https://github.com/sroy3)
- Display progress errors to users [#3791](https://github.com/iterative/vscode-dvc/pull/3791) by [@mattseddon](https://github.com/mattseddon)
- Fix dvc details version incorrectly showing "Not Found" [#3787](https://github.com/iterative/vscode-dvc/pull/3787) by [@julieg18](https://github.com/julieg18)

### 🔨 Maintenance

- Use exp push to share experiments to Studio [#3701](https://github.com/iterative/vscode-dvc/pull/3701) by [@mattseddon](https://github.com/mattseddon)
- Remove commit and share and share as branch options [#3771](https://github.com/iterative/vscode-dvc/pull/3771) by [@mattseddon](https://github.com/mattseddon)
- Stub dvc config calls in integration tests [#3777](https://github.com/iterative/vscode-dvc/pull/3777) by [@mattseddon](https://github.com/mattseddon)
- Rename exp commands to closer match CLI [#3778](https://github.com/iterative/vscode-dvc/pull/3778) by [@mattseddon](https://github.com/mattseddon)

## [0.8.2] - 2023-04-27

### 🚀 New Features and Enhancements
Expand Down
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
44 changes: 34 additions & 10 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"extensionDependencies": [
"vscode.git"
],
"version": "0.8.2",
"version": "0.8.3",
"license": "Apache-2.0",
"readme": "./README.md",
"repository": {
Expand Down 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 @@ -506,8 +511,14 @@
"icon": "$(play)"
},
{
"title": "Share to Studio",
"command": "dvc.views.experiments.shareExperimentToStudio",
"title": "Push",
"command": "dvc.views.experiments.pushExperiment",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Push",
"command": "dvc.views.experimentsTree.pushExperiment",
"category": "DVC",
"icon": "$(repo-push)"
},
Expand Down Expand Up @@ -564,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 @@ -599,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 @@ -750,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 @@ -858,6 +878,14 @@
"command": "dvc.views.experiments.branchExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.pushExperiment",
"when": "false"
},
{
"command": "dvc.views.experimentsTree.pushExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.queueExperiment",
"when": "false"
Expand All @@ -882,10 +910,6 @@
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentToStudio",
"when": "false"
},
{
"command": "dvc.views.experiments.showLogs",
"when": "false"
Expand Down Expand Up @@ -1147,7 +1171,7 @@
"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"
},
Expand Down Expand Up @@ -1603,7 +1627,7 @@
"vscode-languageclient": "8.1.0"
},
"devDependencies": {
"@swc/core": "1.3.53",
"@swc/core": "1.3.54",
"@swc/jest": "0.2.26",
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.5",
Expand Down
6 changes: 4 additions & 2 deletions extension/src/cli/dvc/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const warnUser = (
type CanRunCli = {
isAvailable: boolean
isCompatible: boolean | undefined
version: string | undefined
}

export const isCliCompatible = (
Expand Down Expand Up @@ -146,7 +147,8 @@ const processVersionDetails = (
warnUser(setup, cliCompatible, version)
return {
isAvailable,
isCompatible
isCompatible,
version
}
}

Expand All @@ -171,7 +173,7 @@ const tryGlobalFallbackVersion = async (
setup.unsetPythonBinPath()
}

return { isAvailable, isCompatible }
return { isAvailable, isCompatible, version }
}

const extensionCanAutoRunCli = async (
Expand Down
2 changes: 1 addition & 1 deletion extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum RegisteredCliCommands {
EXPERIMENT_APPLY = 'dvc.applyExperiment',
EXPERIMENT_BRANCH = 'dvc.branchExperiment',
EXPERIMENT_GARBAGE_COLLECT = 'dvc.experimentGarbageCollect',
EXPERIMENT_PUSH = 'dvc.pushExperiments',
EXPERIMENT_REMOVE = 'dvc.removeExperiments',
EXPERIMENT_REMOVE_QUEUE = 'dvc.removeExperimentQueue',
EXPERIMENT_RESET_AND_RUN = 'dvc.resetAndRunCheckpointExperiment',
Expand Down Expand Up @@ -100,7 +101,6 @@ export enum RegisteredCommands {
ADD_STUDIO_ACCESS_TOKEN = 'dvc.addStudioAccessToken',
UPDATE_STUDIO_ACCESS_TOKEN = 'dvc.updateStudioAccessToken',
REMOVE_STUDIO_ACCESS_TOKEN = 'dvc.removeStudioAccessToken',
EXPERIMENT_VIEW_SHARE_TO_STUDIO = 'dvc.views.experiments.shareExperimentToStudio',
SETUP_SHOW_STUDIO_CONNECT = 'dvc.showStudioConnect',
SETUP_SHOW_STUDIO_SETTINGS = 'dvc.showStudioSettings',

Expand Down
71 changes: 55 additions & 16 deletions extension/src/experiments/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,76 @@ import { AvailableCommands, InternalCommands } from '../../commands/internal'
import { Toast } from '../../vscode/toast'
import { WorkspaceExperiments } from '../workspace'
import { Setup } from '../../setup'
import { Response } from '../../vscode/response'
import {
ConfigKey,
getConfigValue,
setUserConfigValue
} from '../../vscode/config'
import { STUDIO_URL } from '../../setup/webview/contract'
import { RegisteredCommands } from '../../commands/external'

export const getBranchExperimentCommand =
(experiments: WorkspaceExperiments) =>
(cwd: string, name: string, input: string) =>
experiments.runCommand(AvailableCommands.EXP_BRANCH, cwd, name, input)

export const getShareExperimentToStudioCommand =
const promptToAddStudioToken = async () => {
const response = await Toast.askShowOrCloseOrNever(
`Experiments can be automatically shared to [Studio](${STUDIO_URL}) by setting the studio.token in your config.`
)

if (!response || response === Response.CLOSE) {
return
}
if (response === Response.SHOW) {
return commands.executeCommand(RegisteredCommands.SETUP_SHOW_STUDIO_CONNECT)
}
if (response === Response.NEVER) {
return setUserConfigValue(ConfigKey.DO_NOT_RECOMMEND_ADD_STUDIO_TOKEN, true)
}
}

const convertUrlTextToLink = (stdout: string) => {
const experimentAtRegex = /\sat\s+(https:\/\/studio\.iterative\.ai\/.*$)/
const match = stdout.match(experimentAtRegex)
if (!(match?.[0] && match?.[1])) {
return stdout
}
return stdout.replace(match[0], ` in [Studio](${match[1]})`)
}

export const getPushExperimentCommand =
(internalCommands: InternalCommands, setup: Setup) =>
({ dvcRoot, id }: { dvcRoot: string; id: string }) => {
({ dvcRoot, ids }: { dvcRoot: string; ids: string[] }) => {
const studioAccessToken = setup.getStudioAccessToken()
if (!studioAccessToken) {
return commands.executeCommand(RegisteredCommands.SETUP_SHOW)
if (
!(
getConfigValue(ConfigKey.DO_NOT_RECOMMEND_ADD_STUDIO_TOKEN) ||
studioAccessToken
)
) {
void promptToAddStudioToken()
}

return Toast.showProgress('Sharing', async progress => {
return Toast.showProgress('exp push', async progress => {
progress.report({ increment: 0 })

progress.report({ increment: 25, message: 'Running exp push...' })

await Toast.runCommandAndIncrementProgress(
() =>
internalCommands.executeCommand(
AvailableCommands.EXP_PUSH,
dvcRoot,
id
),
progress,
75
progress.report({ increment: 25, message: `Pushing ${ids.join(' ')}...` })

const remainingProgress = 75

const stdout = await internalCommands.executeCommand(
AvailableCommands.EXP_PUSH,
dvcRoot,
...ids
)

progress.report({
increment: remainingProgress,
message: convertUrlTextToLink(stdout)
})

return Toast.delayProgressClosing(15000)
})
}
21 changes: 12 additions & 9 deletions extension/src/experiments/commands/register.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
getBranchExperimentCommand,
getShareExperimentToStudioCommand
} from '.'
import { getBranchExperimentCommand, getPushExperimentCommand } from '.'
import { pickGarbageCollectionFlags } from '../quickPick'
import { WorkspaceExperiments } from '../workspace'
import { AvailableCommands, InternalCommands } from '../../commands/internal'
Expand Down Expand Up @@ -163,7 +160,8 @@ const registerExperimentInputCommands = (

const registerExperimentQuickPickCommands = (
experiments: WorkspaceExperiments,
internalCommands: InternalCommands
internalCommands: InternalCommands,
setup: Setup
): void => {
internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_GARBAGE_COLLECT,
Expand Down Expand Up @@ -223,6 +221,11 @@ const registerExperimentQuickPickCommands = (
() => experiments.selectQueueTasksToKill()
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_PUSH,
() => experiments.selectExperimentsToPush(setup)
)

internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_REMOVE,
() => experiments.selectExperimentsToRemove()
Expand Down Expand Up @@ -283,7 +286,7 @@ export const registerExperimentCommands = (
registerExperimentCwdCommands(experiments, internalCommands)
registerExperimentNameCommands(experiments, internalCommands)
registerExperimentInputCommands(experiments, internalCommands)
registerExperimentQuickPickCommands(experiments, internalCommands)
registerExperimentQuickPickCommands(experiments, internalCommands, setup)
registerExperimentRunCommands(experiments, internalCommands, setup)

internalCommands.registerExternalCommand(
Expand All @@ -292,9 +295,9 @@ export const registerExperimentCommands = (
experiments.getRepository(dvcRoot).toggleExperimentStatus(id)
)

internalCommands.registerExternalCommand(
RegisteredCommands.EXPERIMENT_VIEW_SHARE_TO_STUDIO,
getShareExperimentToStudioCommand(internalCommands, setup)
internalCommands.registerExternalCliCommand(
RegisteredCliCommands.EXPERIMENT_VIEW_PUSH,
getPushExperimentCommand(internalCommands, setup)
)

internalCommands.registerExternalCliCommand(
Expand Down
8 changes: 8 additions & 0 deletions extension/src/experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ export class Experiments extends BaseRepository<TableData> {
)
}

public pickExperimentsToPush() {
return pickExperiments(
this.experiments.getExperiments(),
this.getFirstThreeColumnOrder(),
Title.SELECT_EXPERIMENTS_PUSH
)
}

public async pickAndModifyParams(overrideId?: string) {
const id = await this.getExperimentId(overrideId)
if (!id) {
Expand Down
Loading

0 comments on commit 4fe37f0

Please sign in to comment.