Always use ID to synthesize URLs

This commit is contained in:
Pieter Noordhuis 2024-10-17 17:17:17 +02:00
parent b1dd60c410
commit 7bf2ec378c
No known key found for this signature in database
GPG Key ID: 12ACCCC104CF2930
3 changed files with 5 additions and 5 deletions

View File

@ -42,13 +42,13 @@ func TestInitializeURLs(t *testing.T) {
}, },
Models: map[string]*resources.MlflowModel{ Models: map[string]*resources.MlflowModel{
"model1": { "model1": {
ID: "6", ID: "a model uses its name for identifier",
Model: &ml.Model{Name: "model1"}, Model: &ml.Model{Name: "model1"},
}, },
}, },
ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{
"servingendpoint1": { "servingendpoint1": {
ID: "7", ID: "my_serving_endpoint",
CreateServingEndpoint: &serving.CreateServingEndpoint{ CreateServingEndpoint: &serving.CreateServingEndpoint{
Name: "my_serving_endpoint", Name: "my_serving_endpoint",
}, },
@ -93,7 +93,7 @@ func TestInitializeURLs(t *testing.T) {
"job1": "https://mycompany.databricks.com/jobs/1?o=123456", "job1": "https://mycompany.databricks.com/jobs/1?o=123456",
"pipeline1": "https://mycompany.databricks.com/pipelines/3?o=123456", "pipeline1": "https://mycompany.databricks.com/pipelines/3?o=123456",
"experiment1": "https://mycompany.databricks.com/ml/experiments/4?o=123456", "experiment1": "https://mycompany.databricks.com/ml/experiments/4?o=123456",
"model1": "https://mycompany.databricks.com/ml/models/model1?o=123456", "model1": "https://mycompany.databricks.com/ml/models/a model uses its name for identifier?o=123456",
"servingendpoint1": "https://mycompany.databricks.com/ml/endpoints/my_serving_endpoint?o=123456", "servingendpoint1": "https://mycompany.databricks.com/ml/endpoints/my_serving_endpoint?o=123456",
"registeredmodel1": "https://mycompany.databricks.com/explore/data/models/8?o=123456", "registeredmodel1": "https://mycompany.databricks.com/explore/data/models/8?o=123456",
"qualityMonitor1": "https://mycompany.databricks.com/explore/data/catalog/schema/qualityMonitor1?o=123456", "qualityMonitor1": "https://mycompany.databricks.com/explore/data/catalog/schema/qualityMonitor1?o=123456",

View File

@ -45,7 +45,7 @@ func (s *MlflowModel) InitializeURL(urlPrefix string, urlSuffix string) {
if s.ID == "" { if s.ID == "" {
return return
} }
s.URL = urlPrefix + "ml/models/" + s.Name + urlSuffix s.URL = urlPrefix + "ml/models/" + s.ID + urlSuffix
} }
func (s *MlflowModel) GetName() string { func (s *MlflowModel) GetName() string {

View File

@ -53,7 +53,7 @@ func (s *ModelServingEndpoint) InitializeURL(urlPrefix string, urlSuffix string)
if s.ID == "" { if s.ID == "" {
return return
} }
s.URL = urlPrefix + "ml/endpoints/" + s.Name + urlSuffix s.URL = urlPrefix + "ml/endpoints/" + s.ID + urlSuffix
} }
func (s *ModelServingEndpoint) GetName() string { func (s *ModelServingEndpoint) GetName() string {