Skip to content

Commit ce2e2c7

Browse files
iterate on pr
1 parent 7289b79 commit ce2e2c7

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

acceptance/bundle/deploy/models/basic/output.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ Deployment complete!
7474
]
7575
}
7676

77-
=== destroy the model
7877
>>> [CLI] bundle destroy --auto-approve
7978
The following resources will be deleted:
8079
delete model my_model
@@ -83,6 +82,3 @@ All files and directories at the following location will be deleted: /Workspace/
8382

8483
Deleting files...
8584
Destroy complete!
86-
87-
>>> [CLI] bundle destroy --auto-approve
88-
No active deployment found to destroy!

acceptance/bundle/deploy/models/basic/script

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,3 @@ trace $CLI bundle deploy
2828

2929
title "GET Model"
3030
trace $CLI model-registry get-model my-model-$UNIQUE_NAME | jq '.registered_model_databricks | {name, description, tags}'
31-
32-
title "destroy the model"
33-
trace $CLI bundle destroy --auto-approve

bundle/direct/dresources/model.go

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,27 @@ func (r *ResourceMlflowModel) DoCreate(ctx context.Context, config *ml.CreateMod
5151
Name: response.RegisteredModel.Name,
5252
Description: response.RegisteredModel.Description,
5353
Tags: response.RegisteredModel.Tags,
54-
ForceSendFields: filterFields[ml.ModelDatabricks](response.RegisteredModel.ForceSendFields),
55-
// Skip coping fields that are not part of the bundle config tree.
54+
ForceSendFields: filterFields[ml.ModelDatabricks](response.RegisteredModel.ForceSendFields, "CreationTimestamp", "Id", "LastUpdatedTimestamp", "LatestVersions", "PermissionLevel", "UserId"),
55+
56+
// Coping the fields only to satisfy the linter. These fields are not
57+
// part of the configuration tree so they don't need to be copied.
58+
// The linter works as a safeguard to ensure we add new fields to the bundle config tree
59+
// to the mapping logic here as well.
60+
CreationTimestamp: 0,
61+
Id: "",
62+
LastUpdatedTimestamp: 0,
63+
LatestVersions: nil,
64+
PermissionLevel: "",
65+
UserId: "",
5666
}
5767
return response.RegisteredModel.Name, modelDatabricks, nil
5868
}
5969

6070
func (r *ResourceMlflowModel) DoUpdate(ctx context.Context, id string, config *ml.CreateModelRequest) (*ml.ModelDatabricks, error) {
6171
updateRequest := ml.UpdateModelRequest{
62-
Name: id,
63-
Description: config.Description,
64-
// Note: Name changes are not supported by the MLflow model registry API
65-
// Tags are updated separately via SetModelTag/DeleteModelTag operations
66-
// For simplicity, we only support description updates
72+
Name: id,
73+
Description: config.Description,
74+
ForceSendFields: filterFields[ml.UpdateModelRequest](config.ForceSendFields),
6775
}
6876

6977
response, err := r.client.ModelRegistry.UpdateModel(ctx, updateRequest)
@@ -77,8 +85,18 @@ func (r *ResourceMlflowModel) DoUpdate(ctx context.Context, id string, config *m
7785
Name: response.RegisteredModel.Name,
7886
Description: response.RegisteredModel.Description,
7987
Tags: response.RegisteredModel.Tags,
80-
ForceSendFields: filterFields[ml.ModelDatabricks](response.RegisteredModel.ForceSendFields),
81-
// Skip coping fields that are not part of the bundle config tree.
88+
ForceSendFields: filterFields[ml.ModelDatabricks](response.RegisteredModel.ForceSendFields, "CreationTimestamp", "Id", "LastUpdatedTimestamp", "LatestVersions", "PermissionLevel", "UserId"),
89+
90+
// Coping the fields only to satisfy the linter. These fields are not
91+
// part of the configuration tree so they don't need to be copied.
92+
// The linter works as a safeguard to ensure we add new fields to the bundle config tree
93+
// to the mapping logic here as well.
94+
CreationTimestamp: 0,
95+
Id: "",
96+
LastUpdatedTimestamp: 0,
97+
LatestVersions: nil,
98+
PermissionLevel: "",
99+
UserId: "",
82100
}
83101
return modelDatabricks, nil
84102
}

0 commit comments

Comments
 (0)