Skip to content

Commit

Permalink
Merge branch 'main' into fix-test-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored May 2, 2023
2 parents e76244b + c8916ee commit 98a89eb
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 155 deletions.
2 changes: 1 addition & 1 deletion demo
Submodule demo updated 1 files
+2 −2 requirements.txt
2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@
"vscode-languageclient": "8.1.0"
},
"devDependencies": {
"@swc/core": "1.3.53",
"@swc/core": "1.3.55",
"@swc/jest": "0.2.26",
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.5",
Expand Down
2 changes: 1 addition & 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.55.0'
export const LATEST_TESTED_CLI_VERSION = '2.56.0'
export const MAX_CLI_VERSION = '3'

type ErrorContents = { type: string; msg: string }
Expand Down
139 changes: 64 additions & 75 deletions extension/src/experiments/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,83 +95,43 @@ export class WorkspaceExperiments extends BaseWorkspaceWebviews<
)
}

public async addFilter(overrideRoot?: string) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).addFilter()
public addFilter(overrideRoot?: string) {
return this.getRepositoryThenUpdate('addFilter', overrideRoot)
}

public async addStarredFilter(overrideRoot?: string) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).addStarredFilter()
public addStarredFilter(overrideRoot?: string) {
return this.getRepositoryThenUpdate('addStarredFilter', overrideRoot)
}

public async removeFilters() {
const dvcRoot = await this.getFocusedOrOnlyOrPickProject()
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).removeFilters()
public removeFilters() {
return this.getRepositoryThenUpdate('removeFilters')
}

public async addSort(overrideRoot?: string) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).addSort()
public addSort(overrideRoot?: string) {
return this.getRepositoryThenUpdate('addSort', overrideRoot)
}

public async addStarredSort(overrideRoot?: string) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).addStarredSort()
public addStarredSort(overrideRoot?: string) {
return this.getRepositoryThenUpdate('addStarredSort', overrideRoot)
}

public async removeSorts() {
const dvcRoot = await this.getFocusedOrOnlyOrPickProject()
if (!dvcRoot) {
return
}

return this.getRepository(dvcRoot).removeSorts()
public removeSorts() {
return this.getRepositoryThenUpdate('removeSorts')
}

public async selectExperimentsToPlot(overrideRoot?: string) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).selectExperimentsToPlot()
public selectExperimentsToPlot(overrideRoot?: string) {
return this.getRepositoryThenUpdate('selectExperimentsToPlot', overrideRoot)
}

public async selectColumns(overrideRoot?: string) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot).selectColumns()
public selectColumns(overrideRoot?: string) {
return this.getRepositoryThenUpdate('selectColumns', overrideRoot)
}

public async selectQueueTasksToKill() {
const cwd = await this.getFocusedOrOnlyOrPickProject()
if (!cwd) {
return
}

const taskIds = await this.getRepository(cwd).pickQueueTasksToKill()

if (!taskIds || isEmpty(taskIds)) {
return
}
return this.runCommand(AvailableCommands.QUEUE_KILL, cwd, ...taskIds)
public selectQueueTasksToKill() {
return this.pickIdsThenRun(
'pickQueueTasksToKill',
AvailableCommands.QUEUE_KILL
)
}

public async selectExperimentsToPush(setup: Setup) {
Expand All @@ -190,20 +150,11 @@ export class WorkspaceExperiments extends BaseWorkspaceWebviews<
return pushCommand({ dvcRoot, ids })
}

public async selectExperimentsToRemove() {
const cwd = await this.getFocusedOrOnlyOrPickProject()
if (!cwd) {
return
}

const experimentIds = await this.getRepository(
cwd
).pickExperimentsToRemove()
if (!experimentIds || isEmpty(experimentIds)) {
return
}

return this.runCommand(AvailableCommands.EXP_REMOVE, cwd, ...experimentIds)
public selectExperimentsToRemove() {
return this.pickIdsThenRun(
'pickExperimentsToRemove',
AvailableCommands.EXP_REMOVE
)
}

public async modifyExperimentParamsAndRun(
Expand Down Expand Up @@ -453,6 +404,25 @@ export class WorkspaceExperiments extends BaseWorkspaceWebviews<
)
}

private async getRepositoryThenUpdate(
method:
| 'addFilter'
| 'addStarredFilter'
| 'removeFilters'
| 'addSort'
| 'addStarredSort'
| 'removeSorts'
| 'selectExperimentsToPlot'
| 'selectColumns',
overrideRoot?: string
) {
const dvcRoot = await this.getDvcRoot(overrideRoot)
if (!dvcRoot) {
return
}
return this.getRepository(dvcRoot)[method]()
}

private async shouldRun() {
const cwd = await this.getFocusedOrOnlyOrPickProject()
if (!cwd) {
Expand Down Expand Up @@ -555,6 +525,25 @@ export class WorkspaceExperiments extends BaseWorkspaceWebviews<
return { command, enteredManually, trainingScript }
}

private async pickIdsThenRun(
pickMethod: 'pickQueueTasksToKill' | 'pickExperimentsToRemove',
commandId:
| typeof AvailableCommands.QUEUE_KILL
| typeof AvailableCommands.EXP_REMOVE
) {
const cwd = await this.getFocusedOrOnlyOrPickProject()
if (!cwd) {
return
}

const ids = await this.getRepository(cwd)[pickMethod]()

if (!ids || isEmpty(ids)) {
return
}
return this.runCommand(commandId, cwd, ...ids)
}

private async pickExpThenRun(
commandId: CommandId,
pickFunc: (cwd: string) => Thenable<string | undefined> | undefined
Expand Down
2 changes: 1 addition & 1 deletion languageServer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test": "jest --collect-coverage"
},
"devDependencies": {
"@swc/core": "1.3.53",
"@swc/core": "1.3.55",
"@swc/jest": "0.2.26",
"@types/jest": "29.5.1",
"clean-webpack-plugin": "4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"resolutions": {
"decode-uri-component": "0.2.2",
"@types/react": "18.0.38",
"@types/react": "18.2.0",
"**/recursive-readdir/minimatch": "6.2.0",
"fastify": "3.29.5",
"json5": "2.2.3",
Expand Down
6 changes: 3 additions & 3 deletions webview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
"@storybook/react-webpack5": "7.0.7",
"@storybook/testing-library": "0.1.0",
"@svgr/cli": "7.0.0",
"@swc/core": "1.3.53",
"@swc/core": "1.3.55",
"@swc/jest": "0.2.26",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
"@types/jest": "29.5.1",
"@types/jsdom": "21.1.1",
"@types/node": "16.x",
"@types/react": "18.0.38",
"@types/react-dom": "18.0.11",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.0",
"@types/react-measure": "2.0.8",
"@types/react-virtualized": "9.21.21",
"@types/webpack": "5.28.1",
Expand Down
Loading

0 comments on commit 98a89eb

Please sign in to comment.