-
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
[PR196 1/3] New asyncio-based execution engine #249
Conversation
log(clr("[build] @!@{rf}Error:@| The workspace packages have a circular " | ||
"dependency, and cannot be built. Please run `catkin list " | ||
"--deps` to determine the problematic package(s).")) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above provides a more graceful failure for #229
Sorry, answered to the wrong PR. I'm putting this here again so it's in the right place ;-) Thanks for your work on separating this! I just saw a unicode exception here:
The unicode character 2018 is "LEFT SINGLE QUOTATION MARK", emitted by gcc on my system:
|
Sorry, this may have been caused by running I'll investigate further. |
@xqms Yeah, overall, the unicode encoding/decoding needs to be cleaned up before or after this gets merged. Can you simulate the stdout encoding in a unit test? |
aadf139
to
78f8d4b
Compare
For reference, I was able to fix my issue by setting the environment variable
I guess we should define the wanted behavior first. I'd propose that bytes captured from a job should be passed through 1:1 without caring about the encoding. First decoding to unicode and then re-encoding again to some variable output encoding is just asking for trouble. This might conflict with the need to actually parse the output (e.g. line splitting). Checking for the newline byte should still be possible without decoding to unicode, though... |
One question: Why are we downloading and compiling catkin from github and then sourcing the resulting |
Well, we're getting catkin from github on Travis because it's a prerequisite for building the Catkin packages.
@NikolausDemmel Which tests are failing, and are you running the tests in a clean environment, or after sourcing some setup file? If it's a clean environment, I would expect any tests which build Catkin CMake packages to fail. |
Would it make sense to have a copy of catkin in the test suite for that?
Clean environment w-r-t ROS, i.e. I haven't sourced any setup file, catkin is not available. It makes sense as you say. Output of test command is: https://gist.github.com/NikolausDemmel/b7e5acea3ec3539672c3#file-catkin_tools-nosetests |
I don't think that's necessary. It might be best to fix the version (or even add more versions to the matrix), though. What do you think, @wjwwood?
Yeah, that's what I would expect, all's good. |
I just find it a bit strange that after downloading But in any case there should be some documentation about this if catkin is not included. I believe on your |
Yeah, I'm just always weary of copying source code around. If anything, I'd have the tests check it out from source and build/source it.
That sounds reasonable, I'll add that to #250. |
My preference would be to have the tests check out a copy of catkin during the test setup. Other necessities like |
By necessity, catkin_tools and catkin are joined at the hip— it makes sense to have tests on catkin_tools which will detect breaking changes in catkin proper. |
I don't actually agree with the first half of that statement 😄. It should be perfectly capable (in the future if not now) of installing a workspace full of pure cmake packages. But I do agree that the main use case is to use it in conjunction with catkin. It's not clear to me what version of catkin it should checkout, e.g. the indigo-devel branch or the latest release tag and in the future when there are multiple "latest" releases to choose from, which one? It might even require it to be a configuration of the tests and to be added to the matrix of things to test. |
Here's the simplest way to implement this, as shown over in #251 |
#sudo add-apt-repository ppa:fkrull/deadsnakes -y | ||
#sudo apt-get update | ||
#sudo apt-get install python3.4 python3-dev | ||
#fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is left over from before 3.4 was available on Travis Precise.
Does this need to be rebased? |
You need to lead the output with |
Sorry that should be: |
Also, should the warnings be re-quoted when using
I haven't checked the behavior when using |
Another small thing I noticed are snippets like this one: |
Other than the overwriting of the status line when using |
… warnings on interleaved, and fixing CMake output parsing bug
I think we need to print the status line after new input, but there might a performance trade-off. For now I think it's good enough; we can address things after merging. |
I also think we may not be closing out child processes correctly. But I can investigate that more later. |
[PR196 1/3] New asyncio-based execution engine
Yeah, I was thinking that, too.
👏 Awesome. |
Nice!! |
Congrats on getting this merged - I think this has been a major step forward :-) |
This PR is the first set of refactored partial changes from PR #196 relating only to the execution engine and I/O handling, without the "linked" develspace support nor improved
catkin clean
support. It also includes the changes from #247 (and supersedes #248). This is meant to be a "functional" PR and it is expected that it might need further small revisions before being merged. This also adds a Travis CI configuration that builds on Linux as well as OS X.Main Module Changes
catkin_tools/common.py
The changes in
catkin_tools.common
include the following:FakeLock
with an asyncio-based implementationget_recursive_build_dependants_in_workspace
function which gives the packages that depend on a given package in the workspace. (This is used in the future)os.Popen
withsubprocess.Popen
slice_to_printed_length
fails if the length is larger than the length of the lookup array.IOError
when the program receives asigint
during awide_log
messagemkdir_p
function which recursively makes directoriescatkin_tools/resultspace.py
The main change to
catkin_tools.resultspace
is the addition of environment and env hook checksum caching. This enables faster builds by using theresultspace
mechanism instead of thebuild_env.sh
mechanism. Theresultspace
loading can also cache the environment, and updates the cache when a resultspace's Catkin env_hooks change in any way.It also adds a
strict
flag which controls whether or not to check for a.catkin
file before loading the environment.catkin_tools/argument_parsing.py
The changes in
catkin_tools.argument_parsing
mainly support the new job server, which is initialized even when there isn't any support for the GNU Make jobserver, to allow for future extensions to the jobserver in other contexts (distcc, ninja, etc).Execution Engine
The execution engine consists of the main asyncio-based
Executor
,Job
s, and jobStage
s described in #196. Jobs for different catkin build types are defined via setuptoolsentry_points
. This improves job parallelism, but also provides a mechanism for capturingstdout
andstderr
independently. As such, warnings and errors are now detected and printed in a much clearer manner.This PR improves on the CMake and Catkin jobs defined in #196 by forgoing using the
build_env.sh
script, and instead using thecatkin_tools.resultspace
-based environment loading. This not only speeds up builds, but it also fixes a bug that prevented single-pass workspace building as described in this thread.More details on the design of the execution engine are forthcoming via a documentation PR #250
Job Environments
Previously, each build job got its environment from a
build_env.sh
file, which was generated before the package was built. This shell script essentially sources the resultspace that each job is meant to be built against.This PR adds the ability to cache the resulting environment from sourcing these resultspace setup file. In addition to speeding up all builds, it speeds up building already-built packages dramatically. For the Hydro
ros-base
workspace (172 packages),catkin build
without env caching takes about 30 seconds, andcatkin build
with env caching takes about 10 seconds. This means that it's saving between 0.1-0.2 seconds per package, which adds up. Note that this effect becomes more dramatic as more workspaces are chained.This PR removes the
build_env.sh
files entirely, and instead opts for a non-static way to get the environment for a job. This is the--env
option which can be passed to any verb which supports it. So to get the environment in whichqt_gui_cpp
is built, you could runcatkin build --env qt_gui_cpp
, and it will print the environment tostdout
. This is used instead ofbuild_env.sh
to reproduce build stages as well, as shown below:Since this feature changes behavior, it is off by default, but can be enabled / disabled with
--env-cache
and--no-env-cache
, respectively.Addresses the Following Issues
Enhancements
-p
option is set to whatever the-j
option isDefinite Bugfixes
catkin test
alias doesn't always work #139 - Runningcatkin test
doesn't work under Hydro (fixed in [PR196+] jobs: Fixing environment required to run catkin test targets on pre-indigo catkin #265)CATKIN_SHELL
environment variableLikely Bugfixes (through different implementation)
Outstanding Issues
--env-cache
and--no-env-cache
options to control caching of resultspace environments--summarize
option is given.catkin
file (implemented in [PR196 1/3+] Generate .catkin develspace manifest file #271)CommandStage
mutable default argument (fixed in 8a542c6)CommandStage
env
argument to make behavior clearer (fixed in 8a542c6)DESTDIR
support is broken (fixed in destdir: Resurrecting destdir support, adding test case (PR#196) #251)catkin
package is in the workspace, it's skipped (fixed in destdir: Resurrecting destdir support, adding test case (PR#196) #251)build_env.sh
files, and instead utilizes a more platform-independent resultspace sourcing model, butbuild_env.sh
is still used in the isolated devel setup. Enhancements are staged in [PR196-mod] Cleaning up use of build env and adding repro messages #254.build_env.sh
(completed in [PR196-mod] Cleaning up use of build env and adding repro messages #254)catkin build
i.e.catkin build --env PKG
which dumps the resultspace environment to the console. This would enable debugging of the build environment used to buildPKG
as well as build stage repro. like:cd /path/to/build && env "$(catkin build --env PKG)" make
(added in [PR196-mod] Cleaning up use of build env and adding repro messages #254)