Two (python) API Query Questions

I have two questions for the python wandb query related to book-keeping and tending to my recorded runs.

First, I sometimes delete sweeps but keep runs & artifacts as it’s the default option in the online UI. Is there any way to find these runs post delete of the sweep and delete them via python? I looked into the run-metadata etc but haven’t found what I was looking for.

Second, I am trying to find repeated sweeps (so sweeps with the same config-file). Is there any way to see which .yaml created the sweep?

Hi @leander-kurscheidt thank you for reaching out!

Unfortunately, once you’ve deleted a sweep, it’s not possible to determine which sweep ID a sweep run was created from. However, if you frequently need this information, consider using Tags or Notes to include these details in the runs. This way, you can use our API to retrieve the necessary information. Let me know if this solution works for you, or if you’d like an example to help get you started.

Regarding your second question, it is indeed possible to view this in the UI from the sweep’s overview page. However, we currently do not have a feature to compare (diff) sweep configurations within the App. Were you looking to achieve this programmatically using our API?

Regarding the second question, that’s definitely possible in the UI, from the sweep’s overview page. We don’t have any functionality to diff the sweep configs in the App. Were you looking to do that programmatically using our API?

Yes, I am using the API. My wandb projects is quite crowded and I want to automate finding orphaned runs and repeated sweeps to delete old runs.

Thank you for the clarification, @leander-kurscheidt.

You can use our API, specifically the api.runs method, to retrieve all runs. You can then loop through them and save their configurations in a dictionary. From there, you will need to implement some logic to remove duplicate entries. Would this approach work for you?

Here’s a minimal code snippet:

runs = api.runs("entity/project")
config_dict = {}
for r in runs:
    config_dict[] = r.config

Please let me know if you have any further questions or if this solution doesn’t meet your requirements.

1 Like

I find it unfortunate that the metadata that you can query by API is not more extensive. I would have hoped that everything necessary is there :frowning:

Hi @leander-kurscheidt just wanted to clarify that this is needed in your case because you’re deleting their corresponding Sweeps from the UI. Otherwise, it would have been easier to fetch that information. Please let me know if you had any more questions, or if there’s anything else relevant to this request that I could help.