[API] introduce the logic of artifact deletion considering artifact#502
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces significant logic for artifact deletion and reuse, including a parent-child relationship for artifacts stored in the ConfigMap. The changes are extensive, touching config parsing, ConfigMap reconciliation, and the main gopher logic. The code is well-refactored into smaller, more manageable functions, especially the new deletion logic in gopher.go and the robust ConfigMap update mechanisms in configmap_reconciler.go. The accompanying tests are thorough and cover many new scenarios and edge cases. I have a couple of minor suggestions for improvement.
| // Store the model entry in the ConfigMap | ||
| configMap.Data[key] = string(entryJSON) | ||
|
|
||
| c.logger.Infof("will update model profress in configmap for key %s", key) |
| Sha: currentArtifact.Sha, | ||
| ParentPath: currentArtifact.ParentPath, | ||
| ChildrenPaths: append([]string(nil), currentArtifact.ChildrenPaths...), | ||
| ChildrenPaths: currentArtifact.ChildrenPaths, |
There was a problem hiding this comment.
The ChildrenPaths slice is now assigned directly, whereas previously a copy was made using append. While this might be safe in the current context as the resulting ModelConfig is short-lived, it's generally safer to create a copy to prevent potential side effects if the source or destination slice is modified elsewhere. This makes the code more robust against future changes.
| ChildrenPaths: currentArtifact.ChildrenPaths, | |
| ChildrenPaths: append([]string(nil), currentArtifact.ChildrenPaths...), |
There was a problem hiding this comment.
introduce logics to handle edge case for both parentPath and chidlrenPaths
…ttribute in configmap 1. if the artifact directory does not have any symbolic link pointed to, remove the artifact directory. Otherwise, skip deleting artifact directory 2. if the parent artifact directory is dangling after the last child is deleted, delete the parent artifact directory after the last child artifact is deleted
55cb5fb to
472ed8d
Compare
…502) [API] introduce the logic of artifact deletion considering artifact attribute in configmap 1. if the artifact directory does not have any symbolic link pointed to, remove the artifact directory. Otherwise, skip deleting artifact directory 2. if the parent artifact directory is dangling after the last child is deleted, delete the parent artifact directory after the last child artifact is deleted
What this PR does
This is the 2nd PR of model artifact reuse feature #409 .
Introduce the logic of artifact deletion considering artifact attribute in configmap
Deletion logic:
Change internal contract:
Why we need it
efficiently remove the artifact directory without interfering with the usage
How to test
testEvidence-ModelDeletion.txt
Checklist
make testpasses locally