Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 214
Stop tracking file path locations in bundle resources#1673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
dabe9a9e66bc0a6c43f56e5bf1607028cf9f18d0d8b7add3039a7d57375c94813886fa2ad2c45de37e2f552f4166bd1c7425f7cf746d10f84c694a2c60407c05ef9a05ffacb9f1f21bb617845692b3d81a0fe7b2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,81 +21,14 @@ type Resources struct { | ||
| Schemas map[string]*resources.Schema `json:"schemas,omitempty"` | ||
| } | ||
| type resource struct { | ||
| resource ConfigResource | ||
| resource_type string | ||
| key string | ||
| } | ||
| func (r *Resources) allResources() []resource { | ||
| all := make([]resource, 0) | ||
| for k, e := range r.Jobs { | ||
| all = append(all, resource{resource_type: "job", resource: e, key: k}) | ||
| } | ||
| for k, e := range r.Pipelines { | ||
| all = append(all, resource{resource_type: "pipeline", resource: e, key: k}) | ||
| } | ||
| for k, e := range r.Models { | ||
| all = append(all, resource{resource_type: "model", resource: e, key: k}) | ||
| } | ||
| for k, e := range r.Experiments { | ||
| all = append(all, resource{resource_type: "experiment", resource: e, key: k}) | ||
| } | ||
| for k, e := range r.ModelServingEndpoints { | ||
| all = append(all, resource{resource_type: "serving endpoint", resource: e, key: k}) | ||
| } | ||
| for k, e := range r.RegisteredModels { | ||
| all = append(all, resource{resource_type: "registered model", resource: e, key: k}) | ||
| } | ||
| for k, e := range r.QualityMonitors { | ||
| all = append(all, resource{resource_type: "quality monitor", resource: e, key: k}) | ||
| } | ||
| return all | ||
| } | ||
| func (r *Resources) VerifyAllResourcesDefined() error { | ||
| all := r.allResources() | ||
| for _, e := range all { | ||
| err := e.resource.Validate() | ||
| if err != nil { | ||
| return fmt.Errorf("%s %s is not defined", e.resource_type, e.key) | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
| // ConfigureConfigFilePath sets the specified path for all resources contained in this instance. | ||
| // This property is used to correctly resolve paths relative to the path | ||
| // of the configuration file they were defined in. | ||
| func (r *Resources) ConfigureConfigFilePath() { | ||
| for _, e := range r.Jobs { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| for _, e := range r.Pipelines { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| for _, e := range r.Models { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| for _, e := range r.Experiments { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| for _, e := range r.ModelServingEndpoints { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| for _, e := range r.RegisteredModels { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| for _, e := range r.QualityMonitors { | ||
| e.ConfigureConfigFilePath() | ||
| } | ||
| } | ||
| type ConfigResource interface { | ||
pietern marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // Function to assert if the resource exists in the workspace configured in | ||
| // the input workspace client. | ||
| Exists(ctx context.Context, w *databricks.WorkspaceClient, id string) (bool, error) | ||
| // Terraform equivalent name of the resource. For example "databricks_job" | ||
| // for jobs and "databricks_pipeline" for pipelines. | ||
| TerraformResourceName() string | ||
| Validate() error | ||
| } | ||
| func (r *Resources) FindResourceByConfigKey(key string) (ConfigResource, error) { | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change covered by
TestExpandGlobs_*unit tests