Skip to content
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

Requesting clarification in documentation #43

Open
zflat opened this issue Nov 17, 2022 · 2 comments
Open

Requesting clarification in documentation #43

zflat opened this issue Nov 17, 2022 · 2 comments

Comments

@zflat
Copy link

zflat commented Nov 17, 2022

Thanks @ruffsl for this helpful extension! I am using this to speed up CI for feature branches and would like to seek some clarification to what is described in the README. (Also, much thanks to providing a nice readme instead of just a mostly empty file only containing the package name!)

Can you please explain the purpose of the --packages-select-cache-key? For example, where would I look to see what the default key is and why would I need to override it?

Also, the lock workflow is not intuitive to me. In the quick start example, why do I need to lock the workspace before the first colcon build and also after the minor source file changes? When colcon build --packages-skip-cache-valid is run, does it re-hash the package and compare to what is cached? Or does the hashing only happen when colcon lock is called? Also, it appears that lockfiles are also updated/created after the build and test verbs too (as described by the sentence "Upon successful task completion for a package job, as when evoking colcon verbs like build, test, etc, these lockfiles are updated for the evoked verb, thereby delineating the provenance of the job’s results"). To my understanding, the verb lock is a bit strong because it sounds like other actions would not be permitted to make changes to lockfiles, but that is not the case. To me, the verb is closer to hash or maybe update to manually trigger an update to the lock files.

I think that a more detailed explanation (maybe annotating the example) of what creates and or modifies which lock files and what checks against the lock files are performed would be helpful. Also, an example of using --packages-select-cache-key would be helpful.

Overall, I think that understanding that there are some "automatic" updates to lock files depending on using verbs like build and test is an important concept that a new user may not be aware of based on the current example and explanation.

@ruffsl
Copy link
Owner

ruffsl commented Nov 17, 2022

Hey @zflat , neat to hear your use of this extension to speed up CI. If you like to see a real world example using this extension, we've been using it rather heavily for the Nav2 project for over a year or so:

Can you please explain the purpose of the --packages-select-cache-key? For example, where would I look to see what the default key is and why would I need to override it?

The purpose of the --packages-select-cache-key is to override the default cache key selected by the verb handler. For example, the verb handler for the "colcon list", it uses the same verb handler for "colcon cache", which defines what lockfiles are to be used for comparison or reference. When used with package selection, this can be helpful when listing what caches are still valid for other colcon verbs (e.g. not just for "colcon list").

In Nav2 for example, we do this to list packages with invalidated caches for specifically the "colcon build" verb, so that we can determine the package builds that must be subsequently cleaned:

https://github.com/ros-planning/navigation2/blob/5547a20ae711417af90768d9d594a4524064e1ca/.circleci/config.yml#L163-L169

Also, the lock workflow is not intuitive to me.

The level of abstraction with caching results for colcon verbs, verbs that transitively depend on other verbs, makes this difficult to describe. The hashing of source files (or query to detected revision control) is only invoked with the "colcon cache lock" subverb. I suppose this could have been abbreviated to the root verb "colcon cache", but I suspected I may want to add more extension subverbs in the future, so I pushed that hashing funatilty into a "lock" subverb, as "colcon cache cache" seemed too peculiar.

The updating of lockfiles is currently simply a copy operation upon a successful task for the package, where the invoked colcon verb triggers an event handler that copies the lockfile from the verb it transitively depends upon. E.g. the build verb depends upon the cache verb, and the test verb depends upon the build verb. This pattern could be extended for any other verbs via more registered event handlers.

I think that a more detailed explanation (maybe annotating the example) of what creates and or modifies which lock files and what checks against the lock files are performed would be helpful.

I can add a "How does it work" section to the readme, but I'd first like to finish refactoring where the lockfiles are written and read from in the colcon workspace, as to store the lockfiles closer to the artifacts they claim to represent:

@zflat
Copy link
Author

zflat commented Nov 18, 2022

Thanks @ruffsl for the explanation! The example of using a different --packages-select-cache-key makes it more clear to me now.

It is helpful to know that the build verb lock file is just copied from the cache verb. And I think that a "how it works" section would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants