I’m trying to programmatically retrieve the full console logs from one of my runs – essentially the same output shown under the Logs tab (including all stdout/stderr and any wandb: messages). My goal is to save these logs locally for debugging, archival, or post-processing purposes.
What I’ve tried/researched:
-
Using the Python API for run history: I attempted
wandb.Api().run("entity/project/run_id").history(), but realized this only returns metrics logged viawandb.log()(the run’s history of metrics), not the console text. -
Listing run files: I used
run.files()and noticed that for a finished run, there is anoutput.logfile (which I believe contains the console output). In the web UI, I also see a “Download logs” button for finished runs. I suspect I can download that file via the API (maybe withrun.file("output.log").download()as hinted in [W&B docs/forums]). Before going down that route, I wanted to confirm if this is the recommended approach. -
Runs not finished: One concern is runs that crash or are still running. In one case, a run crashed and I didn’t see an
output.login the files. The UI still displayed the partial logs, but there was no download button. I came across a GitHub issue suggesting thatoutput.logis only downloadable for finished runs, not for crashes. Is there any workaround or API method to get logs from a crashed or ongoing run? For example, can we fetch the live log stream or force an upload of the log before a run finishes?
What I’m looking for:
-
A supported way (via the W&B Python SDK or CLI) to download the complete console log of a run. If the solution is to use the Python API to grab
output.log, I’ll gladly do that – just want to ensure I’m not missing a more direct method. -
Any best practices for capturing these logs, especially in cases where a run might not finish cleanly. My use case is to automatically archive logs for all runs (successful or not) for later analysis.
I appreciate any guidance! If there’s an existing feature or a known workaround that I missed, please let me know. Thank you in advance for your help ![]()