mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
add a Done event to model progress display
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
b046a5ef72
commit
f42374bb18
@ -83,20 +83,25 @@ func (s *composeService) ensureModels(ctx context.Context, project *types.Projec
|
|||||||
config.Name = name
|
config.Name = name
|
||||||
}
|
}
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
|
w := progress.ContextWriter(gctx)
|
||||||
if !slices.Contains(availableModels, config.Model) {
|
if !slices.Contains(availableModels, config.Model) {
|
||||||
err = s.pullModel(gctx, dockerModel, config, quietPull)
|
err = s.pullModel(gctx, dockerModel, config, quietPull, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s.configureModel(gctx, dockerModel, config)
|
err = s.configureModel(gctx, dockerModel, config, w)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
w.Event(progress.CreatedEvent(config.Name))
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return eg.Wait()
|
return eg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *composeService) pullModel(ctx context.Context, dockerModel *manager.Plugin, model types.ModelConfig, quietPull bool) error {
|
func (s *composeService) pullModel(ctx context.Context, dockerModel *manager.Plugin, model types.ModelConfig, quietPull bool, w progress.Writer) error {
|
||||||
w := progress.ContextWriter(ctx)
|
|
||||||
w.Event(progress.Event{
|
w.Event(progress.Event{
|
||||||
ID: model.Name,
|
ID: model.Name,
|
||||||
Status: progress.Working,
|
Status: progress.Working,
|
||||||
@ -145,7 +150,12 @@ func (s *composeService) pullModel(ctx context.Context, dockerModel *manager.Plu
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *composeService) configureModel(ctx context.Context, dockerModel *manager.Plugin, config types.ModelConfig) error {
|
func (s *composeService) configureModel(ctx context.Context, dockerModel *manager.Plugin, config types.ModelConfig, w progress.Writer) error {
|
||||||
|
w.Event(progress.Event{
|
||||||
|
ID: config.Name,
|
||||||
|
Status: progress.Working,
|
||||||
|
Text: "Configuring",
|
||||||
|
})
|
||||||
// configure [--context-size=<n>] MODEL [-- <runtime-flags...>]
|
// configure [--context-size=<n>] MODEL [-- <runtime-flags...>]
|
||||||
args := []string{"configure"}
|
args := []string{"configure"}
|
||||||
if config.ContextSize > 0 {
|
if config.ContextSize > 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user