-
Notifications
You must be signed in to change notification settings - Fork 53
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
Threaded validation #513
Merged
Merged
Threaded validation #513
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2180c98
refactor(threaded valiators): Original and mobility data validation e…
4920630
refactor(Handling of feed version saving): Control saving and update …
2932f39
chore(deps): bump mongodb-driver-sync from 4.0.5 to 4.0.6
dependabot[bot] ea3f00c
Merge pull request #475 from ibi-group/dependabot/maven/org.mongodb-m…
binh-dam-ibigroup 08fcbc3
Merge branch 'mobility-data-validator' into threaded-validation
7b23e23
refactor(Added feed version delete): Delete the feed version if the V…
69aff00
Merge branch 'dev' into threaded-validation
miles-grant-ibigroup 346b97c
chore(Dockerfile): update java version
miles-grant-ibigroup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
52 changes: 52 additions & 0 deletions
52
src/main/java/com/conveyal/datatools/manager/jobs/ValidateMobilityDataFeedJob.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.conveyal.datatools.manager.jobs; | ||
|
||
import com.conveyal.datatools.common.status.FeedVersionJob; | ||
import com.conveyal.datatools.manager.auth.Auth0UserProfile; | ||
import com.conveyal.datatools.manager.models.FeedVersion; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* This job handles the MobilityData validation of a given feed version. If the version is not new, it will simply | ||
* replace the existing version with the version object that has updated validation info. | ||
*/ | ||
public class ValidateMobilityDataFeedJob extends FeedVersionJob { | ||
public static final Logger LOG = LoggerFactory.getLogger(ValidateMobilityDataFeedJob.class); | ||
|
||
private FeedVersion feedVersion; | ||
|
||
public ValidateMobilityDataFeedJob(FeedVersion version, Auth0UserProfile owner) { | ||
super(owner, "Validating Feed using MobilityData", JobType.VALIDATE_FEED); | ||
feedVersion = version; | ||
status.update("Waiting to begin MobilityData validation...", 0); | ||
} | ||
|
||
@Override | ||
public void jobLogic () { | ||
LOG.info("Running ValidateMobilityDataFeedJob for {}", feedVersion.id); | ||
feedVersion.validateMobility(status); | ||
} | ||
|
||
@Override | ||
public void jobFinished () { | ||
status.completeSuccessfully("MobilityData validation finished!"); | ||
} | ||
|
||
/** | ||
* Getter that allows a client to know the ID of the feed version that will be created as soon as the upload is | ||
* initiated; however, we will not store the FeedVersion in the mongo application database until the upload and | ||
* processing is completed. This prevents clients from manipulating GTFS data before it is entirely imported. | ||
*/ | ||
@JsonProperty | ||
public String getFeedVersionId () { | ||
return feedVersion.id; | ||
} | ||
|
||
@JsonProperty | ||
public String getFeedSourceId () { | ||
return feedVersion.parentFeedSource().id; | ||
} | ||
|
||
|
||
} |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "regular" parsing step was previously persisting the
this
to mongo. If the mobility data parser finishes first, this still happens. If it finishes second, this fails to happen and the data isn't persisted! I think the solution is to add a mongo persistence line right hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miles-grant-ibigroup We need to be careful here because we don't want to create a new Mongo object if the other validator is expecting to do that. See ValidateFeedJob -> jobFinished(). Both validators need to be aware of the Mongo object state, so that either can create or update. Let me take a look. Good spot btw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miles-grant-ibigroup This should now be addressed. Unit tests look good. Lemme know how you get on.