colcon-dashboard 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.4
2
+ Name: colcon-dashboard
3
+ Version: 0.3.0
4
+ Summary: Live web dashboard for colcon builds: dependency graph, timeline, per-package logs, system pressure
5
+ Author-email: Mete Fatih Cırıt <mfc@autoware.org>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/autowarefoundation/colcon-dashboard
8
+ Project-URL: Issues, https://github.com/autowarefoundation/colcon-dashboard/issues
9
+ Keywords: colcon,ros,ros2,build,dashboard,autoware
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Dynamic: license-file
20
+
21
+ # Colcon Dashboard
22
+
23
+ A live web dashboard for `colcon build`. It shows how many packages are done, building, ready, waiting, or failed. It draws the dependency graph and colors each node as the build moves through it. Each package gets its own log pane, so logs never mix.
24
+
25
+ The server is one Python file. It uses only the standard library. It works on any colcon workspace, because it reads the `events.log` and `logger_all.log` files that colcon writes under `log/` for every build.
26
+
27
+ ## Install
28
+
29
+ The package has two parts: the `colcon-dashboard` command, and a colcon plugin that can start the dashboard when `colcon build` runs.
30
+
31
+ On Ubuntu, install the apt package from the PPA. This is the official method. It puts the plugin in the same Python environment as the apt colcon, where colcon finds it:
32
+
33
+ ```bash
34
+ sudo add-apt-repository ppa:xmfcx/colcon-dashboard
35
+ sudo apt install python3-colcon-dashboard
36
+ ```
37
+
38
+ For other setups, install from PyPI into the environment that runs colcon:
39
+
40
+ - colcon in a virtualenv or a conda environment: `pip install colcon-dashboard` in that environment.
41
+ - colcon installed with pipx: `pipx inject colcon-common-extensions colcon-dashboard`.
42
+ - For the `colcon-dashboard` command alone, without the plugin: `pipx install colcon-dashboard`.
43
+
44
+ To install from a checkout, replace the package name with the path to this repository.
45
+
46
+ ## Quick start
47
+
48
+ Run a build with the dashboard switched on. The plugin starts it and prints its address:
49
+
50
+ ```text
51
+ $ colcon build --event-handlers dashboard+
52
+ [colcon-dashboard] dashboard: http://127.0.0.1:8635/
53
+ ```
54
+
55
+ The plugin stays off by default, so a plain `colcon build` starts no server.
56
+
57
+ For daily use, turn it on once. Pick one of these:
58
+
59
+ Add this line to your `~/.bashrc`:
60
+
61
+ ```bash
62
+ export COLCON_DASHBOARD=1
63
+ ```
64
+
65
+ Or enable the handler in `~/.colcon/defaults.yaml`:
66
+
67
+ ```yaml
68
+ build:
69
+ event-handlers: [dashboard+]
70
+ ```
71
+
72
+ After that, every `colcon build` starts the dashboard, or reuses the one that already runs for the workspace. The command line toggle wins over the environment default in both directions.
73
+
74
+ Each workspace gets exactly one server, on a stable port derived from the workspace path. A second `colcon build` reuses it, and a file lock refuses duplicate servers. The server keeps running after the build, so the page stays available for the next build and for post-mortems.
75
+
76
+ You can also run it by hand, with or without the plugin:
77
+
78
+ ```bash
79
+ colcon-dashboard ~/projects/autoware # start, or print the running URL
80
+ colcon-dashboard ~/projects/autoware --stop # stop this workspace's server
81
+ colcon-dashboard --list # all running servers
82
+ colcon-dashboard --stop-all # stop every server
83
+ ```
84
+
85
+ The server follows `log/latest_build`. If a new build starts in the same workspace, the page switches to it and shows a notice.
86
+
87
+ ## What the page shows
88
+
89
+ ### Header
90
+
91
+ The header shows the workspace path, the build id, a LIVE / COMPLETE / FAILED / STOPPED badge, and the parallel worker count.
92
+
93
+ The right side is the system strip. A colcon build can exhaust the machine, so pressure stays visible at all times:
94
+
95
+ - A per-core heatmap, one cell per core. Cell color runs from the idle gray to full blue at 100% use. Hover a cell for the exact number.
96
+ - CPU, RAM, and swap meters. A fill turns amber under pressure (CPU 85%, RAM 75%, swap 30%) and red near the limit (96%, 90%, 70%). At red the label also turns red and bold.
97
+ - Hover the CPU meter for the load average. Hover the RAM meter for the exact percentage.
98
+
99
+ ### Progress strip
100
+
101
+ The meter fills as the build advances: green for done, animated blue stripes for building, red for failed, orange for aborted.
102
+
103
+ The tiles count each state: done of total, building, ready, waiting (plus a blocked count after a failure), failed, aborted, and skipped. Elapsed time and the rate in packages per minute sit at the end.
104
+
105
+ ### Dependency graph
106
+
107
+ Every package in the build, laid out left to right by dependency depth. An edge points from a dependency to the package that needs it.
108
+
109
+ Node states combine color, border, and motion:
110
+
111
+ - **Done**: a green wash.
112
+ - **Building**: a blue box that slowly breathes, desynced per node. The box fills left to right with a deeper blue as make reports `[ 42%]` progress, and the label stays legible on top.
113
+ - **Ready**: a dashed blue border. All dependencies are done, and the package starts as soon as a worker frees.
114
+ - **Next up**: a slow pulse. This waiting package starts when the packages that build now finish, because no deeper dependency blocks it.
115
+ - **Waiting**: quiet gray. **Skipped**: gray with a struck label.
116
+ - **Failed**: solid red. Everything downstream of a failure turns red-dashed with red edges. This blast radius stays distinct from packages that were merely abandoned when the build stopped.
117
+ - **Aborted**: orange. The package was building when the build stopped.
118
+
119
+ Edges take color from their endpoints:
120
+
121
+ - Light green between two done packages: finished lineage.
122
+ - Solid blue into a building package, with droplets that flow along the edge at constant speed: the package consumes its finished dependencies.
123
+ - Dashed blue marching into a next-up package: what it waits for.
124
+ - Red along the failure cascade.
125
+
126
+ Interaction:
127
+
128
+ - Hover a node to see its state, phase, time, stderr count, and path, and to light its full dependency chain while the rest dims.
129
+ - Click a node to open its log pane.
130
+ - Drag to pan, scroll to zoom. **Fit** frames the whole graph. **Frontier** zooms to what builds now.
131
+ - **This build / All packages** switches between the build's packages and the whole workspace.
132
+ - When most package names share a prefix such as `autoware_`, the labels hide it. Tooltips keep the full name.
133
+
134
+ ### Layout modes
135
+
136
+ The **layout** menu picks one of three modes, and the choice persists:
137
+
138
+ - `layered`: the static left-to-right layout described above.
139
+ - `force`: a live spring simulation with the same left-to-right anchoring. Drag nodes to rearrange. The simulation cools and stops by itself.
140
+ - `3d`: the build as a wavefront. Building packages share one central plane, finished discs stack to its left, and waiting discs queue to the right by dependency depth. Packages glide through the blue plane as the build advances. Left-drag orbits, shift-drag or right-drag or middle-drag pans, the wheel zooms, and the camera rotates by itself until the first grab.
141
+
142
+ Fit and Frontier drive the camera in every mode. In the force and 3D modes, a **spread** slider in the corner scales how far the simulation spreads the nodes.
143
+
144
+ ### Timeline
145
+
146
+ A Gantt chart of every started package, sorted by start time, with a time axis and a dashed now line. Bar colors match the graph states.
147
+
148
+ The chart makes the parallelism and the long serial chains visible. It auto-scrolls to the newest bars as they start; scroll up to release, or use the **⤓ follow new** toggle.
149
+
150
+ ### Log panes
151
+
152
+ The dock opens with a pinned **build log** tab: the whole build as a terminal would show it, with `Starting >>>` and `Finished <<<` lines between every package's output. Click any package in the graph or the timeline to open its own tab next to it. Each tab has its own scrollback, so logs never interleave.
153
+
154
+ - A pane follows new output until you scroll up. The **⤓ follow** button re-engages.
155
+ - Panes open at the tail for an instant start. **⤒ load all** fetches the whole history in one click.
156
+ - Every line carries a timestamp: build-relative in the build log, job-relative in package panes. The **🕒 ts** button hides them.
157
+ - The **search** box filters as you type: matching lines highlight, Enter and Shift+Enter step through them, and the search stays live while the log streams.
158
+ - A selector switches a package pane between the timestamped output, `stdout+stderr`, `stderr`, `stdout`, and the command log.
159
+ - ANSI colors render as in a terminal: the 16 classic colors, 256-color, and truecolor, with palettes tuned per theme. Uncolored lines that match error or warning patterns still get color.
160
+ - When a package fails, its pane opens by itself and a toast points to it.
161
+ - Drag the bar above the dock to resize it.
162
+
163
+ ### Theme
164
+
165
+ The page follows the system theme. The ◐ button cycles system, light, and dark. Every view recolors instantly, including the 3D canvas.
166
+
167
+ ## How it works
168
+
169
+ colcon writes a structured event stream to `log/<build>/events.log`. The server tails this file and reconstructs the exact job set from it. `JobQueued` events carry the full dependency closure of each job, as colcon resolved it. `JobStarted`, `JobEnded`, and `JobSkipped` events give the state machine. `TimerEvent` heartbeats give liveness, so the LIVE badge does not depend on process inspection.
170
+
171
+ The graph shows direct edges, not the full closure. The server computes the transitive reduction of colcon's per-job dependency sets. Package metadata (path, build type) and the edges of packages outside the current build come from a scan of the `package.xml` files in the workspace.
172
+
173
+ Per-package logs come from `log/<build>/<package>/`. The server serves them incrementally by byte offset, so an open pane costs one small request per second.
174
+
175
+ ## Options
176
+
177
+ | Flag | Default | Meaning |
178
+ |---|---|---|
179
+ | `workspace` | `.` | Colcon workspace root (positional) |
180
+ | `--port` | stable per-workspace port | HTTP port. The default falls back to a free port when taken |
181
+ | `--host` | `127.0.0.1` | Bind address. Use `0.0.0.0` to reach the page from another machine |
182
+ | `--log-base` | `log` | Log directory, relative to the workspace |
183
+ | `--stop` | | Stop the server that watches this workspace |
184
+ | `--list` | | List the running servers of all workspaces |
185
+ | `--stop-all` | | Stop the servers of all workspaces |
186
+
187
+ ## API
188
+
189
+ | Endpoint | Returns |
190
+ |---|---|
191
+ | `/api/state` | Job states, counts, timings, build metadata |
192
+ | `/api/graph` | Direct dependency edges for the graph views |
193
+ | `/api/builds` | The `build_*` directories under the log base |
194
+ | `/api/log/<pkg>?offset=N&file=combined` | A log chunk from byte `N`, plus the new offset |
195
+
196
+ ## Limits
197
+
198
+ - One server watches one workspace, and a lock enforces it. Each workspace gets its own server and port.
199
+ - The page follows the latest build. Finished builds stay readable until a new build starts.
200
+ - The server trusts the local workspace. Do not expose the port to an untrusted network.
@@ -0,0 +1,180 @@
1
+ # Colcon Dashboard
2
+
3
+ A live web dashboard for `colcon build`. It shows how many packages are done, building, ready, waiting, or failed. It draws the dependency graph and colors each node as the build moves through it. Each package gets its own log pane, so logs never mix.
4
+
5
+ The server is one Python file. It uses only the standard library. It works on any colcon workspace, because it reads the `events.log` and `logger_all.log` files that colcon writes under `log/` for every build.
6
+
7
+ ## Install
8
+
9
+ The package has two parts: the `colcon-dashboard` command, and a colcon plugin that can start the dashboard when `colcon build` runs.
10
+
11
+ On Ubuntu, install the apt package from the PPA. This is the official method. It puts the plugin in the same Python environment as the apt colcon, where colcon finds it:
12
+
13
+ ```bash
14
+ sudo add-apt-repository ppa:xmfcx/colcon-dashboard
15
+ sudo apt install python3-colcon-dashboard
16
+ ```
17
+
18
+ For other setups, install from PyPI into the environment that runs colcon:
19
+
20
+ - colcon in a virtualenv or a conda environment: `pip install colcon-dashboard` in that environment.
21
+ - colcon installed with pipx: `pipx inject colcon-common-extensions colcon-dashboard`.
22
+ - For the `colcon-dashboard` command alone, without the plugin: `pipx install colcon-dashboard`.
23
+
24
+ To install from a checkout, replace the package name with the path to this repository.
25
+
26
+ ## Quick start
27
+
28
+ Run a build with the dashboard switched on. The plugin starts it and prints its address:
29
+
30
+ ```text
31
+ $ colcon build --event-handlers dashboard+
32
+ [colcon-dashboard] dashboard: http://127.0.0.1:8635/
33
+ ```
34
+
35
+ The plugin stays off by default, so a plain `colcon build` starts no server.
36
+
37
+ For daily use, turn it on once. Pick one of these:
38
+
39
+ Add this line to your `~/.bashrc`:
40
+
41
+ ```bash
42
+ export COLCON_DASHBOARD=1
43
+ ```
44
+
45
+ Or enable the handler in `~/.colcon/defaults.yaml`:
46
+
47
+ ```yaml
48
+ build:
49
+ event-handlers: [dashboard+]
50
+ ```
51
+
52
+ After that, every `colcon build` starts the dashboard, or reuses the one that already runs for the workspace. The command line toggle wins over the environment default in both directions.
53
+
54
+ Each workspace gets exactly one server, on a stable port derived from the workspace path. A second `colcon build` reuses it, and a file lock refuses duplicate servers. The server keeps running after the build, so the page stays available for the next build and for post-mortems.
55
+
56
+ You can also run it by hand, with or without the plugin:
57
+
58
+ ```bash
59
+ colcon-dashboard ~/projects/autoware # start, or print the running URL
60
+ colcon-dashboard ~/projects/autoware --stop # stop this workspace's server
61
+ colcon-dashboard --list # all running servers
62
+ colcon-dashboard --stop-all # stop every server
63
+ ```
64
+
65
+ The server follows `log/latest_build`. If a new build starts in the same workspace, the page switches to it and shows a notice.
66
+
67
+ ## What the page shows
68
+
69
+ ### Header
70
+
71
+ The header shows the workspace path, the build id, a LIVE / COMPLETE / FAILED / STOPPED badge, and the parallel worker count.
72
+
73
+ The right side is the system strip. A colcon build can exhaust the machine, so pressure stays visible at all times:
74
+
75
+ - A per-core heatmap, one cell per core. Cell color runs from the idle gray to full blue at 100% use. Hover a cell for the exact number.
76
+ - CPU, RAM, and swap meters. A fill turns amber under pressure (CPU 85%, RAM 75%, swap 30%) and red near the limit (96%, 90%, 70%). At red the label also turns red and bold.
77
+ - Hover the CPU meter for the load average. Hover the RAM meter for the exact percentage.
78
+
79
+ ### Progress strip
80
+
81
+ The meter fills as the build advances: green for done, animated blue stripes for building, red for failed, orange for aborted.
82
+
83
+ The tiles count each state: done of total, building, ready, waiting (plus a blocked count after a failure), failed, aborted, and skipped. Elapsed time and the rate in packages per minute sit at the end.
84
+
85
+ ### Dependency graph
86
+
87
+ Every package in the build, laid out left to right by dependency depth. An edge points from a dependency to the package that needs it.
88
+
89
+ Node states combine color, border, and motion:
90
+
91
+ - **Done**: a green wash.
92
+ - **Building**: a blue box that slowly breathes, desynced per node. The box fills left to right with a deeper blue as make reports `[ 42%]` progress, and the label stays legible on top.
93
+ - **Ready**: a dashed blue border. All dependencies are done, and the package starts as soon as a worker frees.
94
+ - **Next up**: a slow pulse. This waiting package starts when the packages that build now finish, because no deeper dependency blocks it.
95
+ - **Waiting**: quiet gray. **Skipped**: gray with a struck label.
96
+ - **Failed**: solid red. Everything downstream of a failure turns red-dashed with red edges. This blast radius stays distinct from packages that were merely abandoned when the build stopped.
97
+ - **Aborted**: orange. The package was building when the build stopped.
98
+
99
+ Edges take color from their endpoints:
100
+
101
+ - Light green between two done packages: finished lineage.
102
+ - Solid blue into a building package, with droplets that flow along the edge at constant speed: the package consumes its finished dependencies.
103
+ - Dashed blue marching into a next-up package: what it waits for.
104
+ - Red along the failure cascade.
105
+
106
+ Interaction:
107
+
108
+ - Hover a node to see its state, phase, time, stderr count, and path, and to light its full dependency chain while the rest dims.
109
+ - Click a node to open its log pane.
110
+ - Drag to pan, scroll to zoom. **Fit** frames the whole graph. **Frontier** zooms to what builds now.
111
+ - **This build / All packages** switches between the build's packages and the whole workspace.
112
+ - When most package names share a prefix such as `autoware_`, the labels hide it. Tooltips keep the full name.
113
+
114
+ ### Layout modes
115
+
116
+ The **layout** menu picks one of three modes, and the choice persists:
117
+
118
+ - `layered`: the static left-to-right layout described above.
119
+ - `force`: a live spring simulation with the same left-to-right anchoring. Drag nodes to rearrange. The simulation cools and stops by itself.
120
+ - `3d`: the build as a wavefront. Building packages share one central plane, finished discs stack to its left, and waiting discs queue to the right by dependency depth. Packages glide through the blue plane as the build advances. Left-drag orbits, shift-drag or right-drag or middle-drag pans, the wheel zooms, and the camera rotates by itself until the first grab.
121
+
122
+ Fit and Frontier drive the camera in every mode. In the force and 3D modes, a **spread** slider in the corner scales how far the simulation spreads the nodes.
123
+
124
+ ### Timeline
125
+
126
+ A Gantt chart of every started package, sorted by start time, with a time axis and a dashed now line. Bar colors match the graph states.
127
+
128
+ The chart makes the parallelism and the long serial chains visible. It auto-scrolls to the newest bars as they start; scroll up to release, or use the **⤓ follow new** toggle.
129
+
130
+ ### Log panes
131
+
132
+ The dock opens with a pinned **build log** tab: the whole build as a terminal would show it, with `Starting >>>` and `Finished <<<` lines between every package's output. Click any package in the graph or the timeline to open its own tab next to it. Each tab has its own scrollback, so logs never interleave.
133
+
134
+ - A pane follows new output until you scroll up. The **⤓ follow** button re-engages.
135
+ - Panes open at the tail for an instant start. **⤒ load all** fetches the whole history in one click.
136
+ - Every line carries a timestamp: build-relative in the build log, job-relative in package panes. The **🕒 ts** button hides them.
137
+ - The **search** box filters as you type: matching lines highlight, Enter and Shift+Enter step through them, and the search stays live while the log streams.
138
+ - A selector switches a package pane between the timestamped output, `stdout+stderr`, `stderr`, `stdout`, and the command log.
139
+ - ANSI colors render as in a terminal: the 16 classic colors, 256-color, and truecolor, with palettes tuned per theme. Uncolored lines that match error or warning patterns still get color.
140
+ - When a package fails, its pane opens by itself and a toast points to it.
141
+ - Drag the bar above the dock to resize it.
142
+
143
+ ### Theme
144
+
145
+ The page follows the system theme. The ◐ button cycles system, light, and dark. Every view recolors instantly, including the 3D canvas.
146
+
147
+ ## How it works
148
+
149
+ colcon writes a structured event stream to `log/<build>/events.log`. The server tails this file and reconstructs the exact job set from it. `JobQueued` events carry the full dependency closure of each job, as colcon resolved it. `JobStarted`, `JobEnded`, and `JobSkipped` events give the state machine. `TimerEvent` heartbeats give liveness, so the LIVE badge does not depend on process inspection.
150
+
151
+ The graph shows direct edges, not the full closure. The server computes the transitive reduction of colcon's per-job dependency sets. Package metadata (path, build type) and the edges of packages outside the current build come from a scan of the `package.xml` files in the workspace.
152
+
153
+ Per-package logs come from `log/<build>/<package>/`. The server serves them incrementally by byte offset, so an open pane costs one small request per second.
154
+
155
+ ## Options
156
+
157
+ | Flag | Default | Meaning |
158
+ |---|---|---|
159
+ | `workspace` | `.` | Colcon workspace root (positional) |
160
+ | `--port` | stable per-workspace port | HTTP port. The default falls back to a free port when taken |
161
+ | `--host` | `127.0.0.1` | Bind address. Use `0.0.0.0` to reach the page from another machine |
162
+ | `--log-base` | `log` | Log directory, relative to the workspace |
163
+ | `--stop` | | Stop the server that watches this workspace |
164
+ | `--list` | | List the running servers of all workspaces |
165
+ | `--stop-all` | | Stop the servers of all workspaces |
166
+
167
+ ## API
168
+
169
+ | Endpoint | Returns |
170
+ |---|---|
171
+ | `/api/state` | Job states, counts, timings, build metadata |
172
+ | `/api/graph` | Direct dependency edges for the graph views |
173
+ | `/api/builds` | The `build_*` directories under the log base |
174
+ | `/api/log/<pkg>?offset=N&file=combined` | A log chunk from byte `N`, plus the new offset |
175
+
176
+ ## Limits
177
+
178
+ - One server watches one workspace, and a lock enforces it. Each workspace gets its own server and port.
179
+ - The page follows the latest build. Finished builds stay readable until a new build starts.
180
+ - The server trusts the local workspace. Do not expose the port to an untrusted network.
@@ -0,0 +1,3 @@
1
+ """Colcon Dashboard: a live web dashboard for colcon builds."""
2
+
3
+ __version__ = "0.3.0"
@@ -0,0 +1,3 @@
1
+ from .server import main
2
+
3
+ main()
@@ -0,0 +1,42 @@
1
+ """colcon event handler that spawns the dashboard when a build starts.
2
+
3
+ Loaded by colcon through the `colcon_core.event_handler` entry point. The
4
+ handler is off by default: enable it for one build with
5
+ `--event-handlers dashboard+`, for every build with
6
+ `COLCON_DASHBOARD=1`, or through `~/.colcon/defaults.yaml`. The
7
+ command line toggle always wins over the environment default.
8
+ """
9
+
10
+ import os
11
+
12
+ from colcon_core.event_handler import EventHandlerExtensionPoint
13
+ from colcon_core.plugin_system import satisfies_version
14
+
15
+
16
+ class DashboardEventHandler(EventHandlerExtensionPoint):
17
+ """Serve a live web dashboard for this build."""
18
+
19
+ def __init__(self): # noqa: D107
20
+ super().__init__()
21
+ satisfies_version(
22
+ EventHandlerExtensionPoint.EXTENSION_POINT_VERSION, "^1.0")
23
+ # off by default: starting a server must be a choice, not a surprise
24
+ self.enabled = os.environ.get(
25
+ "COLCON_DASHBOARD", "").lower() in ("1", "yes", "true", "on")
26
+ self._done = False
27
+
28
+ def __call__(self, event): # noqa: D102
29
+ if self._done:
30
+ return
31
+ self._done = True
32
+ args = getattr(self.context, "args", None)
33
+ if getattr(args, "verb_name", None) != "build":
34
+ return
35
+ try:
36
+ # imported lazily: never let the dashboard break a build
37
+ from colcon_dashboard.server import ensure_running
38
+ url, _started = ensure_running(os.getcwd())
39
+ if url:
40
+ print(f"[colcon-dashboard] dashboard: {url}")
41
+ except Exception: # noqa: BLE001
42
+ pass