10
10
import com .conveyal .gtfs .GTFS ;
11
11
import com .conveyal .gtfs .loader .Feed ;
12
12
import com .conveyal .gtfs .loader .FeedLoadResult ;
13
+ import com .conveyal .gtfs .validator .MTCValidator ;
13
14
import com .conveyal .gtfs .validator .ValidationResult ;
14
15
import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
15
16
import com .fasterxml .jackson .annotation .JsonInclude ;
@@ -226,7 +227,7 @@ public void load(MonitorableJob.Status status, boolean isNewVersion) {
226
227
File gtfsFile ;
227
228
// STEP 1. LOAD GTFS feed into relational database
228
229
try {
229
- status .update (false , "Unpacking feed..." , 15.0 );
230
+ status .update ("Unpacking feed..." , 15.0 );
230
231
// Get SQL schema namespace for the feed version. This is needed for reconnecting with feeds
231
232
// in the database.
232
233
gtfsFile = retrieveGtfsFile ();
@@ -241,19 +242,15 @@ public void load(MonitorableJob.Status status, boolean isNewVersion) {
241
242
this .namespace = feedLoadResult .uniqueIdentifier ;
242
243
LOG .info ("Loaded GTFS into SQL {}" , feedLoadResult .uniqueIdentifier );
243
244
} catch (Exception e ) {
244
- String errorString = String .format ("Error loading GTFS feed for version: %s" , this .id );
245
- LOG .warn (errorString , e );
246
- status .update (true , errorString , 0 );
245
+ status .fail (String .format ("Error loading GTFS feed for version: %s" , this .id ), e );
247
246
// FIXME: Delete local copy of feed version after failed load?
248
247
return ;
249
248
}
250
249
251
250
// FIXME: is this the right approach?
252
251
// if load was unsuccessful, update status and return
253
252
if (this .feedLoadResult == null ) {
254
- String errorString = String .format ("Could not load GTFS for FeedVersion %s" , id );
255
- LOG .error (errorString );
256
- status .update (true , errorString , 0 );
253
+ status .fail (String .format ("Could not load GTFS for FeedVersion %s" , id ));
257
254
// FIXME: Delete local copy of feed version after failed load?
258
255
return ;
259
256
}
@@ -313,11 +310,9 @@ public void validate(MonitorableJob.Status status) {
313
310
// run validation on feed version
314
311
// FIXME: pass status to validate? Or somehow listen to events?
315
312
status .update ("Validating feed..." , 33 );
316
- validationResult = GTFS .validate (feedLoadResult .uniqueIdentifier , DataManager .GTFS_DATA_SOURCE );
313
+ validationResult = GTFS .validate (feedLoadResult .uniqueIdentifier , DataManager .GTFS_DATA_SOURCE , MTCValidator :: new );
317
314
} catch (Exception e ) {
318
- String message = String .format ("Unable to validate feed %s" , this .id );
319
- LOG .error (message , e );
320
- status .update (true , message , 100 , true );
315
+ status .fail (String .format ("Unable to validate feed %s" , this .id ), e );
321
316
// FIXME create validation result with new constructor?
322
317
validationResult = new ValidationResult ();
323
318
validationResult .fatalException = "failure!" ;
0 commit comments