Skip to content

Commit

Permalink
Catch errors thrown by BQ during entity table loading (#371)
Browse files Browse the repository at this point in the history
* Catch errors thrown by BQ during entity table loading

* Apply spotless

* Add logging at grpc service level
  • Loading branch information
Chen Zhiling authored and feast-ci-bot committed Dec 17, 2019
1 parent f2d4db5 commit 03b3135
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void getOnlineFeatures(
responseObserver.onNext(onlineFeatures);
responseObserver.onCompleted();
} catch (Exception e) {
log.warn("Failed to get Online Features", e);
responseObserver.onError(e);
}
span.finish();
Expand All @@ -88,6 +89,7 @@ public void getBatchFeatures(
responseObserver.onNext(batchFeatures);
responseObserver.onCompleted();
} catch (Exception e) {
log.warn("Failed to get Batch Features", e);
responseObserver.onError(e);
}
}
Expand All @@ -99,6 +101,7 @@ public void getJob(GetJobRequest request, StreamObserver<GetJobResponse> respons
responseObserver.onNext(response);
responseObserver.onCompleted();
} catch (Exception e) {
log.warn("Failed to get Job", e);
responseObserver.onError(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,26 @@ public GetBatchFeaturesResponse getBatchFeatures(GetBatchFeaturesRequest getFeat
.asRuntimeException();
}

Table entityTable = loadEntities(getFeaturesRequest.getDatasetSource());
Table entityTable;
String entityTableName;
try {
entityTable = loadEntities(getFeaturesRequest.getDatasetSource());

TableId entityTableWithUUIDs = generateUUIDs(entityTable);
entityTableName = generateFullTableName(entityTableWithUUIDs);
} catch (Exception e) {
throw Status.INTERNAL
.withDescription("Unable to load entity dataset to Bigquery")
.asRuntimeException();
}

Schema entityTableSchema = entityTable.getDefinition().getSchema();
List<String> entityNames =
entityTableSchema.getFields().stream()
.map(Field::getName)
.filter(name -> !name.equals("event_timestamp"))
.collect(Collectors.toList());

TableId entityTableWithUUIDs = generateUUIDs(entityTable);
String entityTableName = generateFullTableName(entityTableWithUUIDs);

List<FeatureSetInfo> featureSetInfos =
QueryTemplater.getFeatureSetInfos(featureSetSpecs, getFeaturesRequest.getFeatureSetsList());

Expand Down

0 comments on commit 03b3135

Please sign in to comment.