-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run remote experiments data update in the background #4342
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,11 @@ import { getRelativePattern } from '../../fileSystem/relativePattern' | |
import { createFileSystemWatcher } from '../../fileSystem/watcher' | ||
import { AvailableCommands, InternalCommands } from '../../commands/internal' | ||
import { ExpShowOutput } from '../../cli/dvc/contract' | ||
import { BaseData, ExperimentsOutput } from '../../data' | ||
import { | ||
BaseData, | ||
ExperimentsOutput, | ||
isRemoteExperimentsOutput | ||
} from '../../data' | ||
import { Args, DOT_DVC, ExperimentFlag } from '../../cli/dvc/constants' | ||
import { COMMITS_SEPARATOR, gitPath } from '../../cli/git/constants' | ||
import { getGitPath } from '../../fileSystem' | ||
|
@@ -35,23 +39,18 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> { | |
|
||
void this.watchExpGitRefs() | ||
void this.managedUpdate() | ||
this.waitForInitialLocalData() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [F] Only care about the local data when initializing this class |
||
} | ||
|
||
public managedUpdate() { | ||
return this.processManager.run('update') | ||
} | ||
|
||
public async update(): Promise<void> { | ||
const [{ availableNbCommits, expShow, gitLog, rowOrder }, remoteExpRefs] = | ||
await Promise.all([this.updateExpShow(), this.updateRemoteExpRefs()]) | ||
|
||
return this.notifyChanged({ | ||
availableNbCommits, | ||
expShow, | ||
gitLog, | ||
remoteExpRefs, | ||
rowOrder | ||
}) | ||
await Promise.all([ | ||
this.notifyChanged(await this.updateExpShow()), | ||
this.notifyChanged(await this.updateRemoteExpRefs()) | ||
]) | ||
} | ||
|
||
private async updateExpShow() { | ||
|
@@ -162,10 +161,27 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> { | |
) | ||
} | ||
|
||
private updateRemoteExpRefs() { | ||
return this.internalCommands.executeCommand( | ||
AvailableCommands.GIT_GET_REMOTE_EXPERIMENT_REFS, | ||
this.dvcRoot | ||
private async updateRemoteExpRefs() { | ||
const [remoteExpRefs] = await Promise.all([ | ||
this.internalCommands.executeCommand( | ||
AvailableCommands.GIT_GET_REMOTE_EXPERIMENT_REFS, | ||
this.dvcRoot | ||
), | ||
this.isReady() | ||
]) | ||
return { remoteExpRefs } | ||
} | ||
|
||
private waitForInitialLocalData() { | ||
const waitForInitialData = this.dispose.track( | ||
this.onDidUpdate(data => { | ||
if (isRemoteExperimentsOutput(data)) { | ||
return | ||
} | ||
this.dispose.untrack(waitForInitialData) | ||
waitForInitialData.dispose() | ||
this.deferred.resolve() | ||
}) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ import { DecorationProvider } from './model/decorationProvider' | |
import { starredFilter } from './model/filterBy/constants' | ||
import { ResourceLocator } from '../resourceLocator' | ||
import { AvailableCommands, InternalCommands } from '../commands/internal' | ||
import { ExperimentsOutput } from '../data' | ||
import { ExperimentsOutput, isRemoteExperimentsOutput } from '../data' | ||
import { ViewKey } from '../webview/constants' | ||
import { BaseRepository } from '../webview/repository' | ||
import { Title } from '../vscode/title' | ||
|
@@ -173,24 +173,25 @@ export class Experiments extends BaseRepository<TableData> { | |
return this.data.managedUpdate() | ||
} | ||
|
||
public async setState({ | ||
availableNbCommits, | ||
expShow, | ||
gitLog, | ||
rowOrder, | ||
remoteExpRefs | ||
}: ExperimentsOutput) { | ||
public async setState(data: ExperimentsOutput) { | ||
if (isRemoteExperimentsOutput(data)) { | ||
const { remoteExpRefs } = data | ||
this.experiments.transformAndSetRemote(remoteExpRefs) | ||
return this.webviewMessages.sendWebviewMessage() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [F] Currently the only place that the remote data is needed |
||
} | ||
|
||
const { expShow, gitLog, rowOrder, availableNbCommits } = data | ||
|
||
const hadCheckpoints = this.hasCheckpoints() | ||
const dvcLiveOnly = await this.checkSignalFile() | ||
await Promise.all([ | ||
this.columns.transformAndSet(expShow), | ||
this.experiments.transformAndSet( | ||
this.experiments.transformAndSetLocal( | ||
expShow, | ||
gitLog, | ||
dvcLiveOnly, | ||
rowOrder, | ||
availableNbCommits, | ||
remoteExpRefs | ||
availableNbCommits | ||
) | ||
]) | ||
|
||
|
@@ -206,9 +207,10 @@ export class Experiments extends BaseRepository<TableData> { | |
return this.notifyChanged() | ||
} | ||
|
||
public unsetPushing(ids: string[]) { | ||
public async unsetPushing(ids: string[]) { | ||
await this.update() | ||
this.experiments.unsetPushing(ids) | ||
return this.update() | ||
return this.notifyChanged() | ||
} | ||
|
||
public hasCheckpoints() { | ||
|
@@ -579,7 +581,7 @@ export class Experiments extends BaseRepository<TableData> { | |
private setupInitialData() { | ||
const waitForInitialData = this.dispose.track( | ||
this.onDidChangeExperiments(async () => { | ||
await this.pipeline.isReady() | ||
await Promise.all([this.data.isReady(), this.pipeline.isReady()]) | ||
this.deferred.resolve() | ||
this.dispose.untrack(waitForInitialData) | ||
waitForInitialData.dispose() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] Had to rework this because we are now sending multiple notifications per update for experiments.