kassonlab / gmxapi

(outdated) fork of https://gitlab.com/gromacs/gromacs
http://gmxapi.org/
Other
52 stars 13 forks source link

Accesing commandline output. #262

Open sperezconesa opened 4 years ago

sperezconesa commented 4 years ago

Hello,

Is it possible to access the contens of:

comand.output.erroroutput.result()

If the command doesn't fail. Sometimes this information is usefull to know. Thanks a lot and keep up the good work! Best, Sergio

eirrgang commented 4 years ago

Good question!

The short answer is probably a qualified "no"... and I should change that.

I believe you should see stdout and stderr mixed in the "debug" logging stream the way you would on the terminal. Using the Python logging module, you can catch logging.DEBUG level messages to the gmxapi.commandline logger. See https://gitlab.com/gromacs/gromacs/-/merge_requests/266/diffs for updated instructions.

But that's a workaround. I have opened an issue at https://gitlab.com/gromacs/gromacs/-/issues/3549 where we can continue the discussion. Feel free to submit a patch (as a merge request to GROMACS) or just to comment. I'll give it a day or two to stew, but then I'll try to get a patch up quickly.

But please let me know if the workaround is adequate (or even preferred).

sperezconesa commented 4 years ago

Hello, Thanks for considering this. I don't need this right away so I will wait for this to be solved. I am affraid I don't know enough about this to program a patch myself... But I will follow the discussion in case I can help out.

eirrgang commented 4 years ago

Thanks!

Can you also clarify whether you need STDOUT or STDERR as part of your workflow or just for debugging purposes? I.e. is logging sufficient or are result objects really what you need?

sperezconesa commented 4 years ago

I am using the analyze module and if calculating the blocking error the fit is not correct it says so in the output (not user if standard error or output). In any case, it easier to parse the commandline output than the xvg file that is generated. I am not really sure if distinguishing between STDOUT and STDERR is usefull or confusing sometimes.

eirrgang commented 4 years ago

Okay, so we are talking about a result that can be expected under normal circumstances and is a valid result. It is reasonable to expect that to be available as a regular output of the operation.

The Gromacs developers acknowledge that the tools don't always make the best use of STDOUT vs. STDERR, but I think that is beyond the scope of the present issue. I think it is fair to separate them (to simplify bookkeeping) and put them on equal footing from the standpoint of gmxapi outputs.