Skip to content

Merge dev into master: send each worker only its shapes (#289) - #291

Merged
rafapereirabr merged 2 commits into
masterfrom
dev
Oct 5, 2026
Merged

rafapereirabr merged 2 commits into
masterfrom
dev

Conversation

@rafapereirabr

Copy link
Copy Markdown
Collaborator

Merges dev into master: the per-shape slicing change from #289 / #290.

What reaches master

The speed-loop vectorisation (#287) is already on master via #288.

Merge check

master has #281 (parallelly, version 2.1-4) that dev does not; the two touch different lines of R/gtfs2gps.R and merge cleanly. devtools::test(filter = "gtfs2gps") passed locally on the combined tree (6 tests, 0 failures). The full CI matrix runs on this PR.

🤖 Generated with Claude Code

rafapereirabr and others added 2 commits October 5, 2026 16:27
gtfs2gps() defined its per-shape worker corefun() as a closure inside its
own frame, so every chunk shipped to a furrr worker carried the entire frame:
the full feed after frequency expansion, the shapes, and everything else.
That meant K copies of the feed in memory, K x feed size through PSOCK
sockets before any work started, and the future globals cap refusing large
feeds altogether ("The total size of the 23 globals exported ... exceeds the
maximum allowed size", #277). The closure also rescanned the full trips and
stop_times tables for every shape.

The worker is now a package-level pair: shape_to_gps() is the old body
moved verbatim with the feed references renamed to a per-shape `slice`, and
convert_shape() wraps it with the progress tick and returns any error as a
condition object. gtfs2gps() splits trips, stop_times, stops and geometry per
shape once and maps convert_shape() over the slices, passing the routes table
and the scalar options as arguments; a shape missing from a split gets a
typed empty table so the existing guards report it as before. Failures are
collected from the returned values: the old `badShapes <<-` collector
assigned inside the worker's copy of the frame and never reached the parent
when parallel = TRUE.

Output is unchanged: identical column by column to the previous build on
all five bundled feeds, sequentially and with 2 workers. With
future.globals.maxSize = 4 MiB the previous build fails on fortaleza
("4.71 MiB exceeds 4.00 MiB"); this one runs at 2 MiB. Peak memory of the
process tree with 4 workers: fortaleza 1272 -> 897 MB, berlin 1153 -> 835 MB.

Known change for invalid feeds only: a trip_id listed under two shapes is
converted once, with the first shape in trips.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Bring #289 (send each worker only its shapes) into dev
@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.30201% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.94%. Comparing base (d856c5d) to head (0769fa5).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
R/gtfs2gps.R 95.30% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   94.32%   94.94%   +0.61%     
==========================================
  Files          17       17              
  Lines         687      692       +5     
==========================================
+ Hits          648      657       +9     
+ Misses         39       35       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rafapereirabr
rafapereirabr merged commit 250de85 into master Oct 5, 2026
8 checks passed
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.

1 participant