Skip to content

Commit

Permalink
Merge branch 'main' into fix-test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored May 18, 2023
2 parents 7e58e41 + 53f93af commit c870a3c
Show file tree
Hide file tree
Showing 62 changed files with 1,482 additions and 414 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

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

## [0.8.16] - 2023-05-18

### 🚀 New Features and Enhancements

- Add setup warning about latest tested version [#3895](https://github.com/iterative/vscode-dvc/pull/3895) by [@julieg18](https://github.com/julieg18)
- Add upgrade dvc button to setup when incompatible [#3904](https://github.com/iterative/vscode-dvc/pull/3904) by [@julieg18](https://github.com/julieg18)

### 🔨 Maintenance

- Update demo project and latest tested CLI version (2.57.2) [#3931](https://github.com/iterative/vscode-dvc/pull/3931) by [@mattseddon](https://github.com/mattseddon)

## [0.8.15] - 2023-05-18

### 🐛 Bug Fixes

- Ensure unique list of experiment passed to the rest of the app [#3925](https://github.com/iterative/vscode-dvc/pull/3925) by [@mattseddon](https://github.com/mattseddon)

## [0.8.14] - 2023-05-18

### 🚀 New Features and Enhancements

- Add Remotes section to setup webview [#3901](https://github.com/iterative/vscode-dvc/pull/3901) by [@mattseddon](https://github.com/mattseddon)

### 🔨 Maintenance

- Make use of show experiments command for setup page [#3910](https://github.com/iterative/vscode-dvc/pull/3910) by [@mattseddon](https://github.com/mattseddon)
- Add default test data to setup app tests [#3908](https://github.com/iterative/vscode-dvc/pull/3908) by [@mattseddon](https://github.com/mattseddon)
- Fix typo in setup reducers [#3912](https://github.com/iterative/vscode-dvc/pull/3912) by [@mattseddon](https://github.com/mattseddon)
- Create default exp show output constant [#3911](https://github.com/iterative/vscode-dvc/pull/3911) by [@mattseddon](https://github.com/mattseddon)

## [0.8.13] - 2023-05-17

### 🚀 New Features and Enhancements
Expand Down
2 changes: 1 addition & 1 deletion demo
Submodule demo updated 1 files
+1 −1 requirements.txt
12 changes: 6 additions & 6 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.13",
"version": "0.8.16",
"license": "Apache-2.0",
"readme": "./README.md",
"repository": {
Expand Down Expand Up @@ -1677,10 +1677,10 @@
"@types/vscode": "1.64.0",
"@vscode/test-electron": "2.3.2",
"@vscode/vsce": "2.19.0",
"@wdio/cli": "8.10.1",
"@wdio/local-runner": "8.10.1",
"@wdio/mocha-framework": "8.10.1",
"@wdio/spec-reporter": "8.10.1",
"@wdio/cli": "8.10.2",
"@wdio/local-runner": "8.10.2",
"@wdio/mocha-framework": "8.10.2",
"@wdio/spec-reporter": "8.10.2",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"clean-webpack-plugin": "4.0.0",
Expand All @@ -1697,7 +1697,7 @@
"ts-loader": "9.4.2",
"vscode-uri": "3.0.7",
"wdio-vscode-service": "5.1.0",
"webdriverio": "8.10.1",
"webdriverio": "8.10.2",
"webpack": "5.82.1",
"webpack-cli": "5.1.1"
},
Expand Down
1 change: 1 addition & 0 deletions extension/src/cli/dvc/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export enum Command {
PUSH = 'push',
QUEUE = 'queue',
REMOVE = 'remove',
REMOTE = 'remote',
ROOT = 'root',
PARAMS = 'params',
METRICS = 'metrics',
Expand Down
9 changes: 8 additions & 1 deletion extension/src/cli/dvc/contract.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plot } from '../../plots/webview/contract'

export const MIN_CLI_VERSION = '2.55.0'
export const LATEST_TESTED_CLI_VERSION = '2.57.1'
export const LATEST_TESTED_CLI_VERSION = '2.57.2'
export const MAX_CLI_VERSION = '3'

type ErrorContents = { type: string; msg: string }
Expand Down Expand Up @@ -60,6 +60,13 @@ export type MetricsOrParams = RelPathObject<FileDataOrError>
export const fileHasError = (file: FileDataOrError): file is DvcError =>
!!(file as DvcError).error

export const DEFAULT_EXP_SHOW_OUTPUT = [
{
branch: undefined,
rev: EXPERIMENT_WORKSPACE_ID
}
]

export type ExpData = {
rev: string
timestamp: string | null
Expand Down
8 changes: 7 additions & 1 deletion extension/src/cli/dvc/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
ExperimentSubCommand,
Flag,
GcPreserveFlag,
QueueSubCommand
QueueSubCommand,
SubCommand
} from './constants'
import { addStudioAccessToken } from './options'
import { CliResult, CliStarted, typeCheckCommands } from '..'
Expand Down Expand Up @@ -35,6 +36,7 @@ export const autoRegisteredCommands = {
QUEUE_KILL: 'queueKill',
QUEUE_START: 'queueStart',
QUEUE_STOP: 'queueStop',
REMOTE: 'remote',
REMOVE: 'remove'
} as const

Expand Down Expand Up @@ -196,6 +198,10 @@ export class DvcExecutor extends DvcCli {
return this.blockAndExecuteProcess(cwd, Command.REMOVE, ...args)
}

public remote(cwd: string, arg: typeof SubCommand.LIST) {
return this.executeDvcProcess(cwd, Command.REMOTE, arg)
}

private executeExperimentProcess(cwd: string, ...args: Args) {
return this.executeDvcProcess(cwd, Command.EXPERIMENT, ...args)
}
Expand Down
9 changes: 4 additions & 5 deletions extension/src/cli/dvc/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import {
} from './constants'
import {
DataStatusOutput,
DEFAULT_EXP_SHOW_OUTPUT,
DvcError,
EXPERIMENT_WORKSPACE_ID,
ExpShowOutput,
PlotsOutput,
PlotsOutputOrError,
RawPlotsOutput,
ExpShowOutput
RawPlotsOutput
} from './contract'
import { getOptions } from './options'
import { typeCheckCommands } from '..'
Expand Down Expand Up @@ -76,8 +76,7 @@ export class DvcReader extends DvcCli {
if (isDvcError(output) || isEmpty(output)) {
return [
{
branch: undefined,
rev: EXPERIMENT_WORKSPACE_ID,
...DEFAULT_EXP_SHOW_OUTPUT[0],
...(output as DvcError)
}
]
Expand Down
47 changes: 46 additions & 1 deletion extension/src/cli/dvc/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
isVersionCompatible,
extractSemver,
ParsedSemver,
CliCompatible
CliCompatible,
isAboveLatestTestedVersion
} from './version'
import { MIN_CLI_VERSION, LATEST_TESTED_CLI_VERSION } from './contract'

Expand Down Expand Up @@ -161,3 +162,47 @@ describe('isVersionCompatible', () => {
expect(isCompatible).toStrictEqual(CliCompatible.NO_CANNOT_VERIFY)
})
})

describe('isAboveLatestTestedVersion', () => {
it('should return undefined if version is undefined', () => {
const result = isAboveLatestTestedVersion(undefined)

expect(result).toStrictEqual(undefined)
})

it('should return true for a version with a minor higher as the latest tested minor and any patch', () => {
const {
major: latestTestedMajor,
minor: latestTestedMinor,
patch: latestTestedPatch
} = extractSemver(LATEST_TESTED_CLI_VERSION) as ParsedSemver

expect(0).toBeLessThan(latestTestedPatch)

let result = isAboveLatestTestedVersion(
[latestTestedMajor, latestTestedMinor + 1, 0].join('.')
)

expect(result).toStrictEqual(true)

result = isAboveLatestTestedVersion(
[latestTestedMajor, latestTestedMinor + 1, latestTestedPatch + 1000].join(
'.'
)
)

expect(result).toStrictEqual(true)

result = isAboveLatestTestedVersion(
[latestTestedMajor, latestTestedMinor + 1, latestTestedPatch].join('.')
)

expect(result).toStrictEqual(true)
})

it('should return false if version is below the latest tested version', () => {
const result = isAboveLatestTestedVersion(MIN_CLI_VERSION)

expect(result).toStrictEqual(false)
})
})
22 changes: 21 additions & 1 deletion extension/src/cli/dvc/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { MAX_CLI_VERSION, MIN_CLI_VERSION } from './contract'
import {
LATEST_TESTED_CLI_VERSION,
MAX_CLI_VERSION,
MIN_CLI_VERSION
} from './contract'

export enum CliCompatible {
NO_CANNOT_VERIFY = 'no-cannot-verify',
Expand Down Expand Up @@ -67,3 +71,19 @@ export const isVersionCompatible = (

return checkCLIVersion(currentSemVer)
}

export const isAboveLatestTestedVersion = (version: string | undefined) => {
if (!version) {
return undefined
}

const { major: currentMajor, minor: currentMinor } = extractSemver(
version
) as ParsedSemver

const { major: latestTestedMajor, minor: latestTestedMinor } = extractSemver(
LATEST_TESTED_CLI_VERSION
) as ParsedSemver

return currentMajor === latestTestedMajor && currentMinor > latestTestedMinor
}
2 changes: 1 addition & 1 deletion extension/src/experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export class Experiments extends BaseRepository<TableData> {
}

return await pickExperiment(
this.experiments.getCombinedList(),
this.experiments.getUniqueList(),
this.getFirstThreeColumnOrder(),
Title.SELECT_BASE_EXPERIMENT
)
Expand Down
43 changes: 43 additions & 0 deletions extension/src/experiments/model/collect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,47 @@ describe('collectExperiments', () => {
tags: []
})
})

it('should not collect the same experiment twice', () => {
const main = {
experiments: [
{
name: 'campy-pall',
rev: '0b4b001dfaa8f2c4cd2a62238699131ab2c679ea'
},
{
name: 'shyer-stir',
rev: '450e672f0d8913517ab2ab443f5d87b34f308290'
}
],
name: 'main',
rev: '61bed4ce8913eca7f73ca754d65bc5daad1520e2'
}

const expShowWithDuplicateCommits = generateTestExpShowOutput(
{},
main,
{
name: 'branchOffMainWithCommit',
rev: '351e42ace3cb6a3a853c65bef285e60748cc6341'
},
main
)

const { experimentsByCommit, commits } = collectExperiments(
expShowWithDuplicateCommits,
false,
''
)

expect(commits.length).toStrictEqual(3)

const experiments = experimentsByCommit.get('main')

expect(experiments?.length).toStrictEqual(2)
expect(experiments?.map(({ id }) => id).sort()).toStrictEqual([
'campy-pall',
'shyer-stir'
])
})
})
15 changes: 12 additions & 3 deletions extension/src/experiments/model/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,25 @@ const collectExpRange = (
const expState = revs[0]

const { name, rev } = expState
const { branch, id } = baseline
const { id: baselineId } = baseline

const label =
rev === EXPERIMENT_WORKSPACE_ID
? EXPERIMENT_WORKSPACE_ID
: shortenForLabel(rev)

const experimentId = name || label

if (
acc.experimentsByCommit
.get(baselineId)
?.find(({ id }) => id === experimentId)
) {
return
}

const experiment = transformExpState(
{
branch,
id: name || label,
label
},
Expand All @@ -275,7 +284,7 @@ const collectExpRange = (
collectExecutorInfo(experiment, executor)
collectRunningExperiment(acc, experiment)

addToMapArray(acc.experimentsByCommit, id, experiment)
addToMapArray(acc.experimentsByCommit, baselineId, experiment)
}

const setWorkspaceAsRunning = (
Expand Down
Loading

0 comments on commit c870a3c

Please sign in to comment.