@@ -44,6 +44,7 @@ import { ConfigKey, getConfigValue, setUserConfigValue } from '../vscode/config'
4444import { checkSignalFile , pollSignalFileForProcess } from '../fileSystem'
4545import { DVCLIVE_ONLY_RUNNING_SIGNAL_FILE } from '../cli/dvc/constants'
4646import { Response } from '../vscode/response'
47+ import { Pipeline } from '../pipeline'
4748
4849export const ExperimentsScale = {
4950 ...omit ( ColumnType , 'TIMESTAMP' ) ,
@@ -64,8 +65,9 @@ export class Experiments extends BaseRepository<TableData> {
6465
6566 public readonly viewKey = ViewKey . EXPERIMENTS
6667
67- private readonly data : ExperimentsData
68+ private readonly pipeline : Pipeline
6869
70+ private readonly data : ExperimentsData
6971 private readonly experiments : ExperimentsModel
7072 private readonly columns : ColumnsModel
7173
@@ -96,17 +98,16 @@ export class Experiments extends BaseRepository<TableData> {
9698 private dvcLiveOnlyCleanupInitialized = false
9799 private dvcLiveOnlySignalFile : string
98100
99- private readonly addStage : ( ) => Promise < boolean >
100101 private readonly selectBranches : (
101102 branchesSelected : string [ ]
102103 ) => Promise < string [ ] | undefined >
103104
104105 constructor (
105106 dvcRoot : string ,
106107 internalCommands : InternalCommands ,
108+ pipeline : Pipeline ,
107109 resourceLocator : ResourceLocator ,
108110 workspaceState : Memento ,
109- addStage : ( ) => Promise < boolean > ,
110111 selectBranches : (
111112 branchesSelected : string [ ]
112113 ) => Promise < string [ ] | undefined > ,
@@ -120,7 +121,7 @@ export class Experiments extends BaseRepository<TableData> {
120121 )
121122
122123 this . internalCommands = internalCommands
123- this . addStage = addStage
124+ this . pipeline = pipeline
124125 this . selectBranches = selectBranches
125126
126127 this . onDidChangeIsExperimentsFileFocused = this . experimentsFileFocused . event
@@ -146,11 +147,6 @@ export class Experiments extends BaseRepository<TableData> {
146147 )
147148
148149 this . dispose . track ( this . data . onDidUpdate ( data => this . setState ( data ) ) )
149- this . dispose . track (
150- this . data . onDidChangeDvcYaml ( ( ) =>
151- this . webviewMessages . changeHasConfig ( true )
152- )
153- )
154150
155151 this . dispose . track (
156152 workspace . onDidChangeConfiguration ( ( event : ConfigurationChangeEvent ) => {
@@ -437,20 +433,30 @@ export class Experiments extends BaseRepository<TableData> {
437433 public async modifyWorkspaceParamsAndRun (
438434 commandId : ModifiedExperimentAndRunCommandId
439435 ) {
436+ const cwd = await this . getPipelineCwd ( )
437+ if ( ! cwd ) {
438+ return
439+ }
440+
440441 const paramsToModify = await this . pickAndModifyParams ( )
441442 if ( ! paramsToModify ) {
442443 return
443444 }
444445
445446 await this . internalCommands . executeCommand < string > (
446447 commandId ,
447- this . dvcRoot ,
448+ cwd ,
448449 ...paramsToModify
449450 )
450451 return this . notifyChanged ( )
451452 }
452453
453454 public async modifyWorkspaceParamsAndQueue ( ) {
455+ const cwd = await this . getPipelineCwd ( )
456+ if ( ! cwd ) {
457+ return
458+ }
459+
454460 const paramsToModify = await this . pickAndModifyParams ( )
455461 if ( ! paramsToModify ) {
456462 return
@@ -459,7 +465,7 @@ export class Experiments extends BaseRepository<TableData> {
459465 await Toast . showOutput (
460466 this . internalCommands . executeCommand < string > (
461467 AvailableCommands . EXP_QUEUE ,
462- this . dvcRoot ,
468+ cwd ,
463469 ...paramsToModify
464470 )
465471 )
@@ -521,16 +527,26 @@ export class Experiments extends BaseRepository<TableData> {
521527 return this . columns . getRelativeMetricsFiles ( )
522528 }
523529
530+ public getPipelineCwd ( ) {
531+ return this . pipeline . getCwd ( )
532+ }
533+
524534 protected sendInitialWebviewData ( ) {
525535 return this . webviewMessages . sendWebviewMessage ( )
526536 }
527537
528538 private setupInitialData ( ) {
529539 const waitForInitialData = this . dispose . track (
530- this . onDidChangeExperiments ( ( ) => {
540+ this . onDidChangeExperiments ( async ( ) => {
541+ await this . pipeline . isReady ( )
531542 this . deferred . resolve ( )
532543 this . dispose . untrack ( waitForInitialData )
533544 waitForInitialData . dispose ( )
545+ this . dispose . track (
546+ this . pipeline . onDidUpdate ( ( ) =>
547+ this . webviewMessages . sendWebviewMessage ( )
548+ )
549+ )
534550 } )
535551 )
536552 }
@@ -555,15 +571,10 @@ export class Experiments extends BaseRepository<TableData> {
555571 this . dvcRoot ,
556572 this . experiments ,
557573 this . columns ,
574+ this . pipeline ,
558575 ( ) => this . getWebview ( ) ,
559576 ( ) => this . notifyChanged ( ) ,
560577 ( ) => this . selectColumns ( ) ,
561- ( ) =>
562- this . internalCommands . executeCommand (
563- AvailableCommands . STAGE_LIST ,
564- this . dvcRoot
565- ) ,
566- ( ) => this . addStage ( ) ,
567578 ( branchesSelected : string [ ] ) => this . selectBranches ( branchesSelected ) ,
568579 ( ) => this . data . update ( )
569580 )
0 commit comments