buildstream-migration / bst-staging

GNU Lesser General Public License v2.1
0 stars 0 forks source link

Buildstream plugin output being suppressed #772

Open Cynical-Optimist opened 4 years ago

Cynical-Optimist commented 4 years ago

See original issue on GitLab In GitLab by [Gitlab user @adds68] on Nov 19, 2018, 17:12

Summary

When debugging a plugin for BuildStream, you have to rely on output from the bst command, in order to see what is being parsed/logged as part of the pipeline. However it seems when changing the plugin source code, and even removing the artifacts cache, bst seems to suppress output.

I am having to add print statements to my plugin in order to check the output is valid, at first the print statements seemed to work, however i was getting truncated output. But after a few runs, output has been suppressed completely.

Steps to reproduce

Add a local plugin to your bst pipeline, add some print statements to plugin, run the pipeline and see if the output appears as expected.

What is the current bug behavior?

It seem bst will sometimes log the output from a plugin, then on another occasion suppress the output.

What is the expected correct behavior?

I'm not really sure, however there should be some documented way of debugging a plugin!

Relevant logs and/or screenshots

Possible fixes

Other relevant information


Cynical-Optimist commented 4 years ago

In GitLab by [Gitlab user @jonathanmaw] on Nov 19, 2018, 18:06

The specific reasons behind this behaviour is that some parts of a plugin (e.g. configure) are run in the main process, and some parts of a plugin (e.g. assemble) are run in a subprocess. Plugin.info (or status, debug, warning, error, etc.) methods pass the messages back to the main process to be printed.

As an aside, I'll go into the specifics of how message handling works:

I think the problem is that these methods don't work (or didn't work last time I checked) in the configure method, so a habit's formed to use print statements everywhere (since they sometimes work in subprocesses).

I think the first thing to do would be to check whether there are still problems with using Plugin.info from configure. If not, we should find an appropriate place to document how to send error messages. If there are still problems with Plugin.info in configure, then we should create an issue for this.