How to Capture STDOUT for esrally?

Attempting to run esrally commands as a Jenkins job using a docker container. I simply want to see the output printed out in the Jenkins console. For simple commands like "esrally --version" or "esrally --help" this works fine. When invoking a subcommand like "esrally list tracks" or ultimately running a race, there is no output.

Taking Jenkins out of the picture, I tried to simply redirect to a file and as expected the following worked:

esrally --version > output.txt
esrally --help > output.txt

But the following produced only empty files:

esrally list tracks > output.txt

So it appears when invoking subcommands, the output is not actually going to stdout? Is there a way around this? I know of the --report-file option, but that only works if the command is successful only when running a track, and will not produce a report for subcommands or if the track fails.

Appreciate any help if anyone has experienced something similar.

Thanks!

I think I found the issue.

Removed the check for isatty() in esrally/utils/console.py and can now redirect to a file. Not sure of the repercussions though.

def println(msg, console_prefix=None, end="\n", flush=False, logger=None, overline=None, underline=None):
# TODO: Checking for sys.stdout.isatty() prevents shell redirections and pipes (useful for list commands). Can we remove this check?
if not QUIET and sys.stdout.isatty():
complete_msg = "%s %s" % (console_prefix, msg) if console_prefix else msg
if overline:
print(format.underline_for(complete_msg, underline_symbol=overline), flush=flush)
print(complete_msg, end=end, flush=flush)
if underline:
print(format.underline_for(complete_msg, underline_symbol=underline), flush=flush)
if logger:
logger(msg)

Hi,

I have raised https://github.com/elastic/rally/pull/677 which will allow you to redirect Rally's command line output as long as the Rally daemon is not involved (it does not seem to be in your case), i.e. what you're describing should be possible with the next version (1.1.0) of Rally.

Daniel

Thank you Daniel

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