Repository navigation
Add --progress: machine-readable JSON progress on stdout - #108
Open
zalmoxes-laran wants to merge 1 commit into
Open
zalmoxes-laran wants to merge 1 commit into
zalmoxes-laran wants to merge 1 commit into
Conversation
With --progress, Obj2Tiles also writes one JSON object per line on stdout:
{"stage":"decimation|splitting|tiling|packing","done":n,"total":m,"percent":p}
(splitting lines carry "lod": done/total count that LOD's tiles, percent is
the whole stage), then {"stage":"done","percent":100,"elapsed":s} after the
cleanup, or {"stage":"error","message":"..."} on failure.
Decimation advances once per LOD, splitting once per tile written (per LOD),
tiling once per converted tile plus the root tile. Writes are serialized, so
parallel workers never interleave a line and done never goes backwards.
The human log is unchanged and stays on stdout (its lines start with a space;
a reader keeps the lines starting with '{'). Without --progress the output is
the same as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an opt-in
--progressswitch that writes machine-readable progress on stdout, so that a program calling Obj2Tiles can show a real progress bar.--progress, Obj2Tiles prints one JSON object per line next to the usual log, e.g.{"stage":"splitting","lod":0,"done":5,"total":64,"percent":37.5}. Stages aredecimation,splitting,tilingandpacking(for.3tz); the run ends with{"stage":"done","percent":100,"elapsed":…}or{"stage":"error","message":"…"}, also when the options are rejected.--progressthe output is exactly what it is today. The usual log lines start with a space, so a caller keeps the lines that start with{.Stages/ProgressReporter.cs; the three stages receive an optional reporter (null when the switch is off).Obj2Tiles.Test/ProgressReporterTests.csandObj2Tiles.Test/Quality/CliProgressTests.cs(10 tests, all passing with .NET SDK 10.0.403). README: one row in the options table.Tried on a real textured mesh (a 3D survey of an architectural element, ~450k triangles): the native osx-arm64 build of this branch ran the default pipeline in 8.1 s using 812 MB, wrote a complete tileset (22 files, no errors) and the calling application (EMStudio, Extended Matrix, CNR-ISPC) drove its progress bar from these lines instead of estimating from the log.
Independent of #107 (osx-arm64 build); either can be merged first. Happy to rename the switch or adjust the format if you prefer something else.