in Java/src/main/java/com/example/customername/FeatureGroupOperations.java [173:205]
public static void runFeatureGroupGetTests(SageMakerClient sageMakerClient, SageMakerFeatureStoreRuntimeClient sageMakerFeatureStoreRuntimeClient, List < FeatureGroupSummary > featureGroups, int amountToRepeat, String record_identifier_value) {
for (FeatureGroupSummary item: featureGroups) {
System.out.println(String.format("Getting records from feature group: %1$s", item.featureGroupName()));
PerfMetrics getRecordMetric = new PerfMetrics("Single Thread getRecord API Call");
// Get as amountToRepeat many records from FG
for (int i = 0; i < amountToRepeat; i++) {
long startTime = System.nanoTime();
// Make getRecord API call
List < FeatureValue > retrievedRecordsList = getRecord(sageMakerFeatureStoreRuntimeClient, item.featureGroupName(), record_identifier_value);
// Meassure performance time
getRecordMetric.addInterval(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime));
// Update terminal output
String output = String.format("\rRecords retreived: %1$d out of : %2$d\r", i + 1, amountToRepeat);
System.out.print(output);
// Last iteration output
if (i == amountToRepeat - 1) {
System.out.println(output);
System.out.println(String.format("Retrieved record feature values: %1$s", retrievedRecordsList));
}
}
// Print the performance
getRecordMetric.printMetrics();
}
}