Skip to content

Commit 0fb7275

Browse files
authored
Only patch workspace only calls to plots diff (#2629)
* remove get default revisions method * simplify if statement * revert formatting change in experiments model
1 parent 658b1a9 commit 0fb7275

File tree

3 files changed

+8
-35
lines changed

3 files changed

+8
-35
lines changed

extension/src/plots/data/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ export class PlotsData extends BaseData<{ data: PlotsOutput; revs: string[] }> {
7373
}
7474

7575
private getArgs(revs: string[]) {
76-
if (
77-
this.model &&
78-
(sameContents(revs, ['workspace']) || sameContents(revs, []))
79-
) {
80-
return this.model.getDefaultRevs()
76+
const cliWillThrowError = sameContents(revs, ['workspace'])
77+
if (this.model && cliWillThrowError) {
78+
return []
8179
}
8280

8381
return revs

extension/src/plots/model/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ export class PlotsModel extends ModelWithPersistence {
216216
)
217217
}
218218

219-
public getDefaultRevs() {
220-
return ['workspace', ...Object.values(this.branchRevisions)]
221-
}
222-
223219
public getTemplatePlots(order: TemplateOrder | undefined) {
224220
if (!definedAndNonEmpty(order)) {
225221
return

extension/src/test/suite/plots/data/index.test.ts

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ suite('Plots Data Test Suite', () => {
2222
const buildPlotsData = (
2323
experimentIsRunning: boolean,
2424
missingRevisions: string[] = [],
25-
mutableRevisions: string[] = [],
26-
defaultRevs: string[] = []
25+
mutableRevisions: string[] = []
2726
) => {
2827
const { internalCommands, updatesPaused, mockPlotsDiff, dvcRunner } =
2928
buildDependencies(disposable)
@@ -36,10 +35,8 @@ suite('Plots Data Test Suite', () => {
3635

3736
const mockGetMissingRevisions = stub().returns(missingRevisions)
3837
const mockGetMutableRevisions = stub().returns(mutableRevisions)
39-
const mockGetDefaultRevs = stub().returns(defaultRevs)
4038

4139
const mockPlotsModel = {
42-
getDefaultRevs: mockGetDefaultRevs,
4340
getMissingRevisions: mockGetMissingRevisions,
4441
getMutableRevisions: mockGetMutableRevisions
4542
} as unknown as PlotsModel
@@ -62,38 +59,20 @@ suite('Plots Data Test Suite', () => {
6259
})
6360

6461
it('should call plots diff when there are no revisions to fetch and no experiment is running (workspace updates)', async () => {
65-
const defaultRevisions = ['workspace', '4d78b9e']
66-
const { data, mockPlotsDiff } = buildPlotsData(
67-
false,
68-
[],
69-
[],
70-
defaultRevisions
71-
)
62+
const { data, mockPlotsDiff } = buildPlotsData(false, [], [])
7263

7364
await data.update()
7465

7566
expect(mockPlotsDiff).to.be.calledOnce
76-
expect(mockPlotsDiff).to.be.calledWithExactly(
77-
dvcDemoPath,
78-
...defaultRevisions
79-
)
67+
expect(mockPlotsDiff).to.be.calledWithExactly(dvcDemoPath)
8068
})
8169

8270
it('should call plots diff when an experiment is running in the workspace (live updates)', async () => {
83-
const defaultRevisions = ['workspace', '4d78b9e']
84-
const { data, mockPlotsDiff } = buildPlotsData(
85-
true,
86-
[],
87-
['workspace'],
88-
defaultRevisions
89-
)
71+
const { data, mockPlotsDiff } = buildPlotsData(true, [], ['workspace'])
9072

9173
await data.update()
9274

93-
expect(mockPlotsDiff).to.be.calledWithExactly(
94-
dvcDemoPath,
95-
...defaultRevisions
96-
)
75+
expect(mockPlotsDiff).to.be.calledWithExactly(dvcDemoPath)
9776
})
9877

9978
it('should call plots diff when an experiment is running in a temporary directory (live updates)', async () => {

0 commit comments

Comments
 (0)