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

Merge (current/future) feed versions for MTC #186

Merged
merged 29 commits into from
May 6, 2019
Merged

Conversation

landonreed
Copy link
Contributor

@landonreed landonreed commented Feb 15, 2019

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
    mtc extension should be enabled.
  • All tests and CI builds passing

Description

This PR resolves #185, by refactoring the merge project feeds job into a generic merge job that can handle different merge strategies. These strategies now include: REGIONAL (for merging feeds for a project) and MTC (which actualizes the logic described in #185).

Conflicts:
	src/main/java/com/conveyal/datatools/manager/controllers/api/FeedVersionController.java
	src/main/java/com/conveyal/datatools/manager/jobs/MergeProjectFeedsJob.java
@landonreed landonreed added enhancement WIP Work in progress labels Feb 15, 2019
@evansiroky
Copy link
Contributor

I would really like to see some tests be made for the merging of feeds for both the MTC and REGIONAL merge types.

@codecov-io
Copy link

codecov-io commented Feb 19, 2019

Codecov Report

Merging #186 into dev will increase coverage by 7.31%.
The diff coverage is 58.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##               dev    #186      +/-   ##
==========================================
+ Coverage     6.19%   13.5%   +7.31%     
- Complexity     115     271     +156     
==========================================
  Files          133     146      +13     
  Lines         6971    7254     +283     
  Branches       914     973      +59     
==========================================
+ Hits           432     980     +548     
+ Misses        6503    6182     -321     
- Partials        36      92      +56
Impacted Files Coverage Δ Complexity Δ
...l/datatools/manager/jobs/ProcessSingleFeedJob.java 68.42% <ø> (+68.42%) 4 <0> (+4) ⬆️
.../datatools/manager/gtfsplus/CalendarAttribute.java 0% <0%> (ø) 0 <0> (?)
...conveyal/datatools/manager/gtfsplus/TimePoint.java 0% <0%> (ø) 0 <0> (?)
...nveyal/datatools/manager/jobs/ValidateFeedJob.java 66.66% <0%> (+66.66%) 4 <0> (+4) ⬆️
...veyal/datatools/manager/gtfsplus/RealtimeTrip.java 0% <0%> (ø) 0 <0> (?)
...eyal/datatools/manager/gtfsplus/RealtimeRoute.java 0% <0%> (ø) 0 <0> (?)
.../datatools/manager/gtfsplus/FareRiderCategory.java 0% <0%> (ø) 0 <0> (?)
.../datatools/manager/gtfsplus/FareZoneAttribute.java 0% <0%> (ø) 0 <0> (?)
...veyal/datatools/manager/gtfsplus/RealtimeStop.java 0% <0%> (ø) 0 <0> (?)
...eyal/datatools/manager/gtfsplus/GtfsPlusTable.java 0% <0%> (ø) 0 <0> (?)
... and 43 more

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 5c42853...f81ba52. Read the comment docs.

@landonreed landonreed removed the WIP Work in progress label Apr 3, 2019
Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the crapton of comments, most of them are cosmetic and asking for more comments on stuff. However, some other things I think are important to address also like trying to find a way to not write entire GTFS tables to an in-memory byte[], detecting merge failures for when agency_ids don't match up, and correctly counting remapped references.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Apr 4, 2019
@landonreed landonreed assigned evansiroky and unassigned landonreed Apr 25, 2019
@landonreed landonreed requested a review from evansiroky April 25, 2019 13:24
mergeFeedsResult.failed = true;
mergeFeedsResult.errorCount++;
mergeFeedsResult.failureReasons.add(
"If one stops.txt file contains stop_codes, both feed versions must stop_codes.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message could use some grammatical improvement.

// The line already exists in the output file, do not append it again. This prevents duplicate
// entries for certain files that do not contain primary keys (e.g., fare_rules and transfers) and
// do not otherwise have convenient ways to track uniqueness (like an order field).
// FIXME: add ordinal field/compound keys for transfers (from/to_stop_id) and fare_rules (?).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make an issue for this if we aren't going to fix this right away.

MergeFeedsType mergeType;
try {
mergeType = MergeFeedsType.valueOf(req.queryParams("mergeType"));
if (mergeType.equals(REGIONAL)) throw new IllegalArgumentException();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please populate the IllegalArgumentException with a string error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see that it's caught down below. Maybe it'd be good to specify that the REGIONAL type is not allowed for this endpoint.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good enough with the changes. I added 3 more comments that should be small matters.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Apr 25, 2019
@landonreed landonreed merged commit 8be5e4a into dev May 6, 2019
@landonreed landonreed deleted the merge-feed-versions-mtc branch May 6, 2019 19:17
@landonreed landonreed mentioned this pull request Jul 1, 2019
8 tasks
@landonreed
Copy link
Contributor Author

🎉 This PR is included in version 3.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Merge a future and current feed version from a common feed source
3 participants