API: how to retrieve the history of system metrics?

My runs log system metrics in terms of CPU, GPU, memory, etc. Now I would like to retrieve this data from the wandb API as a full history.
So far I could find the following from the code:

api = wandb.Api()
run = api.runs(f’{entity}/{project}/({id}')
run.systemMetrics

{‘system.cpu’: 2.11, ‘system.disk’: 52.62, ‘system.memory’: 57.94, ‘system.network.recv’: 86752114.33, ‘system.network.sent’: 95145834.13, ‘system.proc.cpu.threads’: 584, …, system.proc.memory.availableMB’: 42311.25}

These are apparently the final system metric logs of the run. Is it somehow possible to also retrieve the full history?

Thanks in advance for any help!

Reference:

wandb, Version: 0.15.4
For future reference, this gives the full system metrics history as a dataframe:

system_metrics = run.history(stream=‘systemMetrics’)

Hi @janousy thanks for writing in and taking the time to post how you’ve solved this issue. Under the hood stream will be currently either default or events (relevant code in our repo). Therefore, for any future changes it would be best to use it as in our example in Docs - copied below:

import wandb
api = wandb.Api()

run = api.run("<entity>/<project>/<run_id>")
system_metrics = run.history(stream="events")
system_metrics.to_csv("sys_metrics.csv")

I hope this helps! We will close this ticket on our end as this is resolved for you, but feel free to reopen the conversation if you had any other questions.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.