-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: detect and report on build warnings when not verbose #1
Comments
I had a look at the rosmake code, and it's just grepping the compiler output for the string I propose collecting stderr separately from stdout, and printing the entire stderr if it is non-empty. In my experiments, only warnings/errors ever land up in stderr. This solution avoids parsing gcc's output and thus extends nicely to other compilers / build systems. So |
There is technical difficulty in collecting stdout and stderr separately, because you will basically be giving up the interleave ordering. Meaning that things on stderr and stdout will be recorded in a different order than they would have appeared on the screen. This might be ok for the compiler, since errors tend to be all output on stderr, including the location of the error, but what you might loose is the location of the error with respect to normal compiler output or the output of I think the grepping will be needed additionally if we want to catch CMake also, because CMake does not output warnings to stderr in my experience. We should look more closely at the stderr capture trade-offs, but currently I think it is a pretty unattractive option. |
I'm assuming you are talking about these CMake warnings:
The warning is sent to stderr. Try I still feel parsing the output is the wrong way to go. The output may come from I'll research more if stdout/stderr interleaving is possible without losing the information from which channel the data came from. You're right, it's not trivial, but we cannot be the first ones wondering about it. I have a feeling that any solution will be platform-specific, though. |
…atkin#1 If something got printed on stderr by a build command, the user will want to know about it. So gather stderr separately from stdout and check if it is non-empty when the command finishes.
I made a rough draft of what I imagine here: xqms@6bc02c4 It's not in any way ready for close review or pulling as I haven't touched the Windows side yet. But maybe it's enough for evaluating the approach. I have just used the standard poll() approach for separate stdout/stderr channels and it seems to work fine. It dumps the interleaved stdout/stderr log if stderr is non-empty. I haven't tested with anything other than gcc yet, but I haven't seen any stdout/stderr reordering problems yet. And in any case, most people are running concurrent make, which will reorder things pretty arbitrarily anyway... |
@xqms it would be useful for you to open a pull request even if you do not consider it ready for merge so that we could discuss it and those discussions could be easily referenced from here. Thanks for taking some time to dig into it, maybe we can come up with a solution. |
Metadata file fixup - cleanup from Will
Has there been progress on this point? We've adapted Is this affecting other people as well? Are you always using something like |
Cool. I've had to refactor a bit of the |
@xqms refactoring catkin build to properly use Python's asyncio is probably a too big of a task, but if you wanted to try to wrap up the async subprocess calls (http://osrf-pycommon.readthedocs.org/en/latest/process_utils.html#osrf_pycommon.process_utils.async_execute_process) into a synchronous call and use that to replace the This CI script I recently wrote for ROS2 is very similar to what you'd have to do: https://github.com/ros2/ros2/blob/ci_scripts/ros2_batch_job/util.py#L168-L216 The benefit of using the |
One more thing, I haven't tried the stuff I linked to above in a multi threading situation. So your YMMV, and ultimately you may need to use a since |
@wjwwood How does this look as a starting point for the job executor? It lets you run https://gist.github.com/jbohren/9cd689c08782d6ffbcdf |
I had little time so far to really look at this myself :-( @jbohren That sounds very promising! If I understand correctly, you propose to completely remove the threading solution currently in place and replace it with your solution, right? It seems to me that there is not much missing... |
@jbohren That looks like a good start, but I was wondering, why are you using the |
I'm using multiprocessing in order to use a subclass of |
My understanding is that the https://github.com/ros-infrastructure/bloom/blob/master/test/utils/common.py#L141-L151 |
First, by forking a process, it means that they can truly perform asynchronously (no GIL). Second, doing this means it doesn't interfere with the |
Yeah, basically. As it stands, all it needs is to pump events into the |
The reason I point this out is that forking is expensive, and this is an activity that happens frequently (multiple times per package) and the only time it's advantageous to fork to avoid the GIL is when the resulting code is a long running process with a small amount of data to communicate across the IPC (which in our case is almost never true). For example, the first version of I would highly encourage you to try it without the multiprocess and compare the speed. And even if the forking is only 200ms slower, that's probably around 400-600ms per package, and on a 200 package workspace that will be one and a half minutes slower.
You're right that the example I gave above would affect the whole system, but there are other options for controlling logging of the data in these functors. You can capture stdout and stderr in a narrower scope (in the thread or even adjusting the locals of the function) or an even better solution, imo, is to just pass a logging object into the function and use that in the job stages which are actually Python functions. |
@wjwwood Here's the latest version which just passes a logging object to the blocking python functions: |
That all looks like the right direction to me; have you had a chance to look at the interleaved result when you capture stdout and stderr separately? I'd be curious to see if the output ordering is preserved when the system is under load. |
The interleaved capture definitely works under light load, but I haven't tested it under anything heavy. |
Updated the asynctest now with jobserver integration. https://gist.github.com/jbohren/9cd689c08782d6ffbcdf I haven't actually run it with a GNU make job yet, but it's now using the same underlying jobserver stuff to manager the number of async jobs. See here: https://gist.github.com/jbohren/9cd689c08782d6ffbcdf#file-asynctest-py-L216 |
This is now implemented following the merge of #249. |
I switched the default behavior to be quiet (hiding the output from build commands unless there is an error). The remaining concern is that warnings will go unnoticed by users.
To alleviate this we should find and report warnings from
cmake
andgcc
/clang
and report them. This shouldn't be too hard because we are already capturing all of the output from commands androsmake
did the same kind of parsing in order to collect and report on the warnings in a similar fashion. In fact, I plan on stealing the code fromrosmake
and refactoring it to work for thebuild
verb.The text was updated successfully, but these errors were encountered: