Is there a way to either 1) set a max to the number of versions an artifact can have (if more are uploaded then oldest get deleted), or 2) keep only the latest version?
Hello @parisi !
You can do this by deleting all artifacts that do not have the alias
latest (which is outlined here in our docs. You could write a script to assign tags to the last newest 5 artifacts by obtaining the versions of all artifacts and deleting anything that is not the five newest versions. However, deleting all artifacts but the
latest will be easier.
Warning: I would recommend waiting to delete artifacts once that have already been uploaded to
wandb. If you delete an artifact that is still in the middle of uploading, it may cause issues. For example, if you make deleting all but the latest artifact as part of your code, it may break the process since some artifacts will be delete before they are uploaded. Therefore, it would be safe to include a buffer i.e. delete all but the last 5 artifacts.
It would be nice to have a command to define a policy that takes care of that. Like
wand.config_artifacts where you define how many versions of each artifact (or what artifact, passing its name) you want to keep.
That is a fair recommendation and I can pass this to our SDK team via a feature request. The team is scoping on what methods to implement for artifact deletion so this will be helpful. Thanks!