Skip to content

Commit fd244e3

Browse files
fix update
1 parent 7dd5dad commit fd244e3

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

bundle/direct/dresources/adapter.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ func (a *Adapter) initMethods(resource any) error {
220220
return err
221221
}
222222

223-
// Optional methods with varying signatures:
224-
223+
// Optional methods:
225224
a.doUpdateWithChanges, err = calladapt.PrepareCall(resource, calladapt.TypeOf[IResource](), "DoUpdateWithChanges")
226225
if err != nil {
227226
return err

bundle/direct/dresources/model_serving_endpoint.go

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/databricks/cli/libs/utils"
1111
"github.com/databricks/databricks-sdk-go"
1212
"github.com/databricks/databricks-sdk-go/service/serving"
13-
"golang.org/x/sync/errgroup"
1413
)
1514

1615
type ResourceModelServingEndpoint struct {
@@ -141,6 +140,10 @@ func (r *ResourceModelServingEndpoint) WaitAfterCreate(ctx context.Context, conf
141140
return r.waitForEndpointReady(ctx, config.Name)
142141
}
143142

143+
func (r *ResourceModelServingEndpoint) WaitAfterUpdate(ctx context.Context, config *serving.CreateServingEndpoint) (*RefreshOutput, error) {
144+
return r.waitForEndpointReady(ctx, config.Name)
145+
}
146+
144147
func (r *ResourceModelServingEndpoint) updateAiGateway(ctx context.Context, id string, aiGateway *serving.AiGatewayConfig) error {
145148
if aiGateway == nil {
146149
req := serving.PutAiGatewayRequest{
@@ -277,42 +280,42 @@ func (r *ResourceModelServingEndpoint) hasFieldChange(changes *deployplan.Change
277280
if changes == nil {
278281
return false
279282
}
280-
_, ok := changes.Local[fieldPath]
281-
return ok
283+
_, localChange := changes.Local[fieldPath]
284+
_, remoteChange := changes.Remote[fieldPath]
285+
return localChange || remoteChange
282286
}
283287

284288
func (r *ResourceModelServingEndpoint) DoUpdateWithChanges(ctx context.Context, id string, config *serving.CreateServingEndpoint, changes *deployplan.Changes) (*RefreshOutput, error) {
285-
errGroup := errgroup.Group{}
286-
289+
var err error
287290
if r.hasFieldChange(changes, "ai_gateway") {
288-
errGroup.Go(func() error {
289-
return r.updateAiGateway(ctx, id, config.AiGateway)
290-
})
291+
err = r.updateAiGateway(ctx, id, config.AiGateway)
292+
if err != nil {
293+
return nil, err
294+
}
291295
}
292296

293297
if r.hasFieldChange(changes, "config") {
294-
errGroup.Go(func() error {
295-
return r.updateConfig(ctx, id, config.Config)
296-
})
298+
err = r.updateConfig(ctx, id, config.Config)
299+
if err != nil {
300+
return nil, err
301+
}
297302
}
298303

299304
if r.hasFieldChange(changes, "email_notifications") {
300-
errGroup.Go(func() error {
301-
return r.updateNotifications(ctx, id, config.EmailNotifications)
302-
})
305+
err = r.updateNotifications(ctx, id, config.EmailNotifications)
306+
if err != nil {
307+
return nil, err
308+
}
303309
}
304310

305311
if r.hasFieldChange(changes, "tags") {
306-
errGroup.Go(func() error {
307-
return r.updateTags(ctx, id, config.Tags)
308-
})
309-
}
310-
311-
if err := errGroup.Wait(); err != nil {
312-
return nil, err
312+
err = r.updateTags(ctx, id, config.Tags)
313+
if err != nil {
314+
return nil, err
315+
}
313316
}
314317

315-
return r.waitForEndpointReady(ctx, id)
318+
return nil, nil
316319
}
317320

318321
func (r *ResourceModelServingEndpoint) DoDelete(ctx context.Context, id string) error {

0 commit comments

Comments
 (0)