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

review prototype #12

Merged
merged 23 commits into from
May 30, 2021
Merged

review prototype #12

merged 23 commits into from
May 30, 2021

Conversation

ruffsl
Copy link
Owner

@ruffsl ruffsl commented Apr 26, 2021

A placeholder PR to review the current extension prototype of colcon-cache.

You can basically use the lock subverb to cache the current state of the packages in the workspace into lockfiles; either with dirhash, git, etc, depending upon what revision control system is detected using package augmentation extensions. Then when using build or test verbs, event handlers will update cache lock files for successful packages. The lock files also track dependency changes by default, making it simple to ensure upstream changes break downstream package caches. The package selection extensions enable users to filter packages by how the package source has changed, or if the current verb's cache for selected packages remain valid. See the Readme for example usage.

Preliminary feedback on extension architecture or suggestions for unit/system testing are welcome.

ruffsl added 14 commits April 18, 2021 10:03
* Update README

* add setup files

* add tests

* add scaffolding

* add CI checks

* Move test requirements outside hidden folder

* Cleanup formatting

* Update requirements

* Fix pip install

* simplify pip install

* Report code coverage

* Tag the upload with environment variables
to delineate python versions

* Only push latest python vertion to codeco
* Stage subverb template from colcon metadata

* Update subverb template

* Stage ListMetadataSubverb as template

* Update subverb template

* Create capture task submodule

* Stage PythonStageTask as template
from colcon/colcon-core#428

* Refactor snapshot capture task

* Stage StageVerb as template
from colcon/colcon-core#428

* Stage refactor

* Rename file

* Stage working task

* Stage template from dirhash

* Stage WIP on git task

* Change to markdown

* Fix linter errors
* Stage from colcon_package_selection as template

* Refactor event handler to store lockfiles

* Rename event handler

* Refactor tasks and helper functions

* Stage slection logic

* simplify slection logic

* Fix linter

* Overload comparison for SnapshotLockfile

* Fix event handler

* Regester snapshot package_selection entry point

* Fix linters
* Add package augmentation extensions
and use them to guid in task capture extension selection

* Fix linter

* Pass lockfile via metadat rather than returncode
between capture task and store lockfile event handler

* Allow the default vcs_type to be overridden
using other package augmentation extensions
with a diffrent default vcs_type and higher priortiy

* Cleanup comments
from colcon_snapshot to colcon_cache
from colcon_snapshot to colcon_cache
Rename extension to colcon_cache
* Do not set locfile if return code is not passing
even if the job is a cache task

* Stage arg reduction

* Fix return codes to ints

* Use verb as hint for mapping refrence

* Fix if logic
so a missing refrence lockfile isn't ignored
becuase of missing verb lockfile

* clarify help string

* Add package selection for lock change status

* Stage PackageSelectionExtensionPoint as template

* Remove unused code

* Rename temp file

* Add verb handler extensions

* Use verb handler extensions

* Update if guards

* Add warning for missing verb handler extentions

* Fix spelling typo

* Fix linter errors
* Set python path

* Stage all args from dirhash CLI

* Remove unneeded args

* Namespace dirhash args

* Simplify import

* Workarround to display help description
as colcon help display seems to ignore add_argument_group

* Rename default package augmentation to dirhash

* Update default package augmentation to dirhash

* Map dirhash keyargs

* Update job option

* Fix excape characters

* Add reset and ratchet modifiers for dirhash

* Fix linters
ignore dirhash for E501 for now
* Use revision reference and diff for git task

* Fix linters

* Fix argparse dest for kargs namespace filtering

* Use diff-index instead of diff
as it's faster and includes file modes
* Refactor CacheLockfile class

* Add consistency checks for lock_type

* Fix CacheLockfile load usage

* Simplify

* Revert usage of git diff-index
as output does not change with respect to
the changing of uncommited tracked files

* Fix linters
* Set lockfile upon task completion
as event handler is too late when caching dependencies

* Pass recursive dependencies
with build base paths

* Add lockfile tracking of recursive dependencies
* Fix linter for line length

* Add example usage
ruffsl added 4 commits May 3, 2021 00:36
* Simplify VerbHandlerExtensionPoint class

* Add tests for package_augmentation

* Stage test template
from colcon-core/test/test_build_python.py

* Ignore deprecation warnings in 3rd party modules
such as in scantree

* Checking WIP test
need to fix arg parsing

* Add init file to test folder

* Update requirements

* Skip WIP test for now

* Fix augmention for non git packages

* Extend tests

* Drop 3.5 from CI

* Simplify style

* Add test for cache lockfiles

* Extend test for cache lockfiles

* Remove dead code
Rename capture verb to lock
@codecov
Copy link

codecov bot commented May 3, 2021

Codecov Report

❗ No coverage uploaded for pull request base (review@d7bcf0e). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             review      #12   +/-   ##
=========================================
  Coverage          ?   27.65%           
=========================================
  Files             ?       19           
  Lines             ?      564           
  Branches          ?       79           
=========================================
  Hits              ?      156           
  Misses            ?      408           
  Partials          ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7bcf0e...b909bcb. Read the comment docs.

@ruffsl
Copy link
Owner Author

ruffsl commented May 6, 2021

FYI I'll be doing a show an tell about this during tomorrow's Tooling Working Group meeting.
Context: colcon/colcon-package-selection#25

CC'ing colcon contributors and perhaps interested parties in case you'd like to drop by:
@dirk-thomas @rotu @tfoote @cottsay @jacobperron @sloretz @mikaelarguedas @mikepurvis @emersonknapp @tylerjw

@ruffsl
Copy link
Owner Author

ruffsl commented May 6, 2021

BTW, @SteveMacenski @nuclearsandwich, this is the extension I was envisioning to be able to cache entire colcon workspaces across CI runs, so CI Jobs could intelligently build and test only the packages that have changed from the target PR branch and/or previous run/commit. This assumes the CI itself already properly keys the cache of the workspace appropriately, i.e. using the branch, arch, underlay state, etc, like we already do for Nav2's repo CI.

@mikepurvis
Copy link

@ruffsl I'm interested. Please invite me to the meeting.

@ruffsl
Copy link
Owner Author

ruffsl commented May 6, 2021

@ruffsl I'm interested. Please invite me to the meeting.

@mikepurvis , Calendar invites for ROS working groups should be publicly accessable from the ROS events calendar:

https://docs.ros.org/en/rolling/Governance.html#upcoming-ros-events

The agenda for the Tooling WG is also viewable here:

https://docs.google.com/document/d/1UXWaEkT6ji0Z0uTtJJSni5Y6fiopM9qOOzv4ldeNaAM/edit?usp=drivesdk

@nuclearsandwich
Copy link

Thanks for the ping. I'll do my best to join the show&tell tomorrow.

* Rename cache selection arguments
to use terms void and valid

* Add argument to denote respective cache verbs

* Simplify respective cache verb choices
@ruffsl
Copy link
Owner Author

ruffsl commented May 11, 2021

Here is an example of colcon-cache in action for caching builds and tests in CI: ruffsl/navigation2#6

ruffsl added 3 commits May 13, 2021 16:08
* Rephrase arg from changed to modified

* Prefix external entrypoints with cache

* Raname extention classes

* Rename files

* Rename class

* Rename modified arg

* Rename valid arg

* Add key arg

* Set missing kind using verb_handler_extension
Rephrase package selection extensions
as yaml safe load is too slow
@ruffsl ruffsl merged commit b909bcb into review May 30, 2021
@ruffsl ruffsl deleted the devel branch May 30, 2021 22:14
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

Successfully merging this pull request may close these issues.

3 participants