How to retrieve the `group` and `job_type` of a resumed run?

I am inspecting and analysing my best runs. I expected that group and job_type would be populated with the resumed run’s values after running the code below.

run_id = input("id=")
with wandb.init(entity=wandb_entity, project=wandb_project, id=run_id, resume="must") as wandb_r:
    config = wandb_r.config
    group = wandb_r.group
    job_type = wandb_r.job_type

Even though config is successfully recovered, group and job_type are just empty strings. How do I retrieve group and job_type values from WandB? Thanks.

Hi @avm21, it looks like we don’t download these on resumed runs but rather we don’t update them unless you explicitly change them on a resumed run. If you need to get group/job_type you can use the public API like this to access anything you may need:

import wandb
from wandb import Api

api = Api()

with wandb.init(entity=wandb_entity, project=wandb_project, id=run_id, resume="must") as wandb_r:
    config = wandb_r.config

    # A resumed run will still have the path attribute which can be used to access the run via the API
    api_run = api.run(wandb_r.path)

    # This will correctly print the group of the run
    print(api_run.group)

Let me know if you have any questions around this.

Thank you,
Nate

Hi Nate,

Thank you for the snippet, it will do! The only question that remains is “why not?”, but I guess it is more of a rhetorical kind and does not necessitate an answer.

Regards,

Hi @avm21,
Glad this got you unblocked! I’m not sure the reasoning behind not downloading all metadata associated with the run when it is resumed but if you would like to see a change in this behavior I’d be happy to put a feature request around this?

Thank you,
Nate

Yes, I would like to see a change in this behaviour, even though I can live without it. I expected the fields of wandb_r to be repopulated on resume, and I guess other reasonable users would find this expectation reasonable. First, it is only logical that since wandb_r represents a run, the run’s properties are reflected in wandb_r’s properties. Second, it allows me to re-use code, for as far as I remember, wandb_r.group is set when I initiate a new run. Third, I’ve been always confused as to the purpose and difference between wandb.public.Api.Run and wandb.Run objects, and the fewer differences there are, the better I like it.

Kind regards,

@avm21, I’ve submitted your feedback to our engineering team. Thank you for the details as to why you feel this is important. I agree that it is counter-intuitive that some attributes are filled when resuming but some are not.

I’ll follow up with you here once the engineering team has a chance to take a look at this.

Thank you,
Nate

1 Like