Getting CLIReporter intermediate & final results table written to text file

I saw it mentioned in the documentation here (Console Output (Reporters) — Ray v1.1.0) although there isn’t an explicit example shown there. The log_to_file argument for tune.run only captures print statements and Python warnings, not the results table.

Appreciate all the help!

Hey @actuallyaswin, thanks for making this post. What’s the use case for this?

You could hypothetically just redirect the output to a file in your shell command right?

Thanks for the reply, Richard! That’s a good point, I guess I could just do python myscript.py | tee log.txt, and then it would just be an issue of how I control the verbosity.

So then log.txt would contain everything from the command prompt.

If I wanted to just capture the final results table alone and write it to a file, can I extract that from the resultant variable analysis = tune.run(...) somehow?

hmm, good question – I guess you could do something like:

progress_reporter = CLIReporter(...)
analysis = tune.run(...)
result_str = progress_reporter._progress_str(analysis.trials, done=True, "", "")

Though this isn’t a public interface. If you want, you could push a PR to make it public?