turian
February 4, 2023, 7:38am
1
How do I use the Python API to find and delete runs without a particular tag?
I tried writing this MongoDB query, but it doesn’t appear to work:
for r in (api.runs(
path...
filters={"tags": {"$in": "keep"}}
)):
This is similar to this post
turian
February 4, 2023, 8:51am
2
According to ChatGPT, I can use the following:
api.runs(entity_project, filters={"tags": "keep"}
However, it is not clear to me whether that means the tags must be “keep” and nothing else, or whether it matches all runs with “keep” in the list. I would love an example of this kind of query in the [code]( wandb/public.py at latest · wandb/wandb (github.com) )
Hi @turian , thanks for your question! You can delete runs without a concrete tag with a code like:
import wandb
api = wandb.Api()
runs = api.runs('entity_name/project_name')
for run in runs:
if "keep" not in run.tags:
run.delete()
Could you please try it and see if it works?
Hi @turian , I wanted to follow up on this request. Please let us know if we can be of further assistance or if your issue has been resolved.
turian
February 17, 2023, 10:10pm
5
Looks good! Marking as the solution
system
Closed
April 18, 2023, 10:11pm
6
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.